- Joined
- Dec 2, 2016
- Messages
- 733
//zinc
This script is for a tower called 'Time Tower'
Each minute of the game this tower is alive it will gain more damage, and if it's killed and remade/created for the first time it's damage will start at 0.
So my goal is to store when the tower was created in the integer array 'timeTower_time'
Set that to 0 when it's destroyed/first created, and add +1 every minute it's alive.
I set the boolean array 'unitHas_timeTower' to true for each player that owns it. And store the unit itself in the unit array 'timeTowers'.
I'm getting this error when I run the script, any idea what is the issue here? Thanks.
Screenshot - 5d1bb59b985750f7fd9ed0a90dd04d45 - Gyazo
This script is for a tower called 'Time Tower'
Each minute of the game this tower is alive it will gain more damage, and if it's killed and remade/created for the first time it's damage will start at 0.
So my goal is to store when the tower was created in the integer array 'timeTower_time'
Set that to 0 when it's destroyed/first created, and add +1 every minute it's alive.
I set the boolean array 'unitHas_timeTower' to true for each player that owns it. And store the unit itself in the unit array 'timeTowers'.
I'm getting this error when I run the script, any idea what is the issue here? Thanks.
Screenshot - 5d1bb59b985750f7fd9ed0a90dd04d45 - Gyazo
JASS:
library timeTower requires libMisc, libSetup, unitClassification, bloodTower {
boolean unitHas_timeTower[12];
integer timeTower_time[12];
unit timeTowers[12];
private function OnTimer60() {
integer i;
for (0 <= i < 12) {
if (unitHas_timeTower[i] == true) {
timeTower_time[i] = timeTower_time[i] + 1;
// + add damage
}
}
}
function onGameStart() {
TimerStart(CreateTimer(), 60, true, function OnTimer60);
}
function onCreation() {
unit u = GetTriggerUnit();
if (GetUnitTypeId(u == 't00T')) {
timeTowers[ConvertedPlayer(GetOwningPlayer(u))] = u;
timeTower_time[ConvertedPlayer(GetOwningPlayer(u))] = 0;
unitHas_timeTower[ConvertedPlayer(GetOwningPlayer(u))] = true;
}
}
function onDeath() {
unit d = GetDyingUnit();
if (GetUnitTypeId(d == 't00T')) {
timeTower_time[ConvertedPlayer(GetOwningPlayer(d))] = 0;
unitHas_timeTower[ConvertedPlayer(GetOwningPlayer(d))] = false;
}
}
private function onInit() {
trigger trg = TriggerCreateOnGameStart();
trigger creation = CreateTrigger();
trigger death = CreateTrigger();
TriggerRegisterAnyUnitEventBJ( creation, EVENT_PLAYER_UNIT_UPGRADE_FINISH );
TriggerRegisterAnyUnitEventBJ( death, EVENT_PLAYER_UNIT_DEATH );
TriggerAddAction(trg, function onGameStart);
TriggerAddAction(creation, function onCreation);
TriggerAddAction(death, function onDeath);
}
}
Last edited: