Hi!
The problem is that after I do something like slash=rand()*3; the if() won't register it afterwords!!! Why is that?
Here are a few examples:
And also, the printint says 0!
HELP!
/Edward
[This message has been edited by Edward (edited July 19, 2003).]
The problem is that after I do something like slash=rand()*3; the if() won't register it afterwords!!! Why is that?
Here are a few examples:
Code:
slash=rand()*3;
// QUICK slash.
printint(slash);
if (slash == 0)
{
// If after a second, we haven't attacked again, reset slash to 0.
jkEnableSaber( player, 40, 0.15, 0.25 );
povSlashAnimID = jkPlayPOVKey( player, povSnapAnim1, 2, 0x38);
slashAnimID = PlayKey(player, snapAnim1, 1, 0x38);
PlaySoundThing(swingSound01[rand()*7], player, 1.0, -1, -1, 0x80);
shakePos = VectorScale(RandVec(),.001);
shakeAngle = VectorScale(RandVec(),.5);
SetPOVShake(shakePos, shakeAngle, .05, 80.0);
SetFireWait(player, 0.25);
}
else if (slash == 1)
{
// Allow another second for the 3rd attack.
jkEnableSaber( player, 40, 0.15, 0.25 );
povSlashAnimID = jkPlayPOVKey( player, povSnapAnim2, 2, 0x38 );
slashAnimID = PlayKey(player, snapAnim2, 1, 0x38);
PlaySoundThing(swingSound01[rand()*7], player, 1.0, -1, -1, 0x80);
shakePos = VectorScale(RandVec(),.001);
shakeAngle = VectorScale(RandVec(),.5);
SetPOVShake(shakePos, shakeAngle, .05, 80.0);
SetFireWait(player, 0.25);
}
else if ((slash == 2) || (slash==3))
{
jkEnableSaber( player, 60, 0.2, 0.25 );
povSlashAnimID = jkPlayPOVKey( player, povSnapAnim3, 2, 0x38 );
slashAnimID = PlayKey(player, snapAnim3, 1, 0x38);
PlaySoundThing(swingSound01[rand()*7], player, 1.0, -1, -1, 0x80);
shakePos = VectorScale(RandVec(),.001);
shakeAngle = VectorScale(RandVec(),.5);
SetPOVShake(shakePos, shakeAngle, .05, 80.0);
SetFireWait(player, 0.25);
}Code:
i=(rand()*5);
printint(i);
if(i < 4)
{
PlaySoundLocal(hubba0,1,0,0xC0);
sleep(GetSoundLen(hubba0));
}
else if(i == 4)
{
PlaySoundLocal(hubba1, 1, 0, 0xC0);
PlaySoundLocal(hubba4, 1, 0, 0xC0);
if(GetSoundLen(hubba1) > GetSoundLen(hubba4)) sleep(GetSoundLen(hubba1));
else sleep(GetSoundLen(hubba2));
}
else if(i == 5)
{
PlaySoundLocal(hubba2, 1, 0, 0xC0);
PlaySoundLocal(hubba3, 1, 0, 0xC0);
if(GetSoundLen(hubba3) > GetSoundLen(hubba2)) sleep(GetSoundLen(hubba3));
else sleep(GetSoundLen(hubba4));
}
Return;
And also, the printint says 0!
HELP!
/Edward
[This message has been edited by Edward (edited July 19, 2003).]