Basically, I need the gun to shoot about 20 shots then do a fake reload. Example: It doesn't let you shoot for about 1.5 sec and makes a specified sound and prints Reloading... . Also it needs to keeps doing the 20 shot thing until the ammo is out. BTW heres the cog...
# Jedi Knight Cog Script
#
# WEAP_STRIFLE.COG
#
# WEAPON 3 script - Stormtrooper Rifle
#
# The standard rifle used by the stormtroopers. Not as accurate as the Bryar Pistol.
# This weapon has only one type of fire.
#
# - Affected by MagSealed sectors/surfaces.
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved
symbols
model povModel=uziv.3do local
model weaponMesh=uzig.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_rif_ready.wav local
sound dismountSound=PutWeaponAway01.wav local
sound fireSound=uzi.wav local
sound outSound=trprout.wav local
template projectile=+repeaterball local
thing player local
vector randVec local
flex fireWait=0.1 local
flex holsterWait local
flex powerBoost local
flex autoAimFOV=25 local
flex autoAimMaxDist=5 local
int dummy local
int trackID=-1 local
int fireChannel=-1 local
int holsterTrack local
int mode local
message activated
message deactivated
message selected
message deselected
message autoselect
message fire
message timer
end
# ========================================================================================
code
fire:
player = GetSourceRef();
mode = GetSenderRef();
// Check that the player is still alive.
if(GetThingHealth(player) <= 0)
{
Return;
}
// Check Ammo - If we are out, autoselect best weapon.
// It should always use two energy cells, but -- as in DF --
// allow the last fire if there is only one left...
if(GetInv(player, 11) < 1.0)
{
PlaySoundThing(outSound, player, 1.0, -1, -1, 0x80);
if((GetAutoSwitch() & 1))
SelectWeapon(player, AutoSelectWeapon(player, 1));
Return;
}
// Get random aiming error
randVec = VectorSet((Rand()-0.5)*5, (Rand()-0.5)*5, 0.0);
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);
StopThing(dummy);
ClearPhysicsFlags(dummy, 0x1);
AddThingVel(dummy, VectorScale(GetThingLVec(dummy), 50));
ChangeInv( player, 11, -1.0 );
jkPlayPOVKey( player, povfireAnim, 1, 0x38 );
powerBoost = GetInv(player, 63);
ChangeFireRate(player, fireWait/powerBoost);
Return;
# ........................................................................................
activated:
player = GetSourceRef();
mode = GetSenderRef();
jkSetWaggle(player, '0.0 0.0 0.0', 0);
powerBoost = GetInv(player, 63);
ActivateWeapon(player, fireWait/powerBoost, mode);
Return;
# ........................................................................................
deactivated:
player = GetSourceRef();
jkSetWaggle(player, '10.0 7.0 0.0', 350);
DeactivateWeapon(player, mode);
Return;
# ........................................................................................
selected:
player = GetSourceRef();
PlayMode(player, 41);
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, 3);
Return;
# ........................................................................................
deselected:
player = GetSourceRef();
PlaySoundThing(dismountSound, player, 1.0, -1, -1, 0x80);
jkPlayPOVKey(player, dismountAnim, 0, 0x18);
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, 3) != 0.0)
{
// If the player has ammo
if(GetInv(player, 11) != 0.0)
{
ReturnEx(600.0);
}
else
{
ReturnEx(-1.0);
}
}
else
{
ReturnEx(-1.0);
}
Return;
# ........................................................................................
timer:
StopKey(player, holsterTrack, 0.0);
Return;
end
------------------
Watch Your Back On The Zone...Cause "Deth" Is Always Creeping Up Behind.
[This message has been edited by Dethmasta (edited December 17, 2001).]
# Jedi Knight Cog Script
#
# WEAP_STRIFLE.COG
#
# WEAPON 3 script - Stormtrooper Rifle
#
# The standard rifle used by the stormtroopers. Not as accurate as the Bryar Pistol.
# This weapon has only one type of fire.
#
# - Affected by MagSealed sectors/surfaces.
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved
symbols
model povModel=uziv.3do local
model weaponMesh=uzig.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_rif_ready.wav local
sound dismountSound=PutWeaponAway01.wav local
sound fireSound=uzi.wav local
sound outSound=trprout.wav local
template projectile=+repeaterball local
thing player local
vector randVec local
flex fireWait=0.1 local
flex holsterWait local
flex powerBoost local
flex autoAimFOV=25 local
flex autoAimMaxDist=5 local
int dummy local
int trackID=-1 local
int fireChannel=-1 local
int holsterTrack local
int mode local
message activated
message deactivated
message selected
message deselected
message autoselect
message fire
message timer
end
# ========================================================================================
code
fire:
player = GetSourceRef();
mode = GetSenderRef();
// Check that the player is still alive.
if(GetThingHealth(player) <= 0)
{
Return;
}
// Check Ammo - If we are out, autoselect best weapon.
// It should always use two energy cells, but -- as in DF --
// allow the last fire if there is only one left...
if(GetInv(player, 11) < 1.0)
{
PlaySoundThing(outSound, player, 1.0, -1, -1, 0x80);
if((GetAutoSwitch() & 1))
SelectWeapon(player, AutoSelectWeapon(player, 1));
Return;
}
// Get random aiming error
randVec = VectorSet((Rand()-0.5)*5, (Rand()-0.5)*5, 0.0);
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);
StopThing(dummy);
ClearPhysicsFlags(dummy, 0x1);
AddThingVel(dummy, VectorScale(GetThingLVec(dummy), 50));
ChangeInv( player, 11, -1.0 );
jkPlayPOVKey( player, povfireAnim, 1, 0x38 );
powerBoost = GetInv(player, 63);
ChangeFireRate(player, fireWait/powerBoost);
Return;
# ........................................................................................
activated:
player = GetSourceRef();
mode = GetSenderRef();
jkSetWaggle(player, '0.0 0.0 0.0', 0);
powerBoost = GetInv(player, 63);
ActivateWeapon(player, fireWait/powerBoost, mode);
Return;
# ........................................................................................
deactivated:
player = GetSourceRef();
jkSetWaggle(player, '10.0 7.0 0.0', 350);
DeactivateWeapon(player, mode);
Return;
# ........................................................................................
selected:
player = GetSourceRef();
PlayMode(player, 41);
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, 3);
Return;
# ........................................................................................
deselected:
player = GetSourceRef();
PlaySoundThing(dismountSound, player, 1.0, -1, -1, 0x80);
jkPlayPOVKey(player, dismountAnim, 0, 0x18);
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, 3) != 0.0)
{
// If the player has ammo
if(GetInv(player, 11) != 0.0)
{
ReturnEx(600.0);
}
else
{
ReturnEx(-1.0);
}
}
else
{
ReturnEx(-1.0);
}
Return;
# ........................................................................................
timer:
StopKey(player, holsterTrack, 0.0);
Return;
end
------------------
Watch Your Back On The Zone...Cause "Deth" Is Always Creeping Up Behind.
[This message has been edited by Dethmasta (edited December 17, 2001).]
(Hostile Takeover)
http://www.massassi.net/levels/files/1708.shtml
(RWP)
http://www.massassi.net/levels/files/1780.shtml
Check Um Out...
http://www.massassi.net/levels/files/1708.shtml
(RWP)
http://www.massassi.net/levels/files/1780.shtml
Check Um Out...