Post 27 Sep 2015, 23:21 by Esthlos
- Code:
const
cDelay = 6000; //Every unit is fed in 6000 ticks (10 minutes; 1 tick is 0,1 seconds); set this too low and the script performance gets worse, set this too high and the script becomes useless
var
aPlayer, aTime, aActualDelay: Integer;
procedure OnMissionStart;
begin
aActualDelay := cDelay div States.LocationCount;
end;
procedure OnTick;
var
iUnits: array of Integer;
i: Integer;
begin
Inc(aTime);
if aTime > aActualDelay then begin
aTime := 0;
Inc(aPlayer);
if aPlayer >= States.LocationCount then aPlayer := 0;
iUnits := States.GetAllUnits(aPlayer);
for i := 0 to Length(iUnits)-1 do Actions.UnitHungerSet(iUnits[i], States.UnitMaxHunger);
end;
end;
Just when you think you know something, you have to look at it in another way, even though it may seem silly or wrong. You must try! - John Keating, "Dead Poets Society"