- Joined
- Feb 17, 2007
- Messages
- 368
The bosses in my map are units, not heroes. When the game restarts, I want to be able to revive them. How would I go about doing this?
Re add the events to the triggers. The event leak should be of little concern unless people kill the boss hundreds of times.
Triggers do not point at variables, they point at the unit when the event was added.
You just readd the event to the trigger for the new unit. Do not understand? Then that is because GUI obscures the JASS way how triggers work. You can however add events to triggers despite this being unclear in GUI.
When you respawn the boss, add a new event (via the add event action) for the events the boss needs to the triggers the boss needs. For the reference unit, that you use a variable (it still will only add the unit in the variable to the event at the time the action is run).
Triggers are objects which run triggeraction objects if triggercondition objects evaluate to true. They are executed by eithor another function (via the appropiate native) or when an event fires. Events are objects that are attached to a trigger and govern when it should run. Events that reference specific units will only reference the unit that was passed to the event constructor at the time of creation.
A flaw with WC3 is there is no "RemoveEvent" or "ClearEvents" natives so you have to use trigger destruction to purge them (recreating the trigger is easy). This however introduces instability apparently due to some handle allocation bug which can cause a fatal error.