• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Randomly occuring events

Status
Not open for further replies.
Level 7
Joined
Sep 24, 2008
Messages
281
Hello hiveworkshop community, I was wondering if anyone here knew how to create events which occur a random times throughout a game (but not starting untill, as an example, one minute has passed.) An example would be parasite two, in which meteor showers and space storms (whatever) occur at random points. Thanks:grin:
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
The system used in that map, last time I checked, was unoptional and not very reliable.

The ideal system I would make by having a timer fire every minute. In it, it chooses a random disaster via random number comutation, out of a section of many with a few dummy ones which do nothing. After performing the disaster, it will then have a cool off time whereby another can not occur to stop bad luck resulting in multiple in a row. Finally it resumes back to its 1 minute luck process.
 
Level 7
Joined
Sep 24, 2008
Messages
281
The system used in that map, last time I checked, was unoptional and not very reliable.

The ideal system I would make by having a timer fire every minute. In it, it chooses a random disaster via random number comutation, out of a section of many with a few dummy ones which do nothing. After performing the disaster, it will then have a cool off time whereby another can not occur to stop bad luck resulting in multiple in a row. Finally it resumes back to its 1 minute luck process.
So how would I go about doing that? :confused:
 
Level 30
Joined
Sep 30, 2008
Messages
1,460
I guess you could make a periodic events, which generates a random number every 5-10 minutes of gameplay. For Example:

Event would be a periodic timer every 5-10 mins

Action would be to make an integer variable, then set it to a random number between 1 and however many events there are :)

Then you could simply list a load of IF statements:

e.g.

If random number = 1, then start trigger Event01
If random number = 2, then start trigger Event02

and so on :) you can just repeat that for however many random events youve made.

If you want me to provide an example of the exact triggers, let me know :) Im just too lazy to do it now :p

hope this helps!
 
Level 7
Joined
Sep 24, 2008
Messages
281
Thanks, I'll try it out

Perphaps an example would be helpfull as I really have no idea how to do what you have just suggested.
 
Last edited by a moderator:
Level 10
Joined
Mar 31, 2009
Messages
732
Trigger number one:
  • Events
  • Map Initialization
  • Conditions
  • Actions
  • Timer - Start timer as a one shot timer set to expire in one minute
Trigger number two
  • Events
  • Timer - timer expires
  • Conditions
  • Actions
  • Custom script: do_stuff()
  • Timer - Start timer as a one shot timer set to expire in (Random integer between 1 and 10) minutes
How about that?
 
Level 7
Joined
Sep 24, 2008
Messages
281
Trigger number one:
  • Events
  • Map Initialization
  • Conditions
  • Actions
  • Timer - Start timer as a one shot timer set to expire in one minute
Trigger number two
  • Events
  • Timer - timer expires
  • Conditions
  • Actions
  • Custom script: do_stuff()
  • Timer - Start timer as a one shot timer set to expire in (Random integer between 1 and 10) minutes
How about that?
Number one works, assuming that "timer" is a variable. number two however, I am having trouble with. How can I make it an integer, instead of a number?
 
Level 10
Joined
Mar 31, 2009
Messages
732
Do you mean integer instead of a real?
Conversion - Real to integer

  • Events
    • Time - timer expires
    • Conditions
    • Actions
      • Countdown Timer - Start timer as a One-shot timer that will expire in (Real((Random integer number between 1 and 10))) seconds
 
Level 5
Joined
Feb 21, 2009
Messages
136
  • Rep if I helped you
    • Events
      • Time - Elapsed game time is 60.00 seconds
    • Conditions
    • Actions
      • Wait (Random real number between 100.00 and 500.00) seconds
      • Set IntegerVar = (Random integer number between 1 and 3)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • IntegerVar Equal to 1
        • Then - Actions
        • Do Something
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • IntegerVar Equal to 2
            • Then - Actions
            • Do Something Else
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • IntegerVar Equal to 3
                • Then - Actions
                • Do Something Totally Different
                • Else - Actions
      • Trigger - Run (This trigger) (ignoring conditions)
 
Level 9
Joined
May 30, 2008
Messages
430
  • Rep if I helped you
    • Events
      • Time - Elapsed game time is 60.00 seconds
    • Conditions
    • Actions
      • Wait (Random real number between 100.00 and 500.00) seconds
      • Set IntegerVar = (Random integer number between 1 and 3)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • IntegerVar Equal to 1
        • Then - Actions
        • Do Something
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • IntegerVar Equal to 2
            • Then - Actions
            • Do Something Else
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • IntegerVar Equal to 3
                • Then - Actions
                • Do Something Totally Different
                • Else - Actions
      • Trigger - Run (This trigger) (ignoring conditions)

this mean every 60 seconds of game time it will wait for another 100/500 seconds which mean the trigger will fire every 60 seconds or never at all and ignoring conditions mean that all actions will fire at once. I think u just done nothing at all and asking for rep is forbiden. Stop posting triggers that u never test if they work or not, otherwise u look stupid just like this one:ugly:

  • Events
    • Time - every (Random real number between 60.00 and (the max time u wan't)) seconds
    • Conditions
    • Actions
      • Set IntegerVar = (Random integer number between 1 and 3)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • IntegerVar Equal to 1
        • Then - Actions
        • Do Something
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • IntegerVar Equal to 2
            • Then - Actions
            • Do Something Else
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • IntegerVar Equal to 3
                • Then - Actions
                • Do Something Totally Different
                • Else - Actions
 
Level 7
Joined
Sep 24, 2008
Messages
281
wait i try do this

ok done... 100% random actions

Thank you very much. In the future, I will attempt to use JASS, (assuming that's what you used in order to get that trigger) but for now, I'll just stick to triggers. Again, Thanks:thumbs_up:
 
Level 5
Joined
Feb 21, 2009
Messages
136
this mean every 60 seconds of game time it will wait for another 100/500 seconds which mean the trigger will fire every 60 seconds or never at all and ignoring conditions mean that all actions will fire at once. I think u just done nothing at all and asking for rep is forbiden. Stop posting triggers that u never test if they work or not, otherwise u look stupid just like this one:ugly:

  • Events
    • Time - every (Random real number between 60.00 and (the max time u wan't)) seconds
    • Conditions
    • Actions
      • Set IntegerVar = (Random integer number between 1 and 3)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • IntegerVar Equal to 1
        • Then - Actions
        • Do Something
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • IntegerVar Equal to 2
            • Then - Actions
            • Do Something Else
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • IntegerVar Equal to 3
                • Then - Actions
                • Do Something Totally Different
                • Else - Actions


Read plixplox ''Time - Elapsed game time is 60.00 seconds'', so please read my trigger first b4 commenting. just the ignoring conditions was wrong, and fine. I wont help an other soul if that is what you want. And if I remember correct, putting random numbers in the ''Time - every'' bugs..
 
Status
Not open for further replies.
Top