I started a cog from scratch just to control what went in and I pasted in most of the stuff line by line so I could try and understand it and its helped alot, but im wondering do you HAVE to have powerboost and auto aim in there? heres the problem I wrote it and it works in game, pulls out the write 3do and everything but when I press fire, nothing...
Whee ya I am trying to figure stuff out but hopefully there isnt tooooo much wrong with it![http://forums.massassi.net/html/wink.gif [http://forums.massassi.net/html/wink.gif]](http://forums.massassi.net/html/wink.gif)
------------------
Blue Spandex.
WHEEEEEEEEEE.
[This message has been edited by sgt_mischa (edited July 28, 2002).]
Code:
#
#
# WEAP_AK47.COG
#
#
#
#
# This Cog is Not supported by LucasArts Entertainment Co
symbols
model povModel=vak47.3do local
model weaponMesh=gak47.3do local
keyframe mountAnim=StrVmnt.key local
keyframe dismountAnim=StrVdis.key local
keyframe povfireAnim=StrVpst1.key local
keyframe holsterAnim=kyhlstr.key local
sound mountSound=df_bry_ready.wav local
sound dismountSound=PutWeaponAway01.wav local
sound fireSound=ak47.wav local
sound outSound=trprout.wav local
sound clickSound=click.wav local
sound reloadsound=rel-1.wav local
sound reloadsound1=rel-2.wav local
template projectile=+repeaterball local
thing player local
flex fireWait=0.07 local
flex holsterWait local
int dummy local
int trackID=-1 local
int fireChannel=-1 local
int holsterTrack local
int mode local
int count=0 local
int disID local
message activated
message deactivated
message selected
message deselected
message autoselect
message fire
message timer
message user0
end
# ========================================================================================
code
fire:
player = GetSourceRef();
mode = GetSenderRef();
if(count > 29)
{
PlaySoundThing(clickSound, player, 1.0, -1, -1, 0x80);
Sleep(1);
Return;
}
// Check that the player is still alive.
if(GetThingHealth(player) <= 0)
{
Return;
}
if(GetInv(player, 12) < 1.0)
{
PlaySoundThing(outSound, player, 1.0, -1, -1, 0x80);
if((GetAutoSwitch() & 1))
SelectWeapon(player, AutoSelectWeapon(player, 1));
Return;
}
if(mode == 0)
{
randVec = VectorSet((Rand()-0.5)*5,(Rand()-0.2)*5, 0.0);
dummy = FireProjectile(player, projectile, fireSound, 8, '0.0100 0.1200 0.00');
ChangeInv( player, 12, -1.0 );
count = count + 1;
}
else
{
}
jkPlayPOVKey( player, povfireAnim, 1, 0x38 );
Return;
# ........................................................................................
selected:
player = GetSourceRef();
PlayMode(player, 41);
Print("AK-47 7.62x39mm Assault Rifle");
PlaySoundThing(mountSound, player, 1.0, -1, -1, 0x80);
jkSetPOVModel(player, povModel);
SetArmedMode(player, 1);
jkSetWeaponMesh(player, weaponMesh);
jkSetWaggle(player, '10.0 7.0 0.0', 350);
trackID = jkPlayPOVKey(player, mountAnim, 0, 20);
SetMountWait(player, GetKeyLen(mountAnim));
jkClearFlags(player, 0x5);
SetCurWeapon(player, 6);
Return;
# ........................................................................................
deselected:
if(fireChannel != -1)
{
StopSound(fireChannel, 0.1);
fireChannel = -1;
}
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;
# ........................................................................................
autoselect:
player = GetSourceRef();
// If the player has the weapon
if(GetInv(player, 6) != 0.0)
{
// If the player has ammo
if(GetInv(player, 12) != 0.0)
{
ReturnEx(600.0);
}
else
{
ReturnEx(-1.0);
}
}
else
{
ReturnEx(-1.0);
}
Return;
# ........................................................................................
user0:
disID = jkPlayPOVKey(player, dismountAnim, 0, 0x4);
SetMountWait(player, GetKeyLen(holsterAnim));
holsterTrack = PlayKey(player, holsterAnim, 1, 0x4);
if(trackID != -1) { jkStopPOVKey(player, trackID, 0); trackID = -1; }
PlaySoundThing(reloadsound, player, 1.0, -1, -1, 0x80);
Sleep(1);
PlaySoundThing(reloadsound1, player, 1.0, -1, -1, 0x80);
StopKey(player, holsterTrack, 0);
PlayMode(player, 41);
jkStopPOVKey(player, disID, 0);
trackID = jkPlayPOVKey(player, mountAnim, 0, 20);
SetMountWait(player, GetKeyLen(mountAnim));
count = 0;
Return;
# ........................................................................................
timer:
StopKey(player, holsterTrack, 0.0);
Return;
end
Whee ya I am trying to figure stuff out but hopefully there isnt tooooo much wrong with it
![http://forums.massassi.net/html/wink.gif [http://forums.massassi.net/html/wink.gif]](http://forums.massassi.net/html/wink.gif)
------------------
Blue Spandex.
WHEEEEEEEEEE.
[This message has been edited by sgt_mischa (edited July 28, 2002).]

![http://forums.massassi.net/html/frown.gif [http://forums.massassi.net/html/frown.gif]](http://forums.massassi.net/html/frown.gif)