16
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
function GameConnection::spawnPlayer(%Client)
{
echo("SpawnHit");
parent::spawnPlayer(%Client);
%basePlayerSpeed = %client.player.getDatablock().maxForwardSpeed;
%randNum = getRandom(0,1);
echo(%randNum);
echo("SpawnParentPassed");
if(%randNum == 1){
echo("if hit");
changeSpeed(%client, 30);
messageAll('BoostSoundEmitter','\c1%1 recieved boost', %client.name);
ServerPlay2D(boostSound);
}
}
It will go through, hitting the echos properly. But sometimes, for some reason, it only does half the commands. For example, my echos tell me that the if was hit, and I get the chat message, but then I get no speed boost or sound. Then on another occasion my echos report that the if statement wasn't hit, but the sound plays anyway. Sometimes none of the if commands happen upon hit, sometimes all. I'll just clarify some things I've tried:function GameConnection::OnDeath(%this, %killerPlayer, %killer, %damageType, %damageLoc)
{
ServerPlay3D(killSound, %killerPlayer.getPosition());
Parent::OnDeath(%this, %killerPlayer, %killer, %damageType, %damageLoc);
}
I have tried every imaginable combination of using %this, %killerplayer, and %killer to try and play a sound at the killer when a player dies. But it either throws errors or plays it at the victim instead. I gave this problem to some of my more experienced friends and we tried all sorts of combinations and it still didn't work.datablock AudioDescription(AudioDefault3dLonger : AudioDefault3d)
{
maxDistance = 190;
referenceDistance = 120;
};
datablock AudioDescription(AudioDefaultLooping3dLonger : AudioDefaultLooping3d)
{
maxDistance = 190;
referenceDistance = 120;
};
datablock AudioProfile(inhaleSound)
{
filename = "./inhale.wav";
description = AudioDefault3D;
preload = true;
};
datablock AudioProfile(combBendFireSound)
{
filename = "./fire.wav";
description = AudioDefaultLooping3dLonger;
preload = true;
};
datablock AudioProfile(combBendExplosionSound)
{
filename = "./explosion.wav";
description = AudioDefault3dLonger;
preload = true;
};
As you can see, I've made new AudioDescription datablocks based off of existing ones in order to increase sound length. In the explosion's case, it works. However, for the looping projectile sound, it sounds very loud at first, then after a while at a certain distance, it goes almost silent. The projectile/fire combination sound doesn't neccesarily have to loop, but I made it a loop in order for it to stop playing the sound early when it explodes.