Random sound

undeadorcjerk

The Ulitimate TheHelper.net Lurker
Reaction score
223
i need to know how to play a random sound when someone types in -random sound. plz help(thank you).
 

Luth

Lex Luthor!
Reaction score
41
A = RandomInt(1,3)
if(A==1) play this sound
if(A==2) play that sound
if(A==3) play other sound
 

undeadorcjerk

The Ulitimate TheHelper.net Lurker
Reaction score
223
thanks guy.
 

DrunkenFool

Member
Reaction score
3
If you know how to use "array variables" its all very easy.
Set a bunch of sounds you like to a variable and make a trigger saying when a player types the message play <variable>
 

undeadorcjerk

The Ulitimate TheHelper.net Lurker
Reaction score
223
how do you do that?
 

DrunkenFool

Member
Reaction score
3
When in the trigger editor press Ctr-b to get into the variable editor.
And creat a variable for sound and click the array box and set the number of arrays to how many sounds you want.
Then in one of your mpas old triggers that uses the event "Map initialization" or "time elapst = 0 - 1 or so" And go:
Set variable <Name of variable> 1 to <sound>
Set variable <Name of variable> 2 to <sound>
Set variable <Name of variable> 3 to <sound>
Set variable <Name of variable> 4 to <sound>
Etc
 

undeadorcjerk

The Ulitimate TheHelper.net Lurker
Reaction score
223
i did that, but when i typed -random sound in the game, nothing happened. heres what i did

variable name=randomsound
variable type= soundarray(2)
intial value= no sound <-- thats where i think i did wrong.

set randomsound1 to sound1
set randomsound2 to sound2

a=when player1 types -random sound
e=play randomsound(random integer number between 1 and 2)
 

undeadorcjerk

The Ulitimate TheHelper.net Lurker
Reaction score
223
uh.. how?
 

Chocobo

White-Flower
Reaction score
409
--> FORUM RULES <=== IF YOU HAVE NOT READ THESE THEN DO NOT POST

http://www.thehelper.net/forums/showthread.php?t=8229

Some basic forum guidelines:

The following are meant as guidelines, meaning they are not enforced in any way, but your experiences in this forum may be considerably improved if you take heed of them.

1. Give as much information as you can. For example, if you are having problems with a trigger, write the trigger code in your post (right click on the name of your trigger and select "Copy as text", and then paste it into your post, and surround it with code /code tags.
2. Tell us what steps you have taken to try and solve the problem that you are having. This will allow us to more quickly try and work out a solution for you.
 

undeadorcjerk

The Ulitimate TheHelper.net Lurker
Reaction score
223
whats a code tag. i get the rest
 

undeadorcjerk

The Ulitimate TheHelper.net Lurker
Reaction score
223
trigger 1
Code:
Events
    Map initialization
Actions
    Set randomsound[1] = AbominationPissed1 <gen>
    Set randomsound[2] = IllidanPissed7 <gen>

trigger 2
Code:
Events
    Player - Player 1 (Red) types a chat message containing -random sound as An exact match
Actions
    Sound - Play randomsound[(Random integer number between 1 and 2)]
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top