• 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] Random Event Periodically - +REP

Status
Not open for further replies.
Level 9
Joined
Jul 11, 2009
Messages
294
Hello,

I need a trigger in GUI.
That does this trigger..

Every 240 seconds of the game..

there will be

20% chance of 10 bandits attacking the city
20% chance of 10 orcs attacking the city
20% chance of 10 ogres attacking the city
20% chance of 10 trolls attacking the city
20% chance of 10 creeps attacking the city.

I need this to be in a map,+REP to anyone who manages to help.

Thanks in advance.
 
Level 2
Joined
Nov 1, 2009
Messages
19
  • Untitled Trigger 001
    • Events
      • Time - Every 240.00 seconds of game time
    • Conditions
    • Actions
      • Set RandomValue = (Random real number between 0.00 and 100.00)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RandomValue Less than 20.00
        • Then - Actions
          • -------- Do your attack triggers here (bandits) --------
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • RandomValue Less than 40.00
            • Then - Actions
              • -------- Do your attack triggers here (orcs) --------
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • RandomValue Less than 60.00
                • Then - Actions
                  • -------- Do your attack triggers here (ogres) --------
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • RandomValue Less than 80.00
                    • Then - Actions
                      • -------- Do your attack triggers here (trolls) --------
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • RandomValue Less than 100.00
                        • Then - Actions
                          • -------- Do your attack triggers here (creeps) --------
                        • Else - Actions
this should do, I guess.
 
Level 4
Joined
Jan 29, 2007
Messages
98
Here, just make that "If" 4 more times, and change the condition to a higher number each time ;)

  • Percentage
    • Events
      • Time - Every 240.00 seconds of game time
    • Conditions
    • Actions
      • Set Percentage = (Random integer number between 1 and 5)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Percentage Equal to 1
        • Then - Actions
          • Set TempPoint = (Center of Region 1 <gen>)
          • Unit - Create 10 Footman for Player 1 (Red) at TempPoint facing Default building facing degrees
          • Custom script: call RemoveLocation(udg_TempPoint)
        • Else - Actions
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Something like this perhaps?


  • Random Attacks
    • Events
      • Time - Every 240.00 seconds of game time
    • Conditions
    • Actions
      • Set RanInt = (Random integer number between 1 and 100)
      • Set loc[1] = (Center of (Playable map area))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RanInt Less than or equal to 20
        • Then - Actions
          • Unit - Create 10 Bandit for Player 1 (Red) at loc[1] facing Default building facing degrees
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • RanInt Less than or equal to 40
            • Then - Actions
              • Unit - Create 10 Orc for Player 1 (Red) at loc[1] facing Default building facing degrees
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • RanInt Less than or equal to 60
                • Then - Actions
                  • Unit - Create 10 Ogre for Player 1 (Red) at loc[1] facing Default building facing degrees
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • RanInt Less than or equal to 80
                    • Then - Actions
                      • Unit - Create 10 Troll for Player 1 (Red) at loc[1] facing Default building facing degrees
                    • Else - Actions
                      • Unit - Create 10 Creep for Player 1 (Red) at loc[1] facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_loc[1])
Well, here is the map, so you can see for yourself (speed up a bit, of course... a wave will spawn every 10sec).
Don't forget to turn off "Use Fixed Random Seed".
 

Attachments

  • Random Siege.w3x
    20 KB · Views: 55
Level 4
Joined
Jan 29, 2007
Messages
98
Something like this perhaps?


  • Random Attacks
    • Events
      • Time - Every 240.00 seconds of game time
    • Conditions
    • Actions
      • Set RanInt = (Random integer number between 1 and 100)
      • Set loc[1] = (Center of (Playable map area))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RanInt Less than or equal to 20
        • Then - Actions
          • Unit - Create 10 Bandit for Player 1 (Red) at loc[1] facing Default building facing degrees
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • RanInt Less than or equal to 40
            • Then - Actions
              • Unit - Create 10 Orc for Player 1 (Red) at loc[1] facing Default building facing degrees
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • RanInt Less than or equal to 60
                • Then - Actions
                  • Unit - Create 10 Ogre for Player 1 (Red) at loc[1] facing Default building facing degrees
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • RanInt Less than or equal to 80
                    • Then - Actions
                      • Unit - Create 10 Troll for Player 1 (Red) at loc[1] facing Default building facing degrees
                    • Else - Actions
                      • Unit - Create 10 Creep for Player 1 (Red) at loc[1] facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_loc[1])
Well, here is the map, so you can see for yourself (speed up a bit, of course... a wave will spawn every 10sec).
Don't forget to turn off "Use Fixed Random Seed".

But, that wouldn't work, as if "RanInt" is less 20 then, wouldn't all of the "If"s trigger then, since all of them will trigger if "RanInt" is less than or equal to something which all are higher than 20...

I'd believe you'd need two conditions on all of the "If"s except the first one...
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
But, that wouldn't work, as if "RanInt" is less 20 then, wouldn't all of the "If"s trigger then, since all of them will trigger if "RanInt" is less than or equal to something which all are higher than 20...

I'd believe you'd need two conditions on all of the "If"s except the first one...
Play the map... it works

If RanInt is 45 (for example), it isn't 20 or lower, so it will go to the "else"-part, it isn't 40 or lower either, so it will go to the "else"-part again and then it will trigger the "then"-part of the 3th if/then/else.
 
Status
Not open for further replies.
Top