Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → My lightsaber doesn't block lasers so well...
My lightsaber doesn't block lasers so well...
2001-09-29, 1:31 PM #1
I need help making my lightsaber block lasers better. I am stumped on this... here is the script:

#-------------------------------------------------------------
# N E W C O R P O R A T E S E C T O R A U T H O R I T Y
#-------------------------------------------------------------
#
# JK / MotS COG Script
#
# By CEO - ExO Silver Fox
#
# weap_saber.cog
#
# Weapon 10 - Lightsaber / Lightstaff
# The weapon of the Jedi, more elegant than a clumsy blaster. [http://forums.massassi.net/html/smile.gif]
#
#-------------------------------------------------------------

symbols

cog kyleCog local

thing player local

model povModel=sabv2.3do local
model saberMesh=sabg.3do local
model saberMesh2=sabg2.3do local
model dbsaberMesh=dbsabg.3do local
model dbsaberMesh2=dbsabg2.3do local

template tpl_wall=+ssparks_wall local
template tpl_blood=+ssparks_blood local
template tpl_saber=+ssparks_saber local

material redg_tip=glowred0.mat local
material redg_side=glowred1.mat local
material dredg_tip=glowdred0.mat local
material dredg_side=glowdred1.mat local
material orangeg_tip=gloworange0.mat local
material orangeg_side=gloworange1.mat local
material blueg_tip=glowblue0.mat local
material blueg_side=glowblue1.mat local
material greeng_tip=glowgreen0.mat local
material greeng_side=glowgreen1.mat local
material purpleg_tip=glowpurple0.mat local
material purpleg_side=glowpurple1.mat local
material yellowg_tip=glowyellow0.mat local
material yellowg_side=glowyellow1.mat local

sound sabcolorSound=lvrclik1.wav local
sound dismountSound=LtSaberOff01.WAV local
sound mountSound=LtSaberOn01.WAV local
sound humSound01=LtSaberLp01.WAV local
sound hitSound01=LtSaberHit01.WAV local
sound hitSound02=LtSaberHit02.WAV local
sound hitSound03=LtSaberHit03.WAV local
sound hitSound12=LtSaberHit12.WAV local
sound hitSound14=LtSaberHit14.WAV local
sound swingSound01=LtSaberSwing01.WAV local
sound swingSound02=LtSaberSwing02.WAV local
sound swingSound03=LtSaberSwing03.WAV local
sound swingSound04=LtSaberSwing04.WAV local
sound swingSound05=LtSaberSwing05.WAV local
sound swingSound06=LtSaberSwing06.WAV local
sound swingSound07=LtSaberSwing07.WAV local
sound swingSound08=LtSaberSwing08.WAV local
sound swingSoundDbl01=LtSaberSwingDbl01.WAV local
sound swingSoundDbl02=LtSaberSwingDbl02.WAV local

vector thrust local
vector shakePos local
vector shakeAngle local

int mountAnimID local
int preAnimID local
int povPreAnimID local
int slashAnimID local
int povSlashAnimID local
int mode local
int slash local
int nextAttack local # 0=right 1=left
int humChannel local
int holsterTrack local
int slashSound local
int assign local
int nosaber local
int lightstaff=0 local
int staff=0 local
int color=-1 local
int active=0 local

flex holsterWait local
flex damage local

#-------------------------------------------------------------

# POV animations - Lightsaber/lightstaff

keyframe mountAnim=SabVmnt.key local
keyframe dismountAnim=SabVdis.key local
keyframe holdAnim=SabVhold.key local
keyframe povSnapAnim1=SabVf1.key local
keyframe povSnapAnim2=SabVf2.key local
keyframe povSnapAnim3=SabVf1.key local
keyframe povPreFireAnim=SabVrdy.key local
keyframe povFireAnimF1=SabVsnp1.key local
keyframe povFireAnimF2=SabVsnp2.key local
keyframe povFireAnimB1=SabVb1.key local
keyframe povFireAnimB2=SabVb2.key local
keyframe povFireAnimL1=SabVl1.key local
keyframe povFireAnimR1=SabVr1.key local
keyframe povChargeAnim=SabVch.key local
keyframe povPreBlockAnim=SabVblk.key local

#-------------------------------------------------------------

# External animations - Lightsaber

keyframe fireAnimS1=KYsnap1.key local
keyframe fireAnimS2=KYsnap2.key local
keyframe fireAnimF1=KYsabrf1.key local
keyframe fireAnimF2=KYsabrf2.key local
keyframe fireAnimF3=KYsabrf3.key local
keyframe fireAnimB1=KYsabrb1.key local
keyframe fireAnimB2=KYsabrb2.key local
keyframe fireAnimL1=KYsabrl1.key local
keyframe fireAnimR1=KYsabrr1.key local
keyframe fireAnimC1=crchfatt.key local
keyframe fireAnimJ1=jumpfatt.key local
keyframe chargeAnim=KYcharge.key local
keyframe chargeAnim2=KYcharge2.key local
keyframe drawsbAnim=KYdrawsb.key local
keyframe holsterAnim=kyhlstr.key local

#-------------------------------------------------------------

# External animations - Lightstaff

keyframe dbfireAnimS1=KYdbsabrs1.key local
keyframe dbfireAnimS2=KYdbsabrs2.key local
keyframe dbfireAnimF1=KYdbsabrf1.key local
keyframe dbfireAnimF2=KYdbsabrf2.key local
keyframe dbfireAnimB1=KYdbsabrb1.key local
keyframe dbfireAnimB2=KYdbsabrb2.key local
keyframe dbfireAnimL1=KYdbsabrl1.key local
keyframe dbfireAnimR1=KYdbsabrr1.key local
keyframe dbchargeAnim1=KYdbcharge1.key local
keyframe dbchargeAnim2=KYdbcharge2.key local
keyframe dbdrawsbAnim=KYdbdrawsb.key local
keyframe dbholsterAnim=KYhlstr.key local

#-------------------------------------------------------------
#
# C R O U C H S T U F F

vector player_vector local
int t_vec_x local
int t_vec_y local
int p_vec_x local
int p_vec_y local

#-------------------------------------------------------------

message startup
message activated
message deactivated
message selected
message deselected
message newplayer
message autoselect
message timer
message fire
message killed
message user0
message user1

end

#-------------------------------------------------------------

code

startup:

// Set up player with saber.
player = GetLocalPlayerThing();
kyleCog = GetThingClassCog(player);
povSlashAnimID = -1;
slashAnimID = -1;
nextAttack = 0;
slash = 0;
staff = 0;
color = 1;

SendTrigger(-1, 100, player, 0, 0, 0);
ClearActorFlags(player, 0x2000);
jkDisableSaber(player);

Return;

#-------------------------------------------------------------

timer:

id = GetSenderId();

if (id == 0)
{
// Play mounting sound.
PlaySoundThing(mountSound, player, 1.0, -1, -1, 0x80);
humChannel = PlaySoundThing(humSound01, player, 1.0, -1, -1, 0x81);
jkSetFlags(player, 0x5);
Sleep(0.27);
jkSetWeaponMesh(player, saberMesh2);
}
else
if (id == 1)
{
// Make sure a loose timer doesn't come in and reset the block after we deselect the saber.
if (nosaber == 0)
SetActorFlags(player, 0x2000);
}
else
if (id == 2)
{
StopKey(player, holsterTrack, 0.0);
}
else
if (id == 3)
{
SetTimerEx(GetKeyLen(dbdrawsbAnim), 4, 0, 0);
PlayKey(player, dbdrawsbAnim, 1, 0x38);
jkEnableSaber(player, 50, 0.3, 1.2);
PlayMode(player, 42);
Print("Glow Lightstaff");
}
else
if (id == 4)
{
humChannel = PlaySoundThing(humSound01, player, 1.0, -1, -1, 0x81);
PlaySoundThing(mountSound, player, 1.0, -1, -1, 0x80);
SetTimerEx(0.001, 5, 0, 0);
jkSetFlags(player, 0x5);
Sleep(0.27);
jkSetWeaponMesh(player, dbsaberMesh2);
}
else
if (id == 5)
{
jkSetFlags(player, 0x10);
}
else
if (id == 6)
{
SetTimerEx(GetKeyLen(drawsbAnim), 7, 0, 0);
PlayKey(player, drawsbAnim, 1, 0x38);
jkEnableSaber(player, 50, 0.3, 1.2);
PlayMode(player, 42);
Print("Glow Lightsaber");
}
else
if (id == 7)
{
humChannel = PlaySoundThing(humSound01, player, 1.0, -1, -1, 0x81);
PlaySoundThing(mountSound, player, 1.0, -1, -1, 0x80);
jkSetFlags(player, 0x5);
Sleep(0.27);
jkSetWeaponMesh(player, saberMesh2);
}
else
if (id == 8)
{
slash = 0;
}
else
if (id == 9)
{
thrust = GetThingThrust(player);
player_vector=VectorScale(GetThingLVec(player), 80.0);
t_vec_x=VectorX(thrust);
t_vec_y=VectorY(thrust);
p_vec_x=VectorX(player_vector)*3;
p_vec_y=VectorY(player_vector)*3;
if(t_vec_x>0) ApplyForce(player,VectorSet(p_vec_y,-p_vec_x,0));
if(t_vec_x<0) ApplyForce(player,VectorSet(-p_vec_y,p_vec_x,0));
if(t_vec_y>0) ApplyForce(player,VectorSet(p_vec_x,p_vec_y,0));
if(t_vec_y<0) ApplyForce(player,VectorSet(p_vec_x,-p_vec_y,0));
}


Return;

#-------------------------------------------------------------

selected:

//SendMessage(GetInvCog(player, 129), user0);
SendTrigger(-1, 100, player, 0, 0, 0);
staff = 0;
lightstaff = 0;
jkClearFlags(player, 0x10);
SetBinWait(player, 116, GetSoundLen(mountSound));
SetBinWait(player, 117, GetSoundLen(mountSound));
SetBinWait(player, 118, GetSoundLen(mountSound));
jkPrintUNIString(player, 10);

assign = GetSenderRef();

// Go to external
if ((jkGetSaberCam() == 1) && (GetCurrentCamera() == 0) && (GetPrimaryFocus(0) == player))
CycleCamera();

// Setup the meshes and models.
jkSetPOVModel(player, povModel);
SetArmedMode(player, 2);
jkSetWeaponMesh(player, saberMesh);

if(color == 1)
{
jkSetSaberInfo(player, redg_side, redg_tip, 0.012, 0.012, 0.115, tpl_wall, tpl_blood, tpl_saber);
}
else
if(color == 2)
{
jkSetSaberInfo(player, dredg_side, dredg_tip, 0.012, 0.012, 0.115, tpl_wall, tpl_blood, tpl_saber);
}
else
if(color == 3)
{
jkSetSaberInfo(player, orangeg_side, orangeg_tip, 0.012, 0.012, 0.115, tpl_wall, tpl_blood, tpl_saber);
}
else
if(color == 4)
{
jkSetSaberInfo(player, blueg_side, blueg_tip, 0.012, 0.012, 0.115, tpl_wall, tpl_blood, tpl_saber);
}
else
if(color == 5)
{
jkSetSaberInfo(player, greeng_side, greeng_tip, 0.012, 0.012, 0.115, tpl_wall, tpl_blood, tpl_saber);
}
else
if(color == 6)
{
jkSetSaberInfo(player, purpleg_side, purpleg_tip, 0.012, 0.012, 0.115, tpl_wall, tpl_blood, tpl_saber);
}
else
if(color == 0)
{
jkSetSaberInfo(player, yellowg_side, yellowg_tip, 0.012, 0.012, 0.115, tpl_wall, tpl_blood, tpl_saber);
}

jkSetWaggle(player, '10.0 7.0 0.0', 350);

if(assign == 0)
{
// Play the animation (NOLOOP + UNIQUE + ENDPAUSE).
// The animation is held at the last frame after it is played.
PlayMode(player, 42);
mountAnimID = jkPlayPOVKey( player, mountAnim, 0, 0x14 );
SetTimerEx(0.7, 0, 0, 0);
}
else
{
mountAnimID = jkPlayPOVKey( player, holdAnim, 0, 0x14 );
humChannel = PlaySoundThing(humSound01, player, 1.0, -1, -1, 0x81);
jkSetFlags(player, 0x80);
}

SetMountWait(player, GetKeyLen(mountAnim));

// Set saber flags, and allow activation of the weapon
SetCurWeapon( player, 10 );

// Set autoblock on.
SetActorFlags(player, 0x500);
jkEnableSaber(player, 50, 0.3, 1.2);
nosaber = 0;

SendMessage(GetThingClassCog(player), user1);

Return;

#-------------------------------------------------------------

deselected:

//SendMessage(GetInvCog(player, 129), user0);
SendTrigger(-1, 100, player, 0, 0, 0);
// Back to POV
if ((jkGetSaberCam() == 1) && (GetCurrentCamera() == 1) && (GetPrimaryFocus(1) == player)) CycleCamera();

if(staff == 0)
{
jkSetWeaponMesh(player, saberMesh);
}
if(staff == 1)
{
jkSetWeaponMesh(player, dbsaberMesh);
}

// Shrink saber.
jkSetFlags(player, 0x8);

// Dismount the Lightsaber.
PlaySoundThing(dismountSound, player, 1.0, -1, -1, 0x80);
jkPlayPOVKey( player, dismountAnim, 0, 18 );

holsterWait = GetKeyLen(holsterAnim);
SetMountWait(player, holsterWait);
holsterTrack = PlayKey(player, holsterAnim, 1, 0x4);
SetTimerEx(holsterWait, 2, 0.0, 0.0);

if (mountAnimID != -1)
{
jkStopPOVKey( player, mountAnimID, 0 );
mountAnimID = -1;
}

jkSetWaggle(player, '0.0 0.0 0.0', 0);

// Clear variables
staff = 0;
slash = 0;
nextAttack = 0;
slashAnimID = -1;
povSlashAnimID = -1;

StopSound(humChannel, 0.5);

// Disable autoblock
KillTimerEx(1);
ClearActorFlags(player, 0x2000);
jkDisableSaber(player);
nosaber = 1;

Return;

#-------------------------------------------------------------

activated:

mode = GetSenderRef();
active = 1;

jkSetWaggle(player, '0.0 0.0 0.0', 0);

if(mode > 1) Return;

povPreAnimID = -1;
preAnimID = -1;

ActivateWeapon(player, 0.5, mode);

Return;

#-------------------------------------------------------------

deactivated:

mode = GetSenderRef();
active = 0;

jkSetWaggle(player, '10.0 7.0 0.0', 350);
DeactivateWeapon(player, mode);

Return;

#-------------------------------------------------------------

fire:


// Underwater saber attacks.
if(GetMajorMode(player) == 5)
{
damage = 100 + (10 * rand());
jkEnableSaber(player, damage, 0.15, 0.25);

if (nextAttack == 0)
{
PlayMode(player, 8);
jkPlayPOVKey( player, povFireAnimF1, 2, 0x38);
nextAttack = 1;
}
else
{
PlayMode(player, 18);
jkPlayPOVKey(player, povFireAnimF2, 2, 0x38);
nextAttack = 0;
}

shakePos = VectorScale(RandVec(),.001);
shakeAngle = VectorScale(RandVec(),.5);
SetPOVShake(shakePos, shakeAngle, .05, 80.0);

SetFireWait(player, 0.90);

slashSound = Rand()*7;
PlaySoundThing(swingSound01[slashSound], player, 1.0, -1, -1, 0x80);
}
else
{
if(lightstaff)
{
mode = GetSenderRef();
if (mode == 0)
{
// If we do another attack, reset the quick slash counter.
thrust = GetThingThrust( player );

// RIGHT Regular Strike
if (VectorX(thrust) > 0)
{
jkEnableSaber( player, 50, 0.15, 0.25 );

jkPlayPOVKey( player, povFireAnimR1, 2, 0x38 );
PlayKey(player, dbfireAnimR1, 1, 0x38);

shakePos = VectorScale(RandVec(),.001);
shakeAngle = VectorScale(RandVec(),.5);
SetPOVShake(shakePos, shakeAngle, .05, 80.0);

slashSound = Rand()*7;
PlaySoundThing(swingSound01[slashSound], player, 1.0, -1, -1, 0x80);
SetFireWait(player, GetKeyLen(dbfireAnimR1));
}
else
// LEFT Regular Strike
if (VectorX(thrust) < 0)
{
jkEnableSaber( player, 50, 0.15, 0.25 );

jkPlayPOVKey( player, povFireAnimL1, 2, 0x38 );
PlayKey(player, dbfireAnimL1, 1, 0x38);

shakePos = VectorScale(RandVec(),.001);
shakeAngle = VectorScale(RandVec(),.5);
SetPOVShake(shakePos, shakeAngle, .05, 80.0);

slashSound = Rand()*7;
PlaySoundThing(swingSound01[slashSound], player, 1.0, -1, -1, 0x80);
SetFireWait(player, GetKeyLen(dbfireAnimL1));
}
else
// BACKWARDS Strike
if (VectorY(thrust) < -0.1)
{
jkEnableSaber( player, 50, 0.15, 0.25 );

if (nextAttack == 0)
{
jkPlayPOVKey( player, povFireAnimB1, 2, 0x38 );
PlayKey(player, dbfireAnimB1, 2, 0x38);
nextAttack = 1;
}
else
{
jkPlayPOVKey( player, povFireAnimB2, 2, 0x38 );
PlayKey(player, dbfireAnimB2, 2, 0x38);
nextAttack = 0;
}
shakePos = VectorScale(RandVec(),.001);
shakeAngle = VectorScale(RandVec(),.5);
SetPOVShake(shakePos, shakeAngle, .05, 80.0);

slashSound = Rand()*7;
PlaySoundThing(swingSound01[slashSound], player, 1.0, -1, -1, 0x80);
SetFireWait(player, GetKeyLen(dbfireAnimB1));
}
else
// STANDING Strike
if (VectorY(thrust) < 0.1)
{
jkEnableSaber( player, 50, 0.25, 0.7 );

if (nextAttack == 0)
{
jkPlayPOVKey( player, povFireAnimF1, 2, 0x38 );
PlayKey(player, dbfireAnimS1, 2, 0x38);
nextAttack = 1;
}
else
{
jkPlayPOVKey( player, povFireAnimF2, 2, 0x38 );
PlayKey(player, dbfireAnimS2, 2, 0x38);
nextAttack = 0;
}

shakePos = VectorScale(RandVec(),.001);
shakeAngle = VectorScale(RandVec(),.5);
SetPOVShake(shakePos, shakeAngle, .05, 80.0);

slashSound = Rand()*7;
PlaySoundThing(swingSound01[slashSound], player, 1.0, -1, -1, 0x80);
SetFireWait(player, GetKeyLen(dbfireAnimS1));
}
else
{
// FORWARD Strike.
if (slash == 0)
{
// If after a second, we haven't attacked again, reset slash to 0.
jkEnableSaber( player, 50, 0.15, 0.25 );

povSlashAnimID = jkPlayPOVKey(player, povSnapAnim1, 2, 0x38);
slashAnimID = PlayKey(player, dbfireAnimF1, 1, 0x38);
PlaySoundThing(swingSound01, player, 1.0, -1, -1, 0x80);

shakePos = VectorScale(RandVec(),.001);
shakeAngle = VectorScale(RandVec(),.5);
SetPOVShake(shakePos, shakeAngle, .05, 80.0);

SetFireWait(player, GetKeyLen(dbfireAnimF1));
slash = 1;
}
else
if (slash == 1)
{
// Allow another second for the 3rd attack.
jkEnableSaber( player, 50, 0.15, 0.25 );

povSlashAnimID = jkPlayPOVKey( player, povSnapAnim2, 2, 0x38 );
slashAnimID = PlayKey(player, dbfireAnimF2, 1, 0x38);
PlaySoundThing(swingSound03, player, 1.0, -1, -1, 0x80);

shakePos = VectorScale(RandVec(),.001);
shakeAngle = VectorScale(RandVec(),.5);
SetPOVShake(shakePos, shakeAngle, .05, 80.0);

SetFireWait(player, GetKeyLen(dbfireAnimF2));
slash = 0;
}
}
}
// mode == 1
else
{
// HEAVY strike.

thrust = GetThingThrust( player );
// RIGHT Regular Strike
if (VectorX(thrust) > 0)
{
jkEnableSaber(player, 160, 0.3, 1.2);
jkPlayPOVKey(player, povChargeAnim, 2, 0x38);
PlayKey(player, dbchargeAnim2, 2, 0x38);

shakePos = VectorScale(RandVec(),.001);
shakeAngle = VectorScale(RandVec(),.5);
SetPOVShake(shakePos, shakeAngle, .05, 80.0);

PlaySoundThing(swingSoundDbl02, player, 1.0, -1, -1, 0x80);
SetFireWait(player, GetKeyLen(dbchargeAnim2));

}
else
// LEFT Regular Strike
if (VectorX(thrust) < 0)
{
jkEnableSaber(player, 160, 0.3, 1.2);
jkPlayPOVKey(player, povChargeAnim, 2, 0x38);
PlayKey(player, dbchargeAnim2, 2, 0x38);

shakePos = VectorScale(RandVec(),.001);
shakeAngle = VectorScale(RandVec(),.5);
SetPOVShake(shakePos, shakeAngle, .05, 80.0);

PlaySoundThing(swingSoundDbl02, player, 1.0, -1, -1, 0x80);
SetFireWait(player, GetKeyLen(dbchargeAnim2));
}
else
// BACKWARDS Strike
if (VectorY(thrust) < -0.1)
{
jkEnableSaber(player, 160, 0.3, 1.2);
jkPlayPOVKey(player, povChargeAnim, 2, 0x38);
PlayKey(player, dbchargeAnim2, 2, 0x38);

shakePos = VectorScale(RandVec(),.001);
shakeAngle = VectorScale(RandVec(),.5);
SetPOVShake(shakePos, shakeAngle, .05, 80.0);

PlaySoundThing(swingSoundDbl02, player, 1.0, -1, -1, 0x80);
SetFireWait(player, GetKeyLen(dbchargeAnim2));
}
else
// STANDING Strike
if (VectorY(thrust) < 0.1)
{
jkEnableSaber(player, 160, 0.3, 1.2);
jkPlayPOVKey(player, povChargeAnim, 2, 0x38);
PlayKey(player, dbchargeAnim1, 2, 0x38);

shakePos = VectorScale(RandVec(),.001);
shakeAngle = VectorScale(RandVec(),.5);
SetPOVShake(shakePos, shakeAngle, .05, 80.0);

PlaySoundThing(swingSoundDbl01, player, 1.0, -1, -1, 0x80);
SetFireWait(player, GetKeyLen(dbchargeAnim1));
}
else
{
jkEnableSaber(player, 160, 0.3, 1.2);
jkPlayPOVKey(player, povChargeAnim, 2, 0x38);
PlayKey(player, dbchargeAnim1, 2, 0x38);

shakePos = VectorScale(RandVec(),.001);
shakeAngle = VectorScale(RandVec(),.5);
SetPOVShake(shakePos, shakeAngle, .05, 80.0);

PlaySoundThing(swingSoundDbl01, player, 1.0, -1, -1, 0x80);
SetFireWait(player, GetKeyLen(dbchargeAnim1));
}
}
}
else
{
mode = GetSenderRef();
if (mode == 0)
{
// If we do another attack, reset the quick slash counter.

thrust = GetThingThrust( player );
//player_vector = GetThingVel( player );
// Forwards rolling attack
//if ((BitTest(GetPhysicsFlags(Player),0x10000)) && (VectorY(thrust) > 0.2 ))
//{
//if (VectorY(thrust) > 0.2 )
//{ // Forwards Rolling Attack
//jkEnableSaber( player, 50, 0.15, 0.25 );

//jkPlayPOVKey( player, povSnapAnim1, 2, 0x38 );
//PlayKey(player, fireAnimC1, 1, 0x38);

//shakePos = VectorScale(RandVec(),.001);
//shakeAngle = VectorScale(RandVec(),.5);
//SetPOVShake(shakePos, shakeAngle, .05, 80.0);

//slashSound = Rand()*7;
//PlaySoundThing(swingSound01[slashSound], player, 1.0, -1, -1, 0x80);

//SetFireWait(player, GetKeyLen(fireAnimC1));
//SetTimerex(0.2,9,0,0);
//slash = 0;
//}
//}
//else
// Jumping Attack
//if(!(GetAttachFlags(player) & 1) && !(GetAttachFlags(player) & 2) && !(GetPhysicsFlags(player) & 0x100000))
//{
// jkEnableSaber( player, 50, 0.15, 0.25 );

// jkPlayPOVKey( player, povSnapAnim1, 2, 0x38 );
// PlayKey(player, fireAnimJ1, 1, 0x38);

// shakePos = VectorScale(RandVec(),.001);
// shakeAngle = VectorScale(RandVec(),.5);
// SetPOVShake(shakePos, shakeAngle, .05, 80.0);

// slashSound = Rand()*7;
// PlaySoundThing(swingSound01[slashSound], player, 1.0, -1, -1, 0x80);
// SetFireWait(player, GetKeyLen(fireAnimJ1));

// slash = 0;
//}
//else
if (VectorX(thrust) > 0)
{ // RIGHT Regular Strike
jkEnableSaber(player, 50, 0.15, 0.25);

jkPlayPOVKey(player, povFireAnimR1, 2, 0x38);
PlayKey(player, fireAnimR1, 1, 0x38);

shakePos = VectorScale(RandVec(),.001);
shakeAngle = VectorScale(RandVec(),.5);
SetPOVShake(shakePos, shakeAngle, .05, 80.0);

slashSound = Rand()*7;
PlaySoundThing(swingSound01[slashSound], player, 1.0, -1, -1, 0x80);
SetFireWait(player, GetKeyLen(fireAnimR1));
//SetFireWait(player, 0.8);
}
else
// LEFT Regular Strike
if (VectorX(thrust) < 0)
{
jkEnableSaber(player, 50, 0.15, 0.25);

jkPlayPOVKey(player, povFireAnimL1, 2, 0x38);
PlayKey(player, fireAnimL1, 1, 0x38);

shakePos = VectorScale(RandVec(),.001);
shakeAngle = VectorScale(RandVec(),.5);
SetPOVShake(shakePos, shakeAngle, .05, 80.0);

slashSound = Rand()*7;
PlaySoundThing(swingSound01[slashSound], player, 1.0, -1, -1, 0x80);
SetFireWait(player, GetKeyLen(fireAnimL1));
//SetFireWait(player, 0.8);
}
else
// BACKWARDS Strike
if (VectorY(thrust) < -0.1)
{
jkEnableSaber(player, 50, 0.15, 0.25);

if (nextAttack == 0)
{
jkPlayPOVKey(player, povFireAnimB1, 2, 0x38);
PlayKey(player, fireAnimB1, 2, 0x38);
nextAttack = 1;
}
else
{
jkPlayPOVKey(player, povFireAnimB2, 2, 0x38);
PlayKey(player, fireAnimB2, 2, 0x38);
nextAttack = 0;
}
shakePos = VectorScale(RandVec(),.001);
shakeAngle = VectorScale(RandVec(),.5);
SetPOVShake(shakePos, shakeAngle, .05, 80.0);

slashSound = Rand()*7;
PlaySoundThing(swingSound01[slashSound], player, 1.0, -1, -1, 0x80);
SetFireWait(player, GetKeyLen(fireAnimB1) - 0.3);
//SetFireWait(player, 0.8);
}
else
// STANDING Strike
if (VectorY(thrust) < 0.1)
{
jkEnableSaber( player, 50, 0.25, 0.7 );

if (nextAttack == 0)
{
jkPlayPOVKey(player, povFireAnimF1, 2, 0x38);
PlayKey(player, fireAnimS1, 2, 0x38);
nextAttack = 1;
}
else
{
jkPlayPOVKey(player, povFireAnimF2, 2, 0x38);
PlayKey(player, fireAnimS2, 2, 0x38);
nextAttack = 0;
}

shakePos = VectorScale(RandVec(),.001);
shakeAngle = VectorScale(RandVec(),.5);
SetPOVShake(shakePos, shakeAngle, .05, 80.0);

slashSound = Rand()*7;
PlaySoundThing(swingSound01[slashSound], player, 1.0, -1, -1, 0x80);
SetFireWait(player, GetKeyLen(fireAnimS1) - 0.3);
//SetFireWait(player, 0.8);
}
else
{
// QUICK slash.
if (slash == 0)
{
// If after half a second, we haven't attacked again, reset slash to 0.
SetTimerEx(0.5, 8, 0, 0);

jkEnableSaber( player, 50, 0.15, 0.25 );

povSlashAnimID = jkPlayPOVKey( player, povSnapAnim1, 2, 0x38);
slashAnimID = PlayKey(player, fireAnimF1, 1, 0x38);
PlaySoundThing(swingSound01, player, 1.0, -1, -1, 0x80);

shakePos = VectorScale(RandVec(),.001);
shakeAngle = VectorScale(RandVec(),.5);
SetPOVShake(shakePos, shakeAngle, .05, 80.0);

SetFireWait(player, GetKeyLen(fireAnimF1));
//SetFireWait(player, 0.25);
slash = 1;
}
else
if (slash == 1)
{
// If after half a second, we haven't attacked again, reset slash to 0, but kill old timer first.
KillTimerEx(8);
SetTimerEx(0.5, 8, 0, 0);
// Allow another second for the 3rd attack.
jkEnableSaber( player, 50, 0.15, 0.25 );

povSlashAnimID = jkPlayPOVKey( player, povSnapAnim2, 2, 0x38 );
slashAnimID = PlayKey(player, fireAnimF2, 1, 0x38);
PlaySoundThing(swingSound03, player, 1.0, -1, -1, 0x80);

shakePos = VectorScale(RandVec(),.001);
shakeAngle = VectorScale(RandVec(),.5);
SetPOVShake(shakePos, shakeAngle, .05, 80.0);

SetFireWait(player, GetKeyLen(fireAnimF2));
//SetFireWait(player, 0.5);
slash = 2;
}
else
if (slash == 2)
{
jkEnableSaber( player, 50, 0.2, 0.25 );

povSlashAnimID = jkPlayPOVKey( player, povSnapAnim3, 2, 0x38 );
slashAnimID = PlayKey(player, fireAnimF3, 1, 0x38);
PlaySoundThing(swingSound02, player, 1.0, -1, -1, 0x80);

shakePos = VectorScale(RandVec(),.001);
shakeAngle = VectorScale(RandVec(),.5);
SetPOVShake(shakePos, shakeAngle, .05, 80.0);

SetFireWait(player, GetKeyLen(fireAnimF3));
//SetFireWait(player, 0.5);
slash = 0;
}
}
}
// mode == 1
else
{
thrust = GetThingThrust( player );
// RIGHT Regular Strike
if (VectorX(thrust) > 0)
{
jkEnableSaber(player, 160, 0.3, 1.2);
jkPlayPOVKey(player, povChargeAnim, 2, 0x38);
PlayKey(player, chargeAnim2, 2, 0x38);

shakePos = VectorScale(RandVec(),.001);
shakeAngle = VectorScale(RandVec(),.5);
SetPOVShake(shakePos, shakeAngle, .05, 80.0);

PlaySoundThing(swingSoundDbl02, player, 1.0, -1, -1, 0x80);
SetFireWait(player, GetKeyLen(chargeAnim2) - 0.3);
//SetFireWait(player, 1.0);

}
else
// LEFT Regular Strike
if (VectorX(thrust) < 0)
{
jkEnableSaber(player, 160, 0.3, 1.2);
jkPlayPOVKey(player, povChargeAnim, 2, 0x38);
PlayKey(player, chargeAnim2, 2, 0x38);

shakePos = VectorScale(RandVec(),.001);
shakeAngle = VectorScale(RandVec(),.5);
SetPOVShake(shakePos, shakeAngle, .05, 80.0);

PlaySoundThing(swingSoundDbl02, player, 1.0, -1, -1, 0x80);
SetFireWait(player, GetKeyLen(chargeAnim2) - 0.3);
//SetFireWait(player, 1.0);
}
else
// BACKWARDS Strike
if (VectorY(thrust) < -0.1)
{
jkEnableSaber(player, 160, 0.3, 1.2);
jkPlayPOVKey(player, povChargeAnim, 2, 0x38);
PlayKey(player, chargeAnim2, 2, 0x38);

shakePos = VectorScale(RandVec(),.001);
shakeAngle = VectorScale(RandVec(),.5);
SetPOVShake(shakePos, shakeAngle, .05, 80.0);

PlaySoundThing(swingSoundDbl02, player, 1.0, -1, -1, 0x80);
SetFireWait(player, GetKeyLen(chargeAnim2) - 0.3);
//SetFireWait(player, 1.0);
}
else
// STANDING Strike
if (VectorY(thrust) < 0.1)
{
jkEnableSaber( player, 160, 0.3, 1.2 );
jkPlayPOVKey( player, povChargeAnim, 2, 0x38 );
PlayKey(player, chargeAnim, 2, 0x38);

shakePos = VectorScale(RandVec(),.001);
shakeAngle = VectorScale(RandVec(),.5);
SetPOVShake(shakePos, shakeAngle, .05, 80.0);

PlaySoundThing(swingSoundDbl01, player, 1.0, -1, -1, 0x80);
SetFireWait(player, GetKeyLen(chargeAnim) - 0.3);
//SetFireWait(player, 1.5);
}
else
{
jkEnableSaber( player, 160, 0.3, 1.2 );
jkPlayPOVKey( player, povChargeAnim, 2, 0x38 );
PlayKey(player, chargeAnim, 2, 0x38);

shakePos = VectorScale(RandVec(),.001);
shakeAngle = VectorScale(RandVec(),.5);
SetPOVShake(shakePos, shakeAngle, .05, 80.0);

PlaySoundThing(swingSoundDbl01, player, 1.0, -1, -1, 0x80);
SetFireWait(player, GetKeyLen(chargeAnim) - 0.3);
//SetFireWait(player, 1.5);
}
}
}
}

Return;

#-------------------------------------------------------------

newplayer:

//SendMessage(GetInvCog(player, 129), user0);
SendTrigger(-1, 100, player, 0, 0, 0);

lightstaff = 0;
staff=0;
slash = 0;
nextAttack = 0;
slashAnimID=-1;
povSlashAnimID=-1;
// Disable autoblock
ClearActorFlags(player, 0x2000);
jkDisableSaber(player);

// Back to POV, since the saber should never get autoselected at start for a multiplayer game.
if ((jkGetSaberCam() == 1) && (GetCurrentCamera() == 1) && (GetPrimaryFocus(1) == player)) CycleCamera();

Return;

#-------------------------------------------------------------

autoselect:

// Return the saber when out of everthing except the fists

// If the player has the weapon
if(GetInv(player, 10) != 0.0)
{
ReturnEx(200.0);
}
else
{
ReturnEx(-1.0);
}

Return;

#-------------------------------------------------------------

killed:

if(player == GetSenderRef())
{
if (GetCurWeapon(player) == 10) PlaySoundThing(dismountSound, player, 1.0, -1, -1, 0x80);
nosaber = 1;
jkClearFlags(player, 0x10);

if(GetCurWeapon(GetLocalPlayerThing()) == 10)
{
if(staff == 0)
{
jkSetWeaponMesh(player, saberMesh);
}
else
if(staff == 1)
{
jkSetWeaponMesh(player, dbsaberMesh);
}

//SendMessage(GetInvCog(player, 129), user0);
SendTrigger(-1, 100, player, 0, 0, 0);
}
}

Return;

#-------------------------------------------------------------

user0:

// Switch Between Lightsaber and Lightstaff
if(active == 0)
{
if(color == 1)
{
jkSetSaberInfo(player, redg_side, redg_tip, 0.012, 0.012, 0.115, tpl_wall, tpl_blood, tpl_saber);
}
else
if(color == 2)
{
jkSetSaberInfo(player, dredg_side, dredg_tip, 0.012, 0.012, 0.115, tpl_wall, tpl_blood, tpl_saber);
}
else
if(color == 3)
{
jkSetSaberInfo(player, orangeg_side, orangeg_tip, 0.012, 0.012, 0.115, tpl_wall, tpl_blood, tpl_saber);
}
else
if(color == 4)
{
jkSetSaberInfo(player, blueg_side, blueg_tip, 0.012, 0.012, 0.115, tpl_wall, tpl_blood, tpl_saber);
}
else
if(color == 5)
{
jkSetSaberInfo(player, greeng_side, greeng_tip, 0.012, 0.012, 0.115, tpl_wall, tpl_blood, tpl_saber);
}
else
if(color == 6)
{
jkSetSaberInfo(player, purpleg_side, purpleg_tip, 0.012, 0.012, 0.115, tpl_wall, tpl_blood, tpl_saber);
}
else
if(color == 0)
{
jkSetSaberInfo(player, yellowg_side, yellowg_tip, 0.012, 0.012, 0.115, tpl_wall, tpl_blood, tpl_saber);
}

if(staff == 0)
{ // Lightstaff
SendMessage(GetThingClassCog(player), user2);
//SendMessage(GetInvCog(player, 129), user1);
SendTrigger(-1, 101, player, 0, 0, 0);
PlaySoundThing(dismountSound, player, 1.0, -1, -1, 0x80);
SetTimerEx(GetKeyLen(holsterAnim), 3, 0, 0);
PlayKey(player, holsterAnim, 1, 0x38);
jkSetWeaponMesh(player, saberMesh);
SetBinWait(player, 116, 3);
SetBinWait(player, 117, 3);
SetBinWait(player, 118, 3);
StopSound(humChannel, 0.5);
jkSetFlags(player, 0x8);
jkDisableSaber(player);
povSlashAnimID=-1;
nextAttack = 0;
slashAnimID=-1;
lightstaff=1;
staff = 1;
slash = 0;
}
else
if(staff == 1)
{ // Normal Saber
SendMessage(GetThingClassCog(player), user1);
//SendMessage(GetInvCog(player, 129), user0);
SendTrigger(-1, 100, player, 0, 0, 0);
PlaySoundThing(dismountSound, player, 1.0, -1, -1, 0x80);
SetTimerEx(GetKeyLen(holsterAnim), 6, 0, 0);
PlayKey(player, dbholsterAnim, 1, 0x38);
jkSetWeaponMesh(player, dbsaberMesh);
SetBinWait(player, 116, 3);
SetBinWait(player, 117, 3);
SetBinWait(player, 118, 3);
StopSound(humChannel, 0.5);
jkClearFlags(player, 0x10);
jkSetFlags(player, 0x8);
jkDisableSaber(player);
povSlashAnimID=-1;
nextAttack = 0;
slashAnimID=-1;
lightstaff=0;
staff = 0;
slash = 0;
}
}

Return;

#-------------------------------------------------------------

user1:

// Switch Between Saber Blade Colors
if(active == 0)
{
if(color == 0)
{
jkSetSaberInfo(player, redg_side, redg_tip, 0.012, 0.012, 0.115, tpl_wall, tpl_blood, tpl_saber);
jkPrintUNIString(player, 423);
color = 1;
}
else
if(color == 1)
{
jkSetSaberInfo(player, dredg_side, dredg_tip, 0.012, 0.012, 0.115, tpl_wall, tpl_blood, tpl_saber);
jkPrintUNIString(player, 424);
color = 2;
}
else
if(color == 2)
{
jkSetSaberInfo(player, orangeg_side, orangeg_tip, 0.012, 0.012, 0.115, tpl_wall, tpl_blood, tpl_saber);
jkPrintUNIString(player, 425);
color = 3;
}
else
if(color == 3)
{
jkSetSaberInfo(player, blueg_side, blueg_tip, 0.012, 0.012, 0.115, tpl_wall, tpl_blood, tpl_saber);
jkPrintUNIString(player, 426);
color = 4;
}
else
if(color == 4)
{
jkSetSaberInfo(player, greeng_side, greeng_tip, 0.012, 0.012, 0.115, tpl_wall, tpl_blood, tpl_saber);
jkPrintUNIString(player, 427);
color = 5;
}
else
if(color == 5)
{
jkSetSaberInfo(player, purpleg_side, purpleg_tip, 0.012, 0.012, 0.115, tpl_wall, tpl_blood, tpl_saber);
jkPrintUNIString(player, 428);
color = 6;
}
else
if(color == 6)
{
jkSetSaberInfo(player, yellowg_side, yellowg_tip, 0.012, 0.012, 0.115, tpl_wall, tpl_blood, tpl_saber);
jkPrintUNIString(player, 429);
color = 0;
}

if(staff == 0)
{
//SendMessage(GetInvCog(player, 129), user0);
}
if(staff == 1)
{
//SendMessage(GetInvCog(player, 129), user1);
}

PlaySoundThing(sabcolorSound, player, 1.0, -1, -1, 0x80);
}

Return;

end

#-------------------------------------------------------------
2001-10-01, 3:03 AM #2
Wow, that sure is loads of code... So it doesn't block lasers? Hmm... k... Does it block lasers at all?

------------------
Guns don't kill people. Kids who play computer games do.
[edit: Visit Cave_Demon's site: http://cave2.2ya.com ! -stat]
[This message has been hacked by StaticX (edited September 11, 2001).]
WHAT?
2001-10-02, 8:18 PM #3
Blocking is in-engine stuff, can't be edited...or can it?

------------------
punctuation 'R' easy

↑ Up to the top!