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

[Trigger] Can this be done more effiecently?

Status
Not open for further replies.
Level 12
Joined
Dec 10, 2008
Messages
850
Ok, so I've made this ranking system for my map (Not all the ranks are complete yet) and I was wondering if there is any way thats better then this. Note that I want to to stay GUI

  • Map Inti Stuff
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Ranks[0] = Pvt.
      • Set Ranks[1] = Pfc.
      • Set Ranks[2] = Lcpl.
      • Set Ranks[3] = Cpl.
      • Set Ranks[4] = Sgt. l
      • Set Ranks[5] = Sgt. ll
      • Set Ranks[6] = Sgt. lll
      • Set Ranks[7] = GySgt. l
      • Set Ranks[8] = GySgt. ll
      • Set Ranks[9] = GySgt. lll
      • Set Ranks[10] = Msgt. l
      • Set Ranks[11] = Msgt. ll
      • Set Ranks[12] = Msgt. lll
      • Set Ranks[13] = Sgt. Maj. l
      • Set Ranks[14] = Sgt. Maj. ll
      • Set Ranks[15] = Sgt. Maj. lll
      • Set Ranks[16] = Maj. l
      • Set Ranks[17] = Maj. ll
      • Set Ranks[18] = Maj. lll
      • Set Ranks[19] = Lt. Col. l
      • Set Ranks[20] = Lt. Col. ll
      • Set Ranks[21] = Lt. Col. lll
      • Set Ranks[22] = Col. l
      • Set Ranks[23] = Col. ll
      • Set Ranks[24] = Col. lll
      • Set Ranks[25] = Lt. Gen. l
      • Set Ranks[26] = Lt. Gen. ll
      • Set Ranks[27] = Lt. Gen. lll
      • Set Ranks[28] = Gen. l
      • Set Ranks[29] = Gen. ll
      • Set Ranks[30] = Gen. lll
      • Set Ranks[31] = Gen. 4
      • Set Ranks[32] = Gen. 5
      • Set Ranks[33] = Gen. 6
      • Set Names[1] = (Name of Player 1 (Red))
      • Set Names[2] = (Name of Player 2 (Blue))
      • Set Names[3] = (Name of Player 3 (Teal))
      • Set Names[4] = (Name of Player 4 (Purple))
      • Set Names[5] = (Name of Player 5 (Yellow))
      • Set Names[6] = (Name of Player 6 (Orange))
      • Set Names[7] = (Name of Player 7 (Green))
      • Set Names[8] = (Name of Player 8 (Pink))
      • Set Names[9] = (Name of Player 9 (Gray))
      • Set Names[10] = (Name of Player 10 (Light Blue))
  • Rank System
    • Events
      • Unit - A unit Gains a level
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Triggering unit)) Equal to ABEM Flame
          • (Unit-type of (Triggering unit)) Equal to ABEM SMG
          • (Unit-type of (Triggering unit)) Equal to ABEM Gauss
          • (Unit-type of (Triggering unit)) Equal to ABEM SMG
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Triggering unit)) Equal to Player 1 (Red)
        • Then - Actions
          • Player - Set name of Player 1 (Red) to (Ranks[((Level of (Triggering unit)) - 1)] + Names[1])
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Triggering unit)) Equal to Player 2 (Blue)
            • Then - Actions
              • Player - Set name of Player 2 (Blue) to (Ranks[((Level of (Triggering unit)) - 1)] + Names[2])
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Owner of (Triggering unit)) Equal to Player 3 (Teal)
                • Then - Actions
                  • Player - Set name of Player 3 (Teal) to (Ranks[((Level of (Triggering unit)) - 1)] + Names[3])
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Owner of (Triggering unit)) Equal to Player 4 (Purple)
                    • Then - Actions
                      • Player - Set name of Player 4 (Purple) to (Ranks[((Level of (Triggering unit)) - 1)] + Names[4])
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Owner of (Triggering unit)) Equal to Player 5 (Yellow)
                        • Then - Actions
                          • Player - Set name of Player 5 (Yellow) to (Ranks[((Level of (Triggering unit)) - 1)] + Names[5])
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Owner of (Triggering unit)) Equal to Player 6 (Orange)
                            • Then - Actions
                              • Player - Set name of Player 6 (Orange) to (Ranks[((Level of (Triggering unit)) - 1)] + Names[6])
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Owner of (Triggering unit)) Equal to Player 7 (Green)
                                • Then - Actions
                                  • Player - Set name of Player 7 (Green) to (Ranks[((Level of (Triggering unit)) - 1)] + Names[7])
                                • Else - Actions
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • (Owner of (Triggering unit)) Equal to Player 8 (Pink)
                                    • Then - Actions
                                      • Player - Set name of Player 8 (Pink) to (Ranks[((Level of (Triggering unit)) - 1)] + Names[0])
                                    • Else - Actions
                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                        • If - Conditions
                                          • (Owner of (Triggering unit)) Equal to Player 9 (Gray)
                                        • Then - Actions
                                          • Player - Set name of Player 9 (Gray) to (Ranks[((Level of (Triggering unit)) - 1)] + Names[9])
                                        • Else - Actions
                                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            • If - Conditions
                                              • (Owner of (Triggering unit)) Equal to Player 10 (Light Blue)
                                            • Then - Actions
                                              • Player - Set name of Player 10 (Light Blue) to (Ranks[((Level of (Triggering unit)) - 1)] + Names[10])
                                            • Else - Actions
It gets really long after awhile. Basicly all trigger one does is declare the ranks, and store the players starting name, so it doesnt add the other stuff from the ranks before (learned that the hard way) So is there any GUI way I can pull this off and keep it effective at the same time?
 
i didnt test this but im sure it would work.


keep the first trigger, but for the actions in the second use:
  • Actions
    • For each (Integer A) from 1 to 10, do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Owner of (Triggering unit)) Equal to (Player((Integer A)))
          • Then - Actions
            • Player - Set name of (Player((Integer A))) to (Ranks[((Level of (Triggering unit)) - 1)] + Names[Integer A])
          • Else - Actions
Instructions:
1. For Each Integer A, Do Multiple Actions (1 - 10 because there are 10 players)
_2. inside Loop, If / Then / Else, Multiple Functions
__3. inside Conditions, Player Comparison (Conversion - Convert Player Index To Player)
__4. inside Actions, Player - Set Name
 
heh i forgot that you don't even need a condition.

Try Peq's Way.

Its

Actions:
1. Player - Set Name
__Set name of
__2. Function: (Owner of (Triggering unit)) (im sure you know that)
__to
__3. Concatenate Strings
____4. String 1: Variable: Ranks[((Level of triggering unit) - 1)] (You got that part)
____+
____5. String 2: Variable: Names[((Player number of (Owner of Triggering Unit))] (You got this too)

it should work.
 
Status
Not open for further replies.
Top