HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

event /w condition vs. registerunitevent

08-27-2006, 04:12 AM#1
The_AwaKening
I have a trigger currently with a generic event "unit dies". It has a condition to check if the dying unit is a hero. Would it be much more efficient instead to register a dying event to the heros in my map as they are created. Normally there would be about 3 to 5 heros per player for about a total of 27 to 45 heros in the game.

So, say I had a trigger set to run the actions when a hero dies. There is initially no event set to that trigger, but when a player buys a hero in the game, it registers an event for that hero to the trigger.
08-27-2006, 04:42 AM#2
Vexorian
To pick which would be more efficient is to try to guess how the engine actually works for events.

If you can use a trigger the non-dynamic I would say keep it cause you won't have to deal with the DestroyTrigger bug or with cleaning Triggeractions.

The memory or process you can save seems null to me.

It is different with spell events which are usually a lot . Creating triggers dynamically is not a solution there either, it is better to have one trigger that redirects the spell's id to code directly.

--

I reread the question and as long as the trigger is always the same it is better to register the death event to that trigger . But the difference wouldn't be big enough to notice.
08-27-2006, 05:02 AM#3
Alevice
In terms of performace I don't think there would be a substantial difference, but I conisder to be a better practice to use specific units events when possible. It makes sense that the trigger is not called every time an unit dies and check if it was the unit you wanted (through a higher level language like JASS, that is).
08-27-2006, 09:50 AM#4
Anitarf
For stuff like hero revival, you can do better with the "a hero becomes revivable" event.