• 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.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to vote!

Randomized Trigger

Status
Not open for further replies.
Level 14
Joined
Dec 9, 2006
Messages
1,091
Ok, I am new to World-Editor and im still trying to learn a few things. But, how do a get the trigger to take a random "event" from a group? For example, I use a spell, and I want the trigger to play a random sound from a predetermined group of sounds. This is for a boss fight.

Event-
UnitA begins casting an ability.

Condition-
Ability=Thunderclap

Action-
???


What would I put for action to get it to play that random sound? Thanks for the time of anyone who decides to answer.

~Asomath
"World Editor Trainee"
 
  • Untitled Trigger 001
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Thunder Clap
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 100) Equal to 5
        • Then - Actions
          • Sound - Play XXX
        • Else - Actions
      • -------- You actions are here below if/then/else --------
This gives you 5% chance to play sound XXX
now if you want more than ons sound to be "random" use if/than/else with same condition but with other sound, like this:
  • Untitled Trigger 001
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Thunder Clap
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 100) Equal to 5
        • Then - Actions
          • Sound - Play XXX
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 100) Equal to 5
        • Then - Actions
          • Sound - Play XXX02
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 100) Equal to 5
        • Then - Actions
          • Sound - Play XXX03
        • Else - Actions
      • -------- You actions are here below if/then/else --------
But im not sure that the sound wouldn't trigger at the same time.
And don't forget to destroy thst sound, because if you don;t you have a leak.
HF -BZR-
 
Level 19
Joined
Sep 4, 2007
Messages
2,826
Before you add "Sound - Play Something" try add another trigger above it to stop all current playing music/sounds.
  • Sound - Stop music Immediately
  • If - Conditions
    • (Random integer number between 1 and 100) Equal to 5
    • Then - Actions
      • Sound - Stop music Immediately
      • Sound - Play XXX
    • Else - Actions
If you are not using Music then try this:
  • If - Conditions
    • (Random integer number between 1 and 100) Equal to 5
    • Then - Actions
      • Sound - Stop SoundVar Immediately
      • Set SoundVar = No sound
      • Sound - Play XXX
      • Set SoundVar = (Last played sound)
    • Else - Actions
 
Level 9
Joined
Feb 19, 2006
Messages
115
Each time you say "Random integer number blah blah blah" you're picking a different number, so you have a 5% chance per sound.
Instead, do this...
  • random trigger
  • Events
    • A unit starts the effect of an ability
  • Conditions
    • Ability being cast is equal to Thunder clap
  • Actions
    • Set TempInteger to a random integer number between 1 and (however many sounds you have)
    • if(TempInteger equal to 1) than Sound - Play sound 1 else Do Nothing
    • if(TempInteger equal to 2) than Sound - Play sound 2 else Do Nothing
    • ...
TempInteger is an Integer variable btw
 
Status
Not open for further replies.
Top