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

Feedback on my Triggers

Status
Not open for further replies.
Level 7
Joined
Aug 5, 2010
Messages
147
I currently intend to make a map i develop unprotected, because of this i would like to know if my triggers could be better, if they could be done more efficiently and if there are any bugs or potentially game crashing issues.

I have posted the map in question along with this post.

All the triggers have comments on them some being more detailed than others to make it easier to understand those triggers.

All triggers are made using the GUI

Edit: Updated Map
Edit2: Updated Map Again
Edit3: Ver 1.08 is now released, deleted attached map.
 
Last edited:
These triggers can be greatly improved. My biggest gripe right now is the pointless number of single action If/Then/Else functions you have and the number of leaks. You should avoid using the single action one and just always use multiple actions. For leaks, check out Things That Leak or Memory Leaks. A great way to improve efficiency of your triggers is to store things into variables. This makes it so that you don't have to keep calling the function if you need something, you can just go to the variable which stores the information or "data".
 
Level 7
Joined
Aug 5, 2010
Messages
147
My biggest gripe right now is the pointless number of single action If/Then/Else functions you have.

Im not entirely sure what you mean by this, if you could post an example trigger from the map that would help me better understand what you mean.

---

I fixed 2 leaks

Units entering the final region will now be removed from the game instead of killed.

Effects created when a life is lost will now be destroyed properly

Ive Updated the map in the original post.
 
Level 7
Joined
Aug 5, 2010
Messages
147
I have made several triggers more efficiant, have tested them and they work the same as before the changes.

  • Research Tower Buy
    • Events
      • Unit - A unit Finishes construction
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Constructed structure)) Equal to Research Tower 1: Demon Hunter
        • Then - Actions
          • Player - Limit training of Research Tower 1: Demon Hunter to 0 for (Owner of (Constructed structure))
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of (Constructed structure)) Equal to Player 1 (Red)) and ((Unit-type of (Constructed structure)) Equal to Research Tower 1: Demon Hunter)
        • Then - Actions
          • Player - Limit training of Research Tower 1: Demon Hunter to 0 for Player 1 (Red)
        • Else - Actions
The above trigger used to be the last part repeated 9 times for each player.


  • Research Tower Sell
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Casting unit)) Equal to Research Tower 1: Demon Hunter
          • (Unit-type of (Casting unit)) Equal to Research Tower 2: Tinker
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Unit-type of (Casting unit)) Equal to Research Tower 1: Demon Hunter
              • (Unit-type of (Casting unit)) Equal to Research Tower 2: Tinker
        • Then - Actions
          • Player - Limit training of Research Tower 1: Demon Hunter to 1 for (Owner of (Casting unit))
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Casting unit)) Equal to Player 1 (Red)
        • Then - Actions
          • Player - Limit training of Research Tower 1: Demon Hunter to 1 for Player 1 (Red)
        • Else - Actions
This trigger also had the last part repeated 9 times along with the 1st condition.


  • Set Variables
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players matching ((((Picked player) controller) Equal to User) and (((Picked player) slot status) Equal to Is playing))) and do (Actions)
        • Loop - Actions
          • Set Players = (Players + 1)
      • If ((Player 1 (Red) slot status) Equal to Is playing) then do (Set Players = (Players + 1)) else do (Do nothing)
This is a smaller part of this trigger but again it used to be the last part repeated 9 times.

  • Player Update Leave
    • Events
      • Player - Player 1 (Red) leaves the game
      • Player - Player 2 (Blue) leaves the game
      • Player - Player 3 (Teal) leaves the game
      • Player - Player 4 (Purple) leaves the game
      • Player - Player 5 (Yellow) leaves the game
      • Player - Player 6 (Orange) leaves the game
      • Player - Player 7 (Green) leaves the game
      • Player - Player 8 (Pink) leaves the game
      • Player - Player 9 (Gray) leaves the game
    • Conditions
    • Actions
      • Multiboard - Set the text for (Last created multiboard) item in column 1, row ((Player number of (Triggering player)) + 1) to (MultiBoard_Colours[(Player number of (Triggering player))] + (-Left the Game- + |r))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Triggering player) Equal to Player 1 (Red)
        • Then - Actions
  • Multiboard - Set the text for (Last created multiboard) item in column 1, row 2 to (MultiBoard_Colours[1] + (-Left the Game- + |r))
    • Else - Actions
Again, last part repeated 9 times.

Some of theses triggers ive known weren't as efficient as they could be when i created them, so im basiclly just going over the triggers and fixing the ones i can see as being inefficient or leaky straight away. If someone could tell me what others triggers could be improved and perhaps how to improve, all within the constraints of GUI ofc, that would be good.

I have once again updated the map in the original post.
 
for the first trigger store the triggering player into a variable and that should reduce your 9 triggers into 1. same goes for the second trigger. for the third one use picked player. for the fourth use triggering player. that's about it. i would also recommend storing fuctions that you often use into a variable (i.e. triggering unit, triggering player) also use triggering unit instead of casting unit. good luck
 
Status
Not open for further replies.
Top