• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

What's wrong with a trigger with two events?

Status
Not open for further replies.
Level 16
Joined
Oct 12, 2008
Messages
1,570
Well, to be honest,, im not sure, and i never even heard of it, and it even seems quite silly to me =S,,
well, if you use Jass, it is quite easy to go around it,, make 2 triggers, with different events (your 2 events) and same actions,,
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Sometimes, I use triggers with a lot of events (Damage Detection-system), such a trigger has about 100-500 events (depends on the amount of units).
Also, events where a player says something are mostly used in combo's where all players say something (number of events depends on the number of players).

Did he/she say why they are evil, since a lot of (good) mappers often use multiple events to decrease the amount of triggers (it clears up the trigger editor).

Using conditions would also be a good idea, though that is impossible in some cases.
 
Level 6
Joined
Mar 20, 2008
Messages
208
I don't think he fully understands the nature of events. I don't have a full grasp either but I am confident it works something similiar to this, but hopefully faster/smoother/smarter/etc.

You want 5 units to trigger the same event = IE:picking heros from different buildings
You either
A) Attach those specific units to a single trigger and register it in the event manager.
The event manager's listener picks up an event, then checks the even type against its registered events. It then finds the event that matches the event type, then checks the conditions for that event (If its one of those 5 buildings) and then runs the trigger.

B) Make seperate triggers for each unit, which requires the same thing as above, but just takes up more space. Either way it has to search through 1 to N units registered for the trigger type.

C) Make the trigger generic and then put some if-then checks to see if the unit type ids match up. So now the manager runs the trigger on every single hit, which I do believe means a function call every single time, followed by boolean checks and not the other way around.
Of course this is all speculation.

On a side note, your friend could mean multiple event TYPES. Whereas you mix a unit gets attacked and a unit is trained event. When one event triggers the code it leaves the coder having to watch for potential null references, which is solved by some error-checking.

IE: If your unit is attacked event shoots off, and you are trying to reference the event's trained unit you are going to get a null reference, which is potential for problems.
 
Level 4
Joined
Mar 14, 2009
Messages
98
Nevermind. Thanks for all the help guys. I just misunderstood him (the person I was talking about in the first post). I googled a few things and learned a lot about dynamic triggers. And yes, I misunderstood him when he said "dynamic trigger" I thought that meant a trigger with two events. How silly of me.
 
Level 12
Joined
May 4, 2008
Messages
1,111
I don't think he fully understands the nature of events. I don't have a full grasp either but I am confident it works something similiar to this, but hopefully faster/smoother/smarter/etc.

You want 5 units to trigger the same event = IE:picking heros from different buildings
You either
A) Attach those specific units to a single trigger and register it in the event manager.
The event manager's listener picks up an event, then checks the even type against its registered events. It then finds the event that matches the event type, then checks the conditions for that event (If its one of those 5 buildings) and then runs the trigger.

B) Make seperate triggers for each unit, which requires the same thing as above, but just takes up more space. Either way it has to search through 1 to N units registered for the trigger type.

C) Make the trigger generic and then put some if-then checks to see if the unit type ids match up. So now the manager runs the trigger on every single hit, which I do believe means a function call every single time, followed by boolean checks and not the other way around.
Of course this is all speculation.

On a side note, your friend could mean multiple event TYPES. Whereas you mix a unit gets attacked and a unit is trained event. When one event triggers the code it leaves the coder having to watch for potential null references, which is solved by some error-checking.

IE: If your unit is attacked event shoots off, and you are trying to reference the event's trained unit you are going to get a null reference, which is potential for problems.

i like making generic events with alot of If Then Else (multiple function) in there its more understandable and takes up less time and space then making a seperate trigger for every If The Else
 
Level 6
Joined
Mar 20, 2008
Messages
208
i like making generic events with alot of If Then Else (multiple function) in there its more understandable and takes up less time and space then making a seperate trigger for every If The Else

I'm strictly talking in JASS, not GUI. I'm also talking about specific units, not dynamic events.

and relatively speaking, GUI if-then multiple functions doesn't take up much less space than making a new trigger for each one. Try converting one of your functions to custom script and you can see how big it gets.
 
Status
Not open for further replies.
Top