• 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.

Help The Noob (me) With Triggers !!1

Status
Not open for further replies.
Level 1
Joined
Jul 16, 2004
Messages
2
well what i try to do is a simple trigger that works like this: when any of the players say "hi" it will play sound [insert sound here].
now i know how to work with the sound meneger... my problem is doing the trigger itself, i mean when at the event part in the option of "player types text" there are 50 options like sub-string and contrtive (something like that)...
i need someone to guide me.
thanks alot for your help :)
(sorry if my english is bad)
 
Level 13
Joined
May 5, 2004
Messages
1,330
You wanna have it that if any player tipes "hi" it plays that sound? This trigger here works for every player.


Events
Player - Player 1 (Red) types a chat message containing hi as An exact match
Player - Player 2 (Blue) types a chat message containing hi as An exact match
Player - Player 3 (Teal) types a chat message containing hi as An exact match
Player - Player 4 (Purple) types a chat message containing hi as An exact match
Player - Player 5 (Yellow) types a chat message containing hi as An exact match
Player - Player 6 (Orange) types a chat message containing hi as An exact match
Player - Player 7 (Green) types a chat message containing hi as An exact match
Player - Player 8 (Pink) types a chat message containing hi as An exact match
Player - Player 9 (Gray) types a chat message containing hi as An exact match
Player - Player 10 (Light Blue) types a chat message containing hi as An exact match
Player - Player 11 (Dark Green) types a chat message containing hi as An exact match
Player - Player 12 (Brown) types a chat message containing hi as An exact match
Conditions
Actions
Sound - Play [Your Sound]


Edit: Damn, again to slow :cry:
 
Level 1
Joined
Jul 16, 2004
Messages
2
thx alot guys... and how do i make it play a random sound from a set of audios i made.... and how do i make a set of audios ?
 
Level 13
Joined
May 5, 2004
Messages
1,330
Hm, I would do it this way:

Create a integer variable (here I named it SoundChooser)

for example I have three sounds
Sound#1
Sound#2
Sound#3

then create this trigger

Actions
Set SoundChooser = (Random integer number between 1 and 10)

perhaps here you need to add a small wait action

If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
SoundChooser Equal to 1
Then - Actions
Sound - Play Sound#1
Else - Actions
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    If - Conditions
    SoundChooser Equal to 2
    Then - Actions
    Sound - Play Sound#2
    Else - Actions
    [list:62b5670084]If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    If - Conditions
    SoundChooser Equal to 3
    Then - Actions
    Sound - Play Sound#3
    Else - Actions
    [list:62b5670084]...and so on
[/list:u:62b5670084][/list:u:62b5670084]


BTW if anyone knows a better method plz respond
 
Level 8
Joined
Apr 3, 2004
Messages
507
I do, in fact, know a slightly better method. The only problem with what you've got there is all those nested if's.

So, the easy way to get around that is this.

Make a sound array variable. Like, "soundArHi[]"

In your Map Init trigger, set each index of this variable to one of your set of sounds.

Set soundArHi[1] = Pants
Set soundArHi[2] = Sqwuak
Set soundArHi[3] = Flaming wagon
etc.

In your trigger that fires with the "hi" message, or whatever, instead of doing nested If's, do

Play Sound - soundArHi[random integer between 1 and 3]

This means there's no If's and only one primary action, instead of an action for each possibility.
 
Level 8
Joined
Apr 3, 2004
Messages
507
Actually, it's one variable array, which is defined one time, at the beginning of the map, when you define each the possible random sounds. There's not even a variable needing to be set inside the trigger that plays the sound.

Arranging actions so that as few run as possible is one of the key parts of cutting down processor intensity and reducing map lag.
 
Level 6
Joined
Mar 25, 2004
Messages
235
No, you need one variable for every type of random-chooser. You can't use a sound variable to a random unit-type, you have to create many different ones, that can make the other way more handy, because that'a only one integer variable. You're also more free with an IF/then/else chooser, like:

Set Random = Random Integer Value between 1 and 3.

If Random Equal to 1 then do Unit - Create 1 footman at random point in playable map area.

If Random Equal to 2 then do Unit - Create 2 zergling at centre of Region 001.

If Random Equal to 3 then do Unit - Create Random integer number between 2 and 3 footman at Position of Random unit in playable Map area offset by 200 facing Random integer value between 240 and 260 degrees.

Now, this would require a variable for every bolded value, and it would also need an Integer Random chooser for the array anyway...
 
Status
Not open for further replies.
Top