Author Topic: on explode, server play 2d. Need help  (Read 5482 times)

So i wanna take my explosives and make it so when they explode, it plays a 2D sound that the whole server hears. i have the script that will randomize the explosion sound how i want it
Code: [Select]
serverPlay2D(Explosion @ getRandom(1,10),%obj.getPosition());But i simply dont know where to put it, becuase there is no function for when the explosive, blows up. whats the best thing to do? Make a function?
Code: [Select]
function M67Image::onExplode(%this,%obj,%slot)? Or is there actually a place i can implement this in? Let me know as soon as possible on what you guys think should happen.

i presume this is for randomized bullet impact sounds

function M67Projectile::onExplode(%this,%obj)
{
   %num = getRandom(1, 10);
   serverPlay3D( explosion @ %num @ Sound, %obj.getPosition() );
   parent::onExplode(%this,%obj);
}


10 is an assload of datablocks to waste on sounds though, i recommend using less

i presume this is for randomized bullet impact sounds

function M67Projectile::onExplode(%this,%obj)
{
   %num = getRandom(1, 10);
   serverPlay3D( explosion @ %num @ Sound, %obj.getPosition() );
   parent::onExplode(%this,%obj);
}


10 is an assload of datablocks to waste on sounds though, i recommend using less

Thanks i appreaciate it man. Also yea 10 is pushing the limit, these sounds will play when the explosive goes off, the whole server will hear a "doosh" in the distance. Even though 10 is pushing the limits, it sure as hell sounds lovey in game.

Serverplay2D does not need a position argument, because it technically has no source.

Thanks i appreaciate it man. Also yea 10 is pushing the limit, these sounds will play when the explosive goes off, the whole server will hear a "doosh" in the distance. Even though 10 is pushing the limits, it sure as hell sounds lovey in game.
Oh, I didn't even see you wanted it 2D.
Replace serverPlay3D( explosion @ %num @ Sound, %obj.getPosition() ); with
serverPlay2D( explosion @ %num @ Sound );

lol i did all that after you helped me, thanks though.