ID:168148
 
hi i want a sound in my game, i mean when someone picks up gold i want itto play...not loop or anything just play sound everytime someone picks up gold
Nathan2022001 wrote:
hi i want a sound in my game, i mean when someone picks up gold i want itto play...not loop or anything just play sound everytime someone picks up gold


this is my sound

obj
gold
icon = 'gold coins.dmi'

var
amount //define the amount var.
sound


verb
Get()
set src in oview(0) //set this verb so you only have it if you are one space away
usr.Gold += amount // add the amount of gold to the users gold
del(src) //delete the pile of gold
In response to Nathan2022001
just use
usr<< sound.midi
or whatever
In response to Mysame
That's wrong.
sound('Pickup_Gold.wav')

will play the Pickup_Gold.wav when the user picks it up.
In response to Nathan2022001
Please don't give bad advice. And please, please use <dm></dm> tags next time.

SomethingToFunnelSoundTo<<sound("filename",repeat=0)
In response to Artemio
Actually, he wasn't giving advice. He was bumping.
In response to Ter13
Woops! Didn't realise that the second post was the same one who started the thread.
In response to Artemio
yes follow artemio's advice plz put dm tags around code. here is what it should look like

 usr or src << sound('(name here).wav or .mid')


that will play the sound without a loop.

with a loop add a ,1 after '(name here).wav or .mid'
 usr or src << sound('(name here).wav or .mid',1)//the ,1 makes it loop
In response to Flame Sage
Flame Sage wrote:
That's wrong.
sound('Pickup_Gold.wav')

will play the Pickup_Gold.wav when the user picks it up.

No, it won't. sound() only creates a /sound datum; it does not send it to anybody. For a player to hear a sound you have to send it to them.

Lummox JR
In response to Lummox JR
Ah, I forgot my MOB<<
Well.. he has enough common sense to do that, I hope.