• 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.

Do you create one big "leave trigger"?

Status
Not open for further replies.
Level 15
Joined
Nov 30, 2007
Messages
1,202
Do you create one huge leave trigger in your map or do you devide them into your libraries, so they work more on their own? I currently have a 600 line code diplomacy library and a 500 line code "City Building" library, both have 4-6 triggers in them, would making seperate leave triggers for them be "bad"?


The benifit is that you can keep using "private variable" but then again perhaps I shouldn't be doing that in the first place? I suppose its hard for you to tell.

Would just like to hear your thoughts on the general practice.
 
Level 28
Joined
Sep 26, 2009
Messages
2,520
You should make non-MUI systems only for about 1, 2 or 3 specific units, but for other cases, mainly when you dynamically set the buildings/diplomacy, you should aim to make the system MUI... or in your case it seems MPI would be enough.
While it will complicate the code a bit, it will have lots of benefits:
1) you use arrays instead of unique variable for each instance
2) less triggers - MPI would use only X triggers, while non-MPI/non-MUI uses X*(amount of players) triggers => less events fired
3) everything more mechanized
4) easier time fixing or adding something new
5) It may also simplify the code a bit because you'll be able to use loops in conjunction with arrays

I'm not sure if that's the answer you want tho.
In the end, it all depends on if said system can even be MUI. I don't know your diplomacy system, so I don't know if you can save some stuff you need, etc.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
Separate leave triggers are perfectly fine as long as you limit it to only 1 per complete system/library (more than 1 is unnecessary). The event can fire at most 11 times (since the last person to leave obviously terminates the session) so any inefficiency from multiple triggers with the same event can be ignored.

You could do some kind of event dispatch system (1 event to many functions). The idea behind such a system is you can take generic events and execute code in a specific way more efficiently (best example would be a player wide cast event that only runs code for certain spells saving making such huge scope events for all spells) but I really do not see a benefit to it in this case as the event fires so little and is such a small scope anyway.
 
Status
Not open for further replies.
Top