ID:273940
 
It's always the simple ones that are seem so easy but can get me stumped every now and then. This is one of those.

Okay so I want the Sound variable held in the gun to be transfered to the user so that it can be sent to the user whenever they shoot. My shooting code, equiping code and object code all work so it's just a matter of formatting this properly. Also the file works, I've tested it. I just need the file to be played when shooting. Thank you.

obj/Guns/Shotguns
Twelve_Gauge
Sound = 'Shotgun.wav'


obj/Guns
verb
Equip()
set src in usr
usr.Shoot_Sound = src.Sound


mob
proc/shoot(vector/shot)
src << sound(Shoot_Sound)


This was my attempt which doesn't work but it provides you a framework I guess.
obj/Guns/Shotguns
Twelve_Gauge
Sound = sound('Shotgun.wav')

obj/Guns
verb
Equip()
set src in usr
usr.gun=src

mob
proc/shoot(vector/shot)
src << src.gun.Sound


Upon noticing that that didn't work either, I checked my preferences and realized that, lo and behold, I had sound off. I went back and checked yours and it worked fine with my sound turned on. Make sure you don't have it disabled.
In response to Robertbanks2
Thanks for the reply but what I had doesn't work. I found an error in my code for equipping which contributed to the issue but as I discovered with your help, this is the correct format required:

obj/Guns/Shotguns
Twelve_Gauge
Sound = sound('Shotgun.wav')

verb
Equip()
set src in usr
usr.Shoot_Sound = src.Sound

mob
proc/shoot(vector/shot)
src << Shoot_Sound