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 → replacing weap_seqcharge.cog not working
replacing weap_seqcharge.cog not working
2001-12-01, 3:52 PM #1
i have my weap_seqcharge.cog COG modified for a MOD, and it works fine except for the fact that the projectiles fire directly at the floor or a wall if i'm close enough, just like the sequencer charges are supposed to. the problem is, i want them to fire streight and at a random vecotr like the stormtrooper rifle does. what line(s) is(are) causing that? how can i fix it? the COG goes as follows:

symbols

model povModel=seqv.3do local
model weaponMesh=seqg.3do local

keyframe mountAnim=StrVmnt.key local
keyframe dismountAnim=ConVdis.key local
keyframe povfireAnim=StrVpst1.key local
keyframe holsterAnim=kyhlstr.key local

sound mountSound=df_rif_ready.wav local
sound dismountSound=PutWeaponAway01.wav local
sound fireSound=turret-1.wav local
sound outSound=trprout.wav local

flex mountWait local
flex fireWait=0.15 local
flex holsterWait local

template projectile=+blasterlaser local

int cel local
int mode local
int dummy local

thing player local
int trackID=-1 local
int holsterTrack local

vector randVec local

int selectMode=1 local

message startup
message activated
message deactivated
message selected
message deselected
#message newplayer
message autoselect
message fire
message timer

end

# ========================================================================================

code

startup:
// Setup delays and variables.
mountWait = GetKeyLen(mountAnim);

Return;

# ........................................................................................

fire:
player = GetSourceRef();
mode = GetSenderRef();

// Check that the player is still alive.
if(GetThingHealth(player) <= 0)
{
Return;
}


randVec = VectorSet((Rand()-0.5)*5, (Rand()-0.5)*5, 0.0);
SetThingVel(dummy, vectorScale(GetThingVel(dummy), 0.01));
SetPOVShake('0.0 -.003 0.0', '1.5 0.0 0.0', .05, 80.0);
dummy = FireProjectile(player, projectile, fireSound, 8, '0.0168 0.1896 0.00', randVec, 1.0, 0x30, autoAimFOV, autoAimFOV*2);
SetThingVel(dummy, vectorScale(GetThingVel(dummy), 0.01));

jkPlayPOVKey(player, povfireAnim, 1, 0x38);
ChangeInv(player, 8, -1.0);

// If out of ammo try to autoswitch to another weapon
// if autoswitch is enabled else just switch to fists.
if(GetInv(player, 8) < 1)
{
if(GetAutoSwitch() & 1)
{
PlaySoundThing(outSound, player, 1.0, -1, -1, 0x80);
SelectWeapon(player, AutoSelectWeapon(player, 1));
}
else
{
SelectWeapon(player, 1);
}
}

Return;

# ........................................................................................

activated:
player = GetSourceRef();
mode = GetSenderRef();

jkSetWaggle(player, '0.0 0.0 0.0', 0);
ActivateWeapon( player, fireWait, mode );

Return;

# ........................................................................................

deactivated:
player = GetSourceRef();
mode = GetSenderRef();

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

# ........................................................................................

selected:
player = GetSourceRef();

PlayMode(player, 40);
jkSetPOVModel(player, povModel);
PlaySoundThing(mountSound, player, 1.0, -1, -1, 0x80);
SetArmedMode(player, 1);
jkSetWeaponMesh(player, weaponMesh);
trackID = jkPlayPOVKey(player, mountAnim, 0, 20);

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

SetMountWait(player, GetKeyLen(mountAnim));
jkClearFlags(player, 0x5);
SetCurWeapon(player, 8);

Return;

# ........................................................................................

deselected:
player = GetSourceRef();
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 (trackID != -1)
{
jkStopPOVKey(player, trackID, 0);
trackID = -1;
}
jkSetWaggle(player, '0.0 0.0 0.0', 0);
Return;

# ........................................................................................

//newplayer:
// player = GetSourceRef();
//
// // Make sure that if the player is respawning, the old mount isn't playing anymore.
// if (trackID != -1)
// jkStopPOVKey(player, trackID, 0);
//
// Return;

# ........................................................................................

autoselect:
selectMode = GetSenderRef();
player = GetSourceRef();

// If the player has ammo
if(GetInv(player, 8) != 0)
{
// query for ammo
if(selectMode == -1)
{
ReturnEx(300.0);
Return;
}

if((selectMode == 0) && !(GetAutoPickup() & 2))
{
ReturnEx(300.0);
Return;
}

if((selectMode == 1) && !(GetAutoSwitch() & 2))
{
ReturnEx(300.0);
Return;
}

if((selectMode == 2) && !(GetAutoPickup() & 2))
{
ReturnEx(300.0);
Return;
}

ReturnEx(-2.0);
Return;

}
else
{
ReturnEx(-1.0);
}

Return;

# ........................................................................................

timer:
StopKey(player, holsterTrack, 0.0);
Return;

end

↑ Up to the top!