A noob question about unit variable

pongpong

Member
Reaction score
9
If i create a unit by using trigger, should i set a unit variable for it, or next trigger just use "last created unit" is enough if I wont refer to them in future?
 

Kahiera

Active Member
Reaction score
9
using last created unit could cause a leak.
if the trigger is applied right after the unit is created then it shouldn't be a problem
 

Cheddar

This is the way it was meant to be.
Reaction score
126
Set a variable.

If any unit is created between the time of your first and second trigger going off... well... complications arise.

Example:

Trigger 1 creates a hero.
Trigger 2 adds 1 intelligence every second to that hero. It references (Last created unit).
Trigger 3, which was accidentally neglected, spawns a Footman every 0.5 seconds.

Half of the time, your Footman will be the one who is the "Last created unit" and deny your hero experience not only once, but for every single time. Even if that Footman is removed, your hero isn't technically the last created unit.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top