Why aren't these random triggers working?

Dark_Phoenix

New Member
Reaction score
3
Code:
Random
    Events
        Unit - A unit Begins casting an ability
    Conditions
        (Random <gen> contains (Triggering unit)) Equal to True
        (Ability being cast) Equal to Pick 
    Actions
        Set Random = (Random integer number between 1 and 9)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Random Not equal to -1
            Then - Actions
                -------- Soldier --------
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Random Equal to 1
                        (Owner of Circle of Power (large) 0011 <gen>) Equal to Neutral Passive
                    Then - Actions
                        Unit - Remove (Triggering unit) from the game
                        Unit - Change ownership of Circle of Power (large) 0011 <gen> to (Owner of (Triggering unit)) and Change color
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                ((Triggering player) is an ally of Player 1 (Red)) Equal to True
                            Then - Actions
                                Set tempPoint = (Center of Waiting Room <gen>)
                                Unit - Create 1 Soldier for (Owner of (Triggering unit)) at tempPoint facing Default building facing degrees
                                Custom script:   call RemoveLocation(udg_tempPoint)
                            Else - Actions
                                Set tempPoint = (Center of Waiting Room 2 <gen>)
                                Unit - Create 1 Soldier for (Owner of (Triggering unit)) at tempPoint facing Default building facing degrees
                                Custom script:   call RemoveLocation(udg_tempPoint)
                    Else - Actions
                        Set Random = (Random + 1)
                -------- Swordsman --------
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Random Equal to 2
                        (Owner of Circle of Power (large) 0024 <gen>) Equal to Neutral Passive
                    Then - Actions
                        Unit - Remove (Triggering unit) from the game
                        Unit - Change ownership of Circle of Power (large) 0024 <gen> to (Owner of (Triggering unit)) and Change color
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                ((Triggering player) is an ally of Player 1 (Red)) Equal to True
                            Then - Actions
                                Set tempPoint = (Center of Waiting Room <gen>)
                                Unit - Create 1 Swordsman for (Owner of (Triggering unit)) at tempPoint facing Default building facing degrees
                                Custom script:   call RemoveLocation(udg_tempPoint)
                            Else - Actions
                                Set tempPoint = (Center of Waiting Room 2 <gen>)
                                Unit - Create 1 Swordsman for (Owner of (Triggering unit)) at tempPoint facing Default building facing degrees
                                Custom script:   call RemoveLocation(udg_tempPoint)
                    Else - Actions
                        Set Random = (Random + 1)
                -------- Mage --------
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Random Equal to 3
                        (Owner of Circle of Power (large) 0093 <gen>) Equal to Neutral Passive
                    Then - Actions
                        Unit - Remove (Triggering unit) from the game
                        Unit - Change ownership of Circle of Power (large) 0093 <gen> to (Owner of (Triggering unit)) and Change color
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                ((Triggering player) is an ally of Player 1 (Red)) Equal to True
                            Then - Actions
                                Set tempPoint = (Center of Waiting Room <gen>)
                                Unit - Create 1 Wizard for (Owner of (Triggering unit)) at tempPoint facing Default building facing degrees
                                Custom script:   call RemoveLocation(udg_tempPoint)
                            Else - Actions
                                Set tempPoint = (Center of Waiting Room 2 <gen>)
                                Unit - Create 1 Wizard for (Owner of (Triggering unit)) at tempPoint facing Default building facing degrees
                                Custom script:   call RemoveLocation(udg_tempPoint)
                    Else - Actions
                        Set Random = (Random + 1)
                -------- Robot --------
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Random Equal to 4
                        (Owner of Circle of Power (large) 0258 <gen>) Equal to Neutral Passive
                    Then - Actions
                        Unit - Remove (Triggering unit) from the game
                        Unit - Change ownership of Circle of Power (large) 0258 <gen> to (Owner of (Triggering unit)) and Change color
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                ((Triggering player) is an ally of Player 1 (Red)) Equal to True
                            Then - Actions
                                Set tempPoint = (Center of Waiting Room <gen>)
                                Unit - Create 1 Robot for (Owner of (Triggering unit)) at tempPoint facing Default building facing degrees
                                Custom script:   call RemoveLocation(udg_tempPoint)
                            Else - Actions
                                Set tempPoint = (Center of Waiting Room 2 <gen>)
                                Unit - Create 1 Robot for (Owner of (Triggering unit)) at tempPoint facing Default building facing degrees
                                Custom script:   call RemoveLocation(udg_tempPoint)
                    Else - Actions
                        Set Random = (Random + 1)
                -------- Thief --------
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Random Equal to 5
                        (Owner of Circle of Power (large) 0279 <gen>) Equal to Neutral Passive
                    Then - Actions
                        Unit - Remove (Triggering unit) from the game
                        Unit - Change ownership of Circle of Power (large) 0279 <gen> to (Owner of (Triggering unit)) and Change color
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                ((Triggering player) is an ally of Player 1 (Red)) Equal to True
                            Then - Actions
                                Set tempPoint = (Center of Waiting Room <gen>)
                                Unit - Create 1 Thief for (Owner of (Triggering unit)) at tempPoint facing Default building facing degrees
                                Custom script:   call RemoveLocation(udg_tempPoint)
                            Else - Actions
                                Set tempPoint = (Center of Waiting Room 2 <gen>)
                                Unit - Create 1 Thief for (Owner of (Triggering unit)) at tempPoint facing Default building facing degrees
                                Custom script:   call RemoveLocation(udg_tempPoint)
                    Else - Actions
                        Set Random = (Random + 1)
                -------- Darkness --------
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Random Equal to 6
                        (Owner of Circle of Power (large) 0095 <gen>) Equal to Neutral Passive
                    Then - Actions
                        Unit - Remove (Triggering unit) from the game
                        Unit - Change ownership of Circle of Power (large) 0095 <gen> to (Owner of (Triggering unit)) and Change color
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                ((Triggering player) is an ally of Player 1 (Red)) Equal to True
                            Then - Actions
                                Set tempPoint = (Center of Waiting Room <gen>)
                                Unit - Create 1 Darkness for (Owner of (Triggering unit)) at tempPoint facing Default building facing degrees
                                Custom script:   call RemoveLocation(udg_tempPoint)
                            Else - Actions
                                Set tempPoint = (Center of Waiting Room 2 <gen>)
                                Unit - Create 1 Darkness for (Owner of (Triggering unit)) at tempPoint facing Default building facing degrees
                                Custom script:   call RemoveLocation(udg_tempPoint)
                    Else - Actions
                        Set Random = (Random + 1)
                -------- Hell Lord  --------
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Random Equal to 7
                        (Owner of Circle of Power (large) 0264 <gen>) Equal to Neutral Passive
                    Then - Actions
                        Unit - Remove (Triggering unit) from the game
                        Unit - Change ownership of Circle of Power (large) 0264 <gen> to (Owner of (Triggering unit)) and Change color
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                ((Triggering player) is an ally of Player 1 (Red)) Equal to True
                            Then - Actions
                                Set tempPoint = (Center of Waiting Room <gen>)
                                Unit - Create 1 Lord of Hell for (Owner of (Triggering unit)) at tempPoint facing Default building facing degrees
                                Custom script:   call RemoveLocation(udg_tempPoint)
                            Else - Actions
                                Set tempPoint = (Center of Waiting Room 2 <gen>)
                                Unit - Create 1 Lord of Hell for (Owner of (Triggering unit)) at tempPoint facing Default building facing degrees
                                Custom script:   call RemoveLocation(udg_tempPoint)
                    Else - Actions
                        Set Random = (Random + 1)
                -------- Priest --------
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Random Equal to 8
                        (Owner of Circle of Power (large) 0239 <gen>) Equal to Neutral Passive
                    Then - Actions
                        Unit - Remove (Triggering unit) from the game
                        Unit - Change ownership of Circle of Power (large) 0239 <gen> to (Owner of (Triggering unit)) and Change color
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                ((Triggering player) is an ally of Player 1 (Red)) Equal to True
                            Then - Actions
                                Set tempPoint = (Center of Waiting Room <gen>)
                                Unit - Create 1 Priest for (Owner of (Triggering unit)) at tempPoint facing Default building facing degrees
                                Custom script:   call RemoveLocation(udg_tempPoint)
                            Else - Actions
                                Set tempPoint = (Center of Waiting Room 2 <gen>)
                                Unit - Create 1 Priest for (Owner of (Triggering unit)) at tempPoint facing Default building facing degrees
                                Custom script:   call RemoveLocation(udg_tempPoint)
                    Else - Actions
                        Set Random = (Random + 1)
                -------- Savior --------
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Random Equal to 9
                        (Owner of Circle of Power (large) 0250 <gen>) Equal to Neutral Passive
                    Then - Actions
                        Unit - Remove (Triggering unit) from the game
                        Unit - Change ownership of Circle of Power (large) 0250 <gen> to (Owner of (Triggering unit)) and Change color
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                ((Triggering player) is an ally of Player 1 (Red)) Equal to True
                            Then - Actions
                                Set tempPoint = (Center of Waiting Room <gen>)
                                Unit - Create 1 Savior for (Owner of (Triggering unit)) at tempPoint facing Default building facing degrees
                                Custom script:   call RemoveLocation(udg_tempPoint)
                            Else - Actions
                                Set tempPoint = (Center of Waiting Room 2 <gen>)
                                Unit - Create 1 Savior for (Owner of (Triggering unit)) at tempPoint facing Default building facing degrees
                                Custom script:   call RemoveLocation(udg_tempPoint)
                    Else - Actions
                        Trigger - Run Random2 <gen> (ignoring conditions)
            Else - Actions
                Do nothing

Code:
Random2
    Events
        Unit - A unit Begins casting an ability
    Conditions
        (Random <gen> contains (Triggering unit)) Equal to True
        (Ability being cast) Equal to Pick 
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Random Not equal to -1
            Then - Actions
                -------- Soldier --------
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Random Equal to 1
                        (Owner of Circle of Power (large) 0011 <gen>) Equal to Neutral Passive
                    Then - Actions
                        Unit - Remove (Triggering unit) from the game
                        Unit - Change ownership of Circle of Power (large) 0011 <gen> to (Owner of (Triggering unit)) and Change color
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                ((Triggering player) is an ally of Player 1 (Red)) Equal to True
                            Then - Actions
                                Set tempPoint = (Center of Waiting Room <gen>)
                                Unit - Create 1 Soldier for (Owner of (Triggering unit)) at tempPoint facing Default building facing degrees
                                Custom script:   call RemoveLocation(udg_tempPoint)
                            Else - Actions
                                Set tempPoint = (Center of Waiting Room 2 <gen>)
                                Unit - Create 1 Soldier for (Owner of (Triggering unit)) at tempPoint facing Default building facing degrees
                                Custom script:   call RemoveLocation(udg_tempPoint)
                    Else - Actions
                        Set Random = (Random + 1)
                -------- Swordsman --------
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Random Equal to 2
                        (Owner of Circle of Power (large) 0024 <gen>) Equal to Neutral Passive
                    Then - Actions
                        Unit - Remove (Triggering unit) from the game
                        Unit - Change ownership of Circle of Power (large) 0024 <gen> to (Owner of (Triggering unit)) and Change color
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                ((Triggering player) is an ally of Player 1 (Red)) Equal to True
                            Then - Actions
                                Set tempPoint = (Center of Waiting Room <gen>)
                                Unit - Create 1 Swordsman for (Owner of (Triggering unit)) at tempPoint facing Default building facing degrees
                                Custom script:   call RemoveLocation(udg_tempPoint)
                            Else - Actions
                                Set tempPoint = (Center of Waiting Room 2 <gen>)
                                Unit - Create 1 Swordsman for (Owner of (Triggering unit)) at tempPoint facing Default building facing degrees
                                Custom script:   call RemoveLocation(udg_tempPoint)
                    Else - Actions
                        Set Random = (Random + 1)
                -------- Mage --------
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Random Equal to 3
                        (Owner of Circle of Power (large) 0093 <gen>) Equal to Neutral Passive
                    Then - Actions
                        Unit - Remove (Triggering unit) from the game
                        Unit - Change ownership of Circle of Power (large) 0093 <gen> to (Owner of (Triggering unit)) and Change color
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                ((Triggering player) is an ally of Player 1 (Red)) Equal to True
                            Then - Actions
                                Set tempPoint = (Center of Waiting Room <gen>)
                                Unit - Create 1 Wizard for (Owner of (Triggering unit)) at tempPoint facing Default building facing degrees
                                Custom script:   call RemoveLocation(udg_tempPoint)
                            Else - Actions
                                Set tempPoint = (Center of Waiting Room 2 <gen>)
                                Unit - Create 1 Wizard for (Owner of (Triggering unit)) at tempPoint facing Default building facing degrees
                                Custom script:   call RemoveLocation(udg_tempPoint)
                    Else - Actions
                        Set Random = (Random + 1)
                -------- Robot --------
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Random Equal to 4
                        (Owner of Circle of Power (large) 0258 <gen>) Equal to Neutral Passive
                    Then - Actions
                        Unit - Remove (Triggering unit) from the game
                        Unit - Change ownership of Circle of Power (large) 0258 <gen> to (Owner of (Triggering unit)) and Change color
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                ((Triggering player) is an ally of Player 1 (Red)) Equal to True
                            Then - Actions
                                Set tempPoint = (Center of Waiting Room <gen>)
                                Unit - Create 1 Robot for (Owner of (Triggering unit)) at tempPoint facing Default building facing degrees
                                Custom script:   call RemoveLocation(udg_tempPoint)
                            Else - Actions
                                Set tempPoint = (Center of Waiting Room 2 <gen>)
                                Unit - Create 1 Robot for (Owner of (Triggering unit)) at tempPoint facing Default building facing degrees
                                Custom script:   call RemoveLocation(udg_tempPoint)
                    Else - Actions
                        Set Random = (Random + 1)
                -------- Thief --------
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Random Equal to 5
                        (Owner of Circle of Power (large) 0279 <gen>) Equal to Neutral Passive
                    Then - Actions
                        Unit - Remove (Triggering unit) from the game
                        Unit - Change ownership of Circle of Power (large) 0279 <gen> to (Owner of (Triggering unit)) and Change color
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                ((Triggering player) is an ally of Player 1 (Red)) Equal to True
                            Then - Actions
                                Set tempPoint = (Center of Waiting Room <gen>)
                                Unit - Create 1 Thief for (Owner of (Triggering unit)) at tempPoint facing Default building facing degrees
                                Custom script:   call RemoveLocation(udg_tempPoint)
                            Else - Actions
                                Set tempPoint = (Center of Waiting Room 2 <gen>)
                                Unit - Create 1 Thief for (Owner of (Triggering unit)) at tempPoint facing Default building facing degrees
                                Custom script:   call RemoveLocation(udg_tempPoint)
                    Else - Actions
                        Set Random = (Random + 1)
                -------- Darkness --------
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Random Equal to 6
                        (Owner of Circle of Power (large) 0095 <gen>) Equal to Neutral Passive
                    Then - Actions
                        Unit - Remove (Triggering unit) from the game
                        Unit - Change ownership of Circle of Power (large) 0095 <gen> to (Owner of (Triggering unit)) and Change color
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                ((Triggering player) is an ally of Player 1 (Red)) Equal to True
                            Then - Actions
                                Set tempPoint = (Center of Waiting Room <gen>)
                                Unit - Create 1 Darkness for (Owner of (Triggering unit)) at tempPoint facing Default building facing degrees
                                Custom script:   call RemoveLocation(udg_tempPoint)
                            Else - Actions
                                Set tempPoint = (Center of Waiting Room 2 <gen>)
                                Unit - Create 1 Darkness for (Owner of (Triggering unit)) at tempPoint facing Default building facing degrees
                                Custom script:   call RemoveLocation(udg_tempPoint)
                    Else - Actions
                        Set Random = (Random + 1)
                -------- Hell Lord  --------
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Random Equal to 7
                        (Owner of Circle of Power (large) 0264 <gen>) Equal to Neutral Passive
                    Then - Actions
                        Unit - Remove (Triggering unit) from the game
                        Unit - Change ownership of Circle of Power (large) 0264 <gen> to (Owner of (Triggering unit)) and Change color
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                ((Triggering player) is an ally of Player 1 (Red)) Equal to True
                            Then - Actions
                                Set tempPoint = (Center of Waiting Room <gen>)
                                Unit - Create 1 Lord of Hell for (Owner of (Triggering unit)) at tempPoint facing Default building facing degrees
                                Custom script:   call RemoveLocation(udg_tempPoint)
                            Else - Actions
                                Set tempPoint = (Center of Waiting Room 2 <gen>)
                                Unit - Create 1 Lord of Hell for (Owner of (Triggering unit)) at tempPoint facing Default building facing degrees
                                Custom script:   call RemoveLocation(udg_tempPoint)
                    Else - Actions
                        Set Random = (Random + 1)
                -------- Priest --------
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Random Equal to 8
                        (Owner of Circle of Power (large) 0239 <gen>) Equal to Neutral Passive
                    Then - Actions
                        Unit - Remove (Triggering unit) from the game
                        Unit - Change ownership of Circle of Power (large) 0239 <gen> to (Owner of (Triggering unit)) and Change color
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                ((Triggering player) is an ally of Player 1 (Red)) Equal to True
                            Then - Actions
                                Set tempPoint = (Center of Waiting Room <gen>)
                                Unit - Create 1 Priest for (Owner of (Triggering unit)) at tempPoint facing Default building facing degrees
                                Custom script:   call RemoveLocation(udg_tempPoint)
                            Else - Actions
                                Set tempPoint = (Center of Waiting Room 2 <gen>)
                                Unit - Create 1 Priest for (Owner of (Triggering unit)) at tempPoint facing Default building facing degrees
                                Custom script:   call RemoveLocation(udg_tempPoint)
                    Else - Actions
                        Set Random = (Random + 1)
                -------- Savior --------
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Random Equal to 9
                        (Owner of Circle of Power (large) 0250 <gen>) Equal to Neutral Passive
                    Then - Actions
                        Unit - Remove (Triggering unit) from the game
                        Unit - Change ownership of Circle of Power (large) 0250 <gen> to (Owner of (Triggering unit)) and Change color
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                ((Triggering player) is an ally of Player 1 (Red)) Equal to True
                            Then - Actions
                                Set tempPoint = (Center of Waiting Room <gen>)
                                Unit - Create 1 Savior for (Owner of (Triggering unit)) at tempPoint facing Default building facing degrees
                                Custom script:   call RemoveLocation(udg_tempPoint)
                            Else - Actions
                                Set tempPoint = (Center of Waiting Room 2 <gen>)
                                Unit - Create 1 Savior for (Owner of (Triggering unit)) at tempPoint facing Default building facing degrees
                                Custom script:   call RemoveLocation(udg_tempPoint)
                    Else - Actions
                        Game - Display to (Player group((Owner of (Triggering unit)))) the text: There was an error ...
            Else - Actions
                Do nothing
WARNING REALLY LONG CODE


For some reason, this code always returns the error message and never actually randoms a hero. Why is this?

EDIT: Actually, I think I may have found the problem, hang on..
EDIT2: Nope, now all it'll random is the Soldier hero...I tried adding a "Set Variable - Random = 1" in the end of the first trigger... I actually think the determining of the variable is what's causing it..
 

YourFace

<span style="color:#9C9C9C;"><strong>Runner Up - T
Reaction score
91
the trigger is really really really long, it's easy to make a small mistake
try making a shorter trigger or part of the trigger you think might be bad
because you dont have one big trigger, you have 2....
EDIT also what do these triggers even do?
EDIt try looping too
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top