Official Soldat Forums

Server Talk => Scripting Discussions and Help => Topic started by: Bolt on September 15, 2008, 06:36:33 am

Title: Small little help required : ]
Post by: Bolt on September 15, 2008, 06:36:33 am
http://forums.soldat.pl/index.php?topic=17162.0

This script here is great, however, I need it to work with a negative value, so the health decreaces over time. Could someone make the health decrease by -1 instead of increasing by 5.

Also, I accept links to other scripts which perform what I'm talking about properly : P
Title: Re: Small little help required : ]
Post by: Norbo on September 15, 2008, 06:42:22 am
Code: [Select]
// Health Regeneration Script v1.2 by Avkon
// This script automatically replenishes lost health of all players at a specified pace.

// Declare a couple of essential values:
const
  MAX_HEALTH = 150; // Set to 150 for non-realistic mode, else set to 65.
  DROP_VALUE = 1;   // Value of each 'drop' of health, def: 5.

// Incorporate main health regen code into AppOnIdle procedure:
procedure AppOnIdle(Ticks: integer);
var i: byte;
begin
  if Ticks mod (60 * 1) = 0 then begin
  for  i := 1 to 32 do
    if (GetPlayerStat(i,'Health') < (MAX_HEALTH - (DROP_VALUE - 1))) then begin
      DoDamage(i,DROP_VALUE);
    end else begin
      DoDamage(i,(MAX_HEALTH - (GetPlayerStat(i,'Health'))));
    end;
  end;
end;

// Inform players of health regen modification:
procedure OnJoinTeam(ID, Team: byte);
begin
  SayToPlayer(ID, 'This server runs the following mod:');
  SayToPlayer(ID, '! Health Regeneration Script v1.2 (by Avkon)');
end;

i guess delating the + in onPlayerDamage and setting drop value to 1 will do
not tested
Title: Re: Small little help required : ]
Post by: Bolt on September 15, 2008, 02:46:56 pm
So you think that if I changed my script with that it should work?
Title: Re: Small little help required : ]
Post by: Norbo on September 15, 2008, 03:05:33 pm
So you think that if I changed my script with that it should work?
i guess
Title: Re: Small little help required : ]
Post by: DorkeyDear on September 16, 2008, 05:30:11 am
MAX_HEALTH should be 65 when realistic is enabled