Seifer's pov cog crashes JK after you die and try to respawn. (side note: I tried "kill" to kill myself with my fists selected and it crashed JK instantly; I have only a replacement bryar and st.rifle cog and nothing else) Is there any way to fix this? I fixed a couple other bugs in the original code but this one is a biggie and I can't find any way to fix it. Here's my code.
Is it possible JK is crashing from something in the pulse message?
------------------
I am Darth Slaw.
The Dark Lord of the Sith,
And part of the Nightfire mod team
Code:
# Jedi Knight Cog Script # # WEAP_BRYAR.COG # # WEAPON 2 Script - Bryar Pistol # # The trusty weapon of Kyle Katarn. This is actually an older modified rifle # that has been cut down to more of a pistol size. It is very accurate but # somewhat of a low power weapon. This weapon has only one type of fire. # # - Affected by MagSealed sectors/surfaces. # # Custom POV Model Cog created by *_Seifer_* #==============================================================# symbols model povModel=ggunv.3do local model weaponMesh=bryg.3do local keyframe mountAnim=ggunvmnt.key local keyframe dismountAnim=ggunvdis.key local keyframe povfireAnim=ggunvfire.key local #keyframe mountAnim=bryvmnt.key local #keyframe dismountAnim=bryvdis.key local #keyframe povfireAnim=bryvpst1.key local keyframe holsterAnim=kyhlstr.key local sound outSound=pistout1.wav local sound mountSound=df_bry_ready.wav local sound dismountSound=PutWeaponAway01.wav local sound fireSound=pistol-1.wav local template projectile=+bryarbolt local template lookghost=+timedghost local template povtemp=+bryarmodel local template posghost=+timedghost local thing player local thing weaplook local thing weaponpov local int direction=0 int v_player local int y_vec local int weappos local int mode local int holsterTrack local int error=0 local int gunweap local int weap=2 local int ammobin=11 local vector f_vec local flex fireWait=0.5 local flex holsterWait local flex powerBoost local flex autoAimFOV=30 local flex x_thrust local flex y_thrust local message activated message deactivated message selected message deselected message autoselect message killed message fire message timer message pulse end #==============================================================# code #------------------------------------------------------ selected: player = GetSourceRef(); // Setup the meshes and models. jkSetPOVModel(player, povModel); jkSetWeaponMesh(player, weaponMesh); SetArmedMode(player, 1); ParseArg(player, "maxheadpitch=89.50"); weaponpov = CreateThing(povtemp, player); SetThingPos(weaponpov, GetThingPos(player)); AttachThingToThingEx(weaponpov, player, 0x8); SetThingModel(weaponpov, povModel); PlayKey(weaponpov, mountAnim, 1, 0x4); error = 0; SetPulse(0.01); PlayMode(player, 41); PlaySoundThing(mountSound, player, 1.0, -1.0, -1.0, 0x80); jkClearFlags(player, 0x5); SetCurWeapon(player, weap); gunweap = GetCurWeapon(player); SetMountWait(player, GetKeyLen(mountAnim)); Return; #------------------------------------------------------ deselected: player = GetSourceRef(); #weaponIndex = GetSenderRef(); ParseArg(player, "maxheadpitch=90.00"); SetTimerEx(GetKeyLen(dismountAnim), 1, 0.0, 0.0); PlaySoundThing(dismountSound, player, 1.0, -1, -1, 0x80); PlayKey(weaponpov, dismountAnim, 1, 0x18); holsterWait = GetKeyLen(holsterAnim); SetMountWait(player, holsterWait); holsterTrack = PlayKey(player, holsterAnim, 1, 0x4); SetTimerEx(holsterWait, 2, 0.0, 0.0); Return; #------------------------------------------------------ activated: player = GetSourceRef(); mode = GetSenderRef(); powerBoost = GetInv(player, 63); ActivateWeapon(player, fireWait / powerBoost, mode); Return; #------------------------------------------------------ fire: player = GetSourceRef(); // Check that the player is still alive. if(GetThingHealth(player) <= 0) Return; // Check Ammo - If we are out, autoselect best weapon. if(GetInv(player, ammobin) < 1.0) { PlaySoundThing(outSound, player, 1.0, -1.0, -1.0, 0x80); if(GetAutoSwitch() & 1) SelectWeapon(player, AutoselectWeapon(player, 1)); Return; } SetPOVShake('0.0 -.003 0.0', '1.0 0.0 0.0', .05, 80.0); FireProjectile(player, projectile, fireSound, 8, '0.0135 0.1624 0.0', '0 0 0', 1.0, 0x20, autoAimFOV, autoAimFOV * 2); PlayKey(weaponpov, povfireAnim, 1, 0x38); ChangeInv(player, ammobin, -1.0); powerBoost = GetInv(player, 63); ChangeFireRate(player, fireWait / powerBoost); Return; #------------------------------------------------------ deactivated: player = GetSourceRef(); mode = GetSenderRef(); DeactivateWeapon(player, mode); Return; #------------------------------------------------------ autoselect: player = GetSourceRef(); // If the player has the weapon if(GetInv(player, weap) != 0.0) { // If the player has ammo if(GetInv(player, ammobin) != 0.0) { ReturnEx(500.0); } else { ReturnEx(-1.0); } } else { ReturnEx(-1.0); } Return; #------------------------------------------------------ timer: if(GetSenderID() == 1) { //if(GetCurWeapon(player) == gunweap) //{ // error = 1; // Return; //} SetPulse(0); DestroyThing(weaponpov); } else if(GetSenderID() == 2) StopKey(player, holsterTrack, 0.0); Return; #------------------------------------------------------ pulse: if(error == 1) { if(GetCurWeapon(player) != gunweap) { error = 0; SetPulse(0); DestroyThing(weaponpov); } } if(GetCurrentCamera() == 0) ClearThingFlags(weaponpov, 0x10); else SetThingFlags(weaponpov, 0x10); weaplook = FireProjectile(player, lookghost, -1, -1, '0 0 0', '0 0 0', 1.0, 0x20, 30, 10); SetThingLook(weaponpov, GetThingLVec(weaplook)); // Pov Waggle x_thrust = VectorX(GetThingThrust(player)); y_thrust = VectorY(GetThingThrust(player)); if(x_thrust < 0) x_thrust = x_thrust * -1; if(y_thrust < 0) y_thrust = y_thrust * -1; v_player = ((y_thrust + x_thrust) * 0.001) * 0.24; if(y_vec >= 0.006) { direction = 0; } if(y_vec <= -0.006) { direction = 1; } if(v_player <= 0) { if(direction == 0) { y_vec = y_vec + v_player; } if(direction == 1) { y_vec = y_vec - v_player; } } else { if(direction == 0) { y_vec = y_vec - v_player; } if(direction == 1) { y_vec = y_vec + v_player; } } f_vec = VectorSet(0, y_vec, 0); weappos = FireProjectile(player, posghost, -1, -1, f_vec, '0 0 0', 0, 0, 0, 0); SetThingPos(weaponpov, GetThingPos(weappos)); //SetThingPos(weaponpov, f_vec); Return; #------------------------------------------------------ killed: error = 0; SetPulse(0); DestroyThing(weaponpov); Return; #------------------------------------------------------ end
Is it possible JK is crashing from something in the pulse message?
------------------
I am Darth Slaw.
The Dark Lord of the Sith,
And part of the Nightfire mod team
May the mass times acceleration be with you.