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 → problem with weapon COG...
problem with weapon COG...
2001-12-05, 11:55 AM #1
i have a weapon COG replacing the sequencer charges and the projectiles fire directly at the floor, how do i make them fire forwards instead?

the COG is 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', '0 0 0', 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
2001-12-05, 12:03 PM #2
Check your projectile template, make sure the vel= has 0 for the third value.
-Hell Raiser
2001-12-06, 9:05 AM #3
yup, it's 0, that's not the problem
2001-12-07, 2:23 PM #4
Maybe the template's mass is too much?
2001-12-07, 9:15 PM #5
"dummy = FireProjectile(player, projectile, fireSound, 8, '0.0168 0.1896 0.00', '0 0 0', 1.0, 0x30, autoAimFOV, autoAimFOV*2);"

Does that make it fire the projectile down?
Team Battle.
2001-12-08, 1:46 AM #6
Whoops! nope

shutup hellcat
Team Battle.
2001-12-09, 4:41 AM #7
I fixed it...can't say I know what the problem was though...

↑ Up to the top!