So how would I do this if I ONLY want to play sounds to the client and not touch the spawn/death functions? Like, reduced so pseudo-code:Code: (Example Pseudo-code) [Select]onPlayerSpawn { if client.inMinigame { client.playSound(Datablock) };};onPlayerDeath { if client.inMinigame { client.playRandomSound(Datablock2, Datablock3, Datablock4) };};onPlayerKill { if client(killer).inMinigame { client(killer).playRandomSound(Datablock5, Datablock6, Datablock7) };};
onPlayerSpawn { if client.inMinigame { client.playSound(Datablock) };};onPlayerDeath { if client.inMinigame { client.playRandomSound(Datablock2, Datablock3, Datablock4) };};onPlayerKill { if client(killer).inMinigame { client(killer).playRandomSound(Datablock5, Datablock6, Datablock7) };};
function GameConnection::createPlayer(%client, %spawnPoint){ [...] %p = new Projectile () { dataBlock = spawnProjectile; initialVelocity = "0 0 0"; initialPosition = %player.getHackPosition(); sourceObject = %player; sourceSlot = 0; client = %client; }; [...]}
Added in that the player death sound should not play. But I already mentioned before that the default player spawning sound should not play.
//Death Soundsdatablock AudioProfile(RanDeathSFX1){ fileName = "./randeath1.wav"; description = AudioDefault3d; preload = false;};//All others are inherited from above to save on datablocks - not enough people do this!datablock AudioProfile(RanDeathSFX2 : RanDeathSFX1){ fileName = "./randeath2.wav";};datablock AudioProfile(RanDeathSFX3 : RanDeathSFX1){ fileName = "./randeath3.wav";};datablock AudioProfile(RanDeathSFX4 : RanDeathSFX1){ fileName = "./randeath4.wav";};package RanDeathSFX{ //Get a random sound when the player dies function gameConnection::onDeath(%this) { serverplay3d("randeathsfx" @ getRandom(1,4) , %this.player.getHackPosition() SPC "0 0 1 0"); return parent::onDeath(%this); } //Play the death SFX's function player::playDeathCry(%this) { //do nothing }};activatepackage(RanDeathSFX);
if I ONLY want to play sounds to the client
do you mean with the defaults, or removing the defaultsplaying with the defaults should be easyplaying without the defaults would require removing the defaults somehowyou might be able to overwrite the default sounds, similar to how you can do that with textures