I'm posting here because I want these to be kept kinda under raps.
![http://forums.massassi.net/html/wink.gif [http://forums.massassi.net/html/wink.gif]](http://forums.massassi.net/html/wink.gif)
------------------
The Sniper Missions. Current project, The Sniper Missions
The Magician Saber System.
[edit]Forgot to post the templates!
Also add bit more info[/edit]
[This message has been edited by Descent_pilot (edited August 18, 2002).]
Code:
Here's the templates for this and a weapon that will fire through walls.
# 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.
#
# [YB & CYW]
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved
symbols
model povModel=bryv.3do local
model weaponMesh=bryg.3do 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 cameraTpl=+camera local
template cam=+zoom_cam local
thing player local
flex fireWait=0.5 local
flex holsterWait local
flex fireDelay=0.6 local
flex powerBoost local
flex autoAimFOV=30 local
flex autoAimMaxDist=5 local
flex zoom=0.15 local
flex distance local
int weaponIndex local
int trackID=-1 local
int dummy=0 local
int bolt=0 local
int camera=0 local
int mode local
int holsterTrack local
int stay local
int scope=1 local
int oldFocus local
int count local
int active=0 local
message activated
message deactivated
message selected
message deselected
message autoselect
message fire
message timer
message pulse
end
# ========================================================================================
code
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, 11) < 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);
bolt = FireProjectile(player, projectile, fireSound, 8, '0.0135 0.1624 0.0', '0 0 0', 1.0, 0x20, autoAimFOV, autoAimFOV*2);
ChangeInv(player, 11, -1.0);
jkPlayPOVKey(player, povfireAnim, 1, 0x38);
powerBoost = GetInv(player, 63);
ChangeFireRate(player, fireWait/powerBoost);
Return;
# ........................................................................................
activated:
player = GetSourceRef();
mode = GetSenderRef();
If(mode == 0)
{
jkSetWaggle(player, '0.0 0.0 0.0', 0);
powerBoost = GetInv(player, 63);
ActivateWeapon( player, fireWait/powerBoost, mode );
}
Else
{
If(!active)
{
oldFocus = GetCurrentCamera();
ParseArg(player, "maxrotvel=20 maxrotthrust=20");
SetPulse(.01);
active = 1;
}
Stay = 0;
Count = 0;
}
Return;
# ........................................................................................
deactivated:
player = GetSourceRef();
mode = GetSenderRef();
If(mode == 0)
{
jkSetWaggle(player, '10.0 7.0 0.0', 350);
DeactivateWeapon(player, mode);
}
Else
{
scope = 1 - scope;
stay = 1;
If(count <= 3) Call cancel;
}
Return;
# ........................................................................................
selected:
player = GetSourceRef();
// Setup the meshes and models.
jkSetPOVModel(player, povModel);
jkSetWeaponMesh(player, weaponMesh);
SetArmedMode(player, 1);
// Play mounting sound.
PlayMode(player, 41);
PlaySoundThing(mountSound, player, 1.0, -1.0, -1.0, 0x80);
// Play the animation (NOLOOP + UNIQUE + ENDPAUSE).
// The animation is held at the last frame after it is played.
trackID = jkPlayPOVKey(player, mountAnim, 0, 0x14);
jkSetWaggle(player, '10.0 7.0 0.0', 350);
// Clear saber flags, and allow activation of the weapon
jkClearFlags(player, 0x5);
SetCurWeapon(player, 2);
SetMountWait(player, GetKeyLen(mountAnim));
Active = 0;
Return;
# ........................................................................................
deselected:
player = GetSourceRef();
weaponIndex = GetSenderRef();
Call cancel;
Scope = 1;
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, 2) != 0.0)
{
// If the player has ammo
if(GetInv(player, 11) != 0.0)
{
ReturnEx(500.0);
}
else
{
ReturnEx(-1.0);
}
}
else
{
ReturnEx(-1.0);
}
Return;
# ........................................................................................
timer:
StopKey(player, holsterTrack, 0.0);
Return;
# ........................................................................................
Pulse:
If(!stay)
{
If(scope)
{
zoom = zoom + count * 0.005;
If(zoom > 5) zoom = 5;
}
Else
{
zoom = zoom - count * 0.005;
If(zoom < 0.15) zoom = 0.15;
}
count = count + 1;
}
If((zoom == 0.15) && !scope)
{
call cancel;
Return;
}
distance = zoom / 1000;
dummy = FireProjectile(player, cameraTpl, -1, -1, '0 0 0.037', '0 0 0', 0, 0, 0, 0);
Sleep(distance);
cam = CreateThingAtPos(camera, GetThingSector(dummy), GetThingPos(dummy), GetThingLVec(dummy));
SetCameraFocus(0, cam);
DestroyThing(dummy);
If(GetCurrentCamera() != 0) CycleCamera();
Return;
# ........................................................................................
Cancel:
SetPulse(0);
ParseArg(player, "maxrotvel=200 maxrotthrust=180");
SetCameraFocus(0, player);
zoom = .15;
If(oldFocus != GetCurrentCamera()) CycleCamera();
active = 0;
Return;
endCode:
Still haven't figured out a way to change the the game to wireframe mode or for a scope to go through walls... That is for the nightshot projectiles. I still need permission to post the weapon models for SaberMaster to see. _weapon none orient=(0/0/0) type=weapon collide=1 move=physics thingflags=0x20000000 timer=10 mass=5 physflags=0x200 maxrotvel=90 damageclass=0x2 typeflags=0x1 _explosion none orient=(0.000000/0.000000/0.000000) type=explosion typeflags=0x1 damageclass=0x4 +lgflash _explosion thingflags=0x1 light=0.300000 timer=0.400000 typeflags=0x12 blasttime=0.200000 maxlight=1.000000 +nstrail _weapon vel=(0/7/0) size=0.005 movesize=0.005 damage=100 mindamage=100 maxrotvel=0 typeflags=0x20400d +nightshot _weapon model3d=con0.3do vel=(0/7/0) collide=0 elementsize=0.05 typeflags=0x8000 range=100 trailthing=+bryarbolt +camera _weapon vel=(0/1000/0) thingflags=0 damageclass=0 typeflags=0x40d size=.001 movesize=0.001 +zoom_cam _weapon size=0.001 movesize=0.001 maxvel=0 vel=(0/0/0) timer=0.01 thingflags=0 damageclass=0 typeflags=0xd
![http://forums.massassi.net/html/wink.gif [http://forums.massassi.net/html/wink.gif]](http://forums.massassi.net/html/wink.gif)
------------------
The Sniper Missions. Current project, The Sniper Missions
The Magician Saber System.
[edit]Forgot to post the templates!
Also add bit more info[/edit][This message has been edited by Descent_pilot (edited August 18, 2002).]
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms
Completed
Judgement Day (HLP), My level pack
SATNRT, JK Pistol Mod, Aliens TC, Firearms
Completed
Judgement Day (HLP), My level pack

![http://forums.massassi.net/html/confused.gif [http://forums.massassi.net/html/confused.gif]](http://forums.massassi.net/html/confused.gif)
![http://forums.massassi.net/html/frown.gif [http://forums.massassi.net/html/frown.gif]](http://forums.massassi.net/html/frown.gif)
Camera was suppose to be zoom_cam instead, We all forgot the obvious. Its always the easist things that we should look at first. But Alas, she still won't work. ![http://forums.massassi.net/html/smile.gif [http://forums.massassi.net/html/smile.gif]](http://forums.massassi.net/html/smile.gif)
yea. yea. yea. Go take a look SaberMaster, and see what everybody's comments have done. ![http://forums.massassi.net/html/tongue.gif [http://forums.massassi.net/html/tongue.gif]](http://forums.massassi.net/html/tongue.gif)