[Trigger] Does this trigger work? and: What can I improve on it?

Status
Not open for further replies.
Level 4
Joined
Aug 12, 2014
Messages
48
Not sure on the player amounts / limits for the map right now. Considering lowering it to 3 Senators (It is actually 2, as one of those Senators will eventually become a President) so the map can be played with fewer people.

As far as I know, this trigger should work to randomly select 5 of X players to become senators.

Any ideas on things that I can do to improve this trigger or make it function better?

  • Senator Election
    • Events
      • Time - Elapsed game time is 60.00 seconds
    • Conditions
      • Senator_Count Less than or equal to 5
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of players in Group_Election) Greater than or equal to 1
        • Then - Actions
          • Player Group - Pick every player in Group_Election and do (Actions)
            • Loop - Actions
              • Player Group - Add (Random player from Group_Election) to Group_Senators
              • Player Group - Remove (Picked player) from Group_Election
              • Unit Group - Pick every unit in (Units owned by (Picked player)) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Unit-type of (Picked unit)) Equal to Citizen (Male)
                    • Then - Actions
                      • Unit - Replace (Picked unit) with a Senator (Male) using The old unit's relative life and mana
                    • Else - Actions
              • Set Senator_Count = (Senator_Count + 1)
              • Trigger - Run Senator Election <gen> (checking conditions)
        • Else - Actions
 
Level 6
Joined
Aug 28, 2015
Messages
213
This is so not really right way to do this because you pick every elected player but add a random as senator so the chance is high the picked one will not be the same as the random one.
I would do something like
Loop from 1 to maxSenatorAmount
Set selectedSenator random player of electedGroup
Remove selectedSenator from group electedGroup
Add player selectedSenator to senatorGroup
Pick every unit from player selectedSenator replace...
 
Status
Not open for further replies.
Top