• 🏆 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!

[Solved] Trigger problem

Status
Not open for further replies.
Level 4
Joined
May 1, 2013
Messages
68
I wanna make a trigger, where a random sound is played when you enter a region and it should also display the text of the sound that is being played like this:

Events

A unit enters REGION NAME

Conditions

Actions

Play sound SOUND 1 or SOUND 2 or SOUND 3
Game - Display to (All Players) SOUND 1 TEXT or SOUND 2 TEXT or SOUND 3 TEXT

If this isn't understandable, just ask me :)
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
To randomly select one out of 3 sounds:

  • Actions
    • Set RandInt = (Random integer number between 1 and 3)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • RandInt Equal to 1
      • Then - Actions
        • Sound - Play MySound1
        • Game - Display to (All players) the text: MyText1
      • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • RandInt Equal to 2
          • Then - Actions
            • Sound - Play MySound2
            • Game - Display to (All players) the text: MyText2
          • Else - Actions
            • Sound - Play MySound3
            • Game - Display to (All players) the text: MyText3
 
Level 4
Joined
May 1, 2013
Messages
68
  • Untitled Trigger 001
    • Events
      • Unit - A unit enters Region 000 <gen>
    • Conditions
    • Actions
      • Sound - Play FootmanYes1 <gen>
      • Game - Display to (All players) the text: Aye, milord!
Well you need to listen to the sound and write the words manually...

U may need to read the description again.

To randomly select one out of 3 sounds:

  • Actions
    • Set RandInt = (Random integer number between 1 and 3)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • RandInt Equal to 1
      • Then - Actions
        • Sound - Play MySound1
        • Game - Display to (All players) the text: MyText1
      • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • RandInt Equal to 2
          • Then - Actions
            • Sound - Play MySound2
            • Game - Display to (All players) the text: MyText2
          • Else - Actions
            • Sound - Play MySound3
            • Game - Display to (All players) the text: MyText3

Thanks this is just what i asked for, but how did you do this (the part after the equal sign)

  • Set RandInt = (Random integer number between 1 and 3)
Edit: Never mind. Found out myself :)
 
Last edited:
Level 20
Joined
Jul 14, 2011
Messages
3,213
Create a Sound Array (Sound[1...2...3...])
Create a String Array (String[1...2...3...])

Sound[1] = Hello
String[1] = Hello

A unit enters Region
Set IntegerVariable = Random Integer Between 1 and 3
Play Sound[IntegerVariable]
Display String[IntegerVariable]

I did something like this in my Gsuh Will map with dialogs. I Even had a bunch of random text/sounds just for social interactions without ingame or quest effects, and even affected by the gametime (Day/Night)

If all your Regions uses the same sounds/Strings you can use the same trigger for all of them. If you want different pack of strings/Sounds on each region you can either use an specific amount of array slots (0-9 for Region 1, 10-19 for region 2, etc.) or a Hashtable using the region ID.
 
Status
Not open for further replies.
Top