Timer Window Reference??

KILLJAW

New Member
Reaction score
0
> Set TempUnit1 = (Dying unit)

Any unit that dies, espectially while this trigger is waiting, will overwrite the variable...

Instead, forget the variable and work with "triggering unit".
Also, the "is a Hero" condition would be better on the trigger.


> Countdown Timer - Destroy (Last created timer window)

This is not necessarily the correct window...

Since setting a variable = dying unit will let the variable be overwritten any time a unit dies, I can rightfully assume that setting a variable = last created timer window would also be overwritten any time a new timer window is created, especially since I have the trigger wait for amounts of time, so how can I get the trigger to reference the proper window, even if a new window is created before the trigger is done waiting?

Here is my revised trigger, about which I am asking this question:
Code:
Hero Respawn
    Events
        Unit - A unit Dies
    Conditions
        ((Triggering unit) is A Hero) Equal to True
    Actions
        Countdown Timer - Start RespawnTime[(Player number of (Owner of (Triggering unit)))] as a One-shot timer that will expire in 30.00 seconds
        Countdown Timer - Create a timer window for RespawnTime[(Player number of (Owner of (Triggering unit)))] with title ((Name of (Owner of (Triggering unit))) + 's Revival)
        Set RespawnWindow[(Player number of (Owner of (Triggering unit)))] = (Last created timer window)
        Wait 24.50 seconds
        Set TempPoint = (Center of Respawn <gen>)
        Camera - Pan camera for (Owner of (Triggering unit)) to TempPoint over 5.00 seconds
        Custom script:   call RemoveLocation(udg_TempPoint)
        Wait 5.50 seconds
        Set TempPoint = (Random point in Respawn <gen>)
        Hero - Instantly revive (Triggering unit) at TempPoint, Show revival graphics
        Countdown Timer - Destroy RespawnWindow[(Player number of (Owner of (Triggering unit)))]
        Custom script:   call RemoveLocation(udg_TempPoint)
 

WilliamPa

Active Member
Reaction score
51
I assume you want your heroes respawn in time, thou i didn't even read whole trigger... If there are multiple heroes for each player, this may be abit harder. You must store each unit in unit variable, i would create own variable for each player and then set the array to how many heroes the player has. Then add event the Hero_Var with array dies. Then create timer window variable with array. If the hero dies, create timer window, store it in Timer_Var and use the Hero_Var's variable and add event to respawn trigger, which is Timer_Var with array ends. Then revive Hero_Var and use the array of Timer_Var. It would be alot easier if each plr has only one hero, but i think u need for multiple heroes anyways...

E: Thou when i looked and u were new here :p i dno, if there are only 1 hero for each plr, use player number array.
E2: U must create timer window untill u can start it :D
 

KILLJAW

New Member
Reaction score
0
I am using a player number array, and there is only 1 hero per player. The problem is when i need to destroy the timer window, it is only after a wait for 5.5 seconds. Now if another hero were to have died before those 5.5 seconds were up, then the last created timer window would now be the owner of that hero and his window would be destroyed instead of the one that had just hit 0:00.
 

WilliamPa

Active Member
Reaction score
51
Store the window in Timer_Var variable, use array of player number and then delete Timer_Var with the player number array of owner of dying unit.
 

WilliamPa

Active Member
Reaction score
51
I am not home, but i try to handwrite :/

Code:
Events:
An unit dies.
Conditions:
((Dying unit) is a hero) equal to True
Actions:
        Countdown Timer - Create a timer window for RespawnTime[(Player number of (Owner of (Triggering unit)))] with title ((Name of (Owner of (Triggering unit))) + 's Revival)
Countdown Timer - Start RespawnTime[(Player number of (Owner of (Triggering unit)))] as a One-shot timer that will expire in 30.00 seconds
        Set RespawnWindow[(Player number of (Owner of (Triggering unit)))] = (Last created timer window)
        Set TempPoint = (Center of Respawn <gen>)
        Camera - Pan camera for (Owner of TempUnit1) to TempPoint over 5.00 seconds
        Wait 5.50 seconds
        Set TempPoint = (Random point in Respawn <gen>)
        Hero - Instantly revive (Triggering unit) at TempPoint, Show revival graphics
        Countdown Timer - Destroy RespawnWindow[(Player number of (Owner of (Triggering unit)))]
        Custom script:   call RemoveLocation(udg_TempPoint)

Oh, now when i looked closer, only thing wrong was that u created the window after u started it. I used ur actions to save time now. But if som plr gets another hero, this will start leaking propably, he might even lose other hero :p
 

KILLJAW

New Member
Reaction score
0
The players can never get more than 1 hero. The problem is, during the time the trigger is waiting, another hero might die, thus causing last created timer window to become that of the hero that just died, and since the variable for the timer window is set as the last created timer window, it will be overwritten in the variable. I also made a mistake posing the trigger in my first post (my bad). I fixed it there and I will post it here as well:

Code:
Hero Respawn
    Events
        Unit - A unit Dies
    Conditions
        ((Dying unit) is A Hero) Equal to True
    Actions
        Countdown Timer - Start RespawnTime[(Player number of (Owner of (Triggering unit)))] as a One-shot timer that will expire in 30.00 seconds
        Countdown Timer - Create a timer window for RespawnTime[(Player number of (Owner of (Triggering unit)))] with title ((Name of (Owner of (Triggering unit))) + 's Revival)
        Set RespawnWindow[(Player number of (Owner of (Triggering unit)))] = (Last created timer window)
        Wait 24.50 seconds
        Set TempPoint = (Center of Respawn <gen>)
        Camera - Pan camera for (Owner of Triggering unit) to TempPoint over 5.00 seconds
        Custom script:   call RemoveLocation(udg_TempPoint)
        Wait 5.50 seconds
        Set TempPoint = (Random point in Respawn <gen>)
        Hero - Instantly revive (Triggering unit) at TempPoint, Show revival graphics
        Countdown Timer - Destroy RespawnWindow[(Player number of (Owner of (Triggering unit)))]
        Custom script:   call RemoveLocation(udg_TempPoint)
 

WilliamPa

Active Member
Reaction score
51
Realize that you are not using "last created timer" after the wait, and it is pretty unnatural that two heroes die exactly at same time.
 

KILLJAW

New Member
Reaction score
0
They wouldn't have to die at exactly the same time. If at any time during the 24.50 second wait another hero died, then since the variable RespawnTime[(Player number of (Owner of (Triggering unit)))] was set to be equal to last created timer window, the hero that died during the wait would now have the last created timer window, and so when the trigger for the hero that died first is ordered to destroy the timer window for RespawnTime[(Player number of (Owner of (Triggering unit)))] it will destroy the last created timer window, as the variable is set to, thus destroying the timer window for the hero that died during the wait, and not the hero that died first, like i want it to.

My question is: How can i make it reference the timer window created when the first hero died, even if a hero belonging to another player died during the 24.50 or 5.50 second wait period and created another timer window in doing so?
 

WilliamPa

Active Member
Reaction score
51
When you set variable in the beginning, and the hero will never rez, it could still be same after the whole game. Also it is stored in player array and u are not running set variable action again, so it will not change! It stores that window what is last created on that time, and it will not change ever untill it's set again with the same array, which cannot be same untill plr has 2 heroes or there are 2 reds/blues etc.
 

KILLJAW

New Member
Reaction score
0
So you're saying that even if the variable is set to be last created timer window, and during the wait period, another timer window is created, since it's on it's own array, it won't be overwritten. (this is what I had hoped, but wasn't sure)
 

WilliamPa

Active Member
Reaction score
51
That is corect, as you are using game changable array, if it would be array 1 or somthin, it would be overwritten, but as it is player number array and there is only 1 hero, it won't be overwritten, now plz let this thread rest to it's grave :p
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top