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 → Possible solution to the seifer pov cog crashing.
Possible solution to the seifer pov cog crashing.
2004-08-16, 8:49 PM #1
As you know, when you save the game with a seifer pov cog gun out and then reload, it crashes. I have made a very simple solution to it but it still works effectively. I was hoping someone could jazz it up for me.

Code:
# Jedi Knight Cog Script
#
# save.COG
#
# Saves the game for the player if he/she is using the seifer cog.
# 
#
# This Cog is Not supported by LucasArts Entertainment Co

symbols
message    activated
thing      player      local

end

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

code
activated:
SelectWeapon(player, 1);
sleep(1.0);
AutoSaveGame();
Print("Game Saved");
Print("Remember to select fists and save the game properly before exiting");

Return;
# ........................................................................................

end



First thing is if its possible to get the game to switch back to the origonal weapon you were using before you pressed the save.

Second if you try to use this in multiplayer then it just says Saving not avaliable in multiplayer.

Thanks.

------------------
~Nightfire Mod~
Spoting an error in post will result in a $100 reward.
Offer expires on 6/6/06. Valid one per customer, per day.

Rangi
2004-08-17, 2:57 AM #2
These COGs are technically hacks (written to pass checksum) but work in conjunction to produce the "seifer cog" effect for weapon number 3. You don't crash when loading a save game (even if you save while weapon 3 is equipped) and I'm pretty sure I unsynced it so it won't bog down multiplayer. There are 2 COGs and a hacked .snd file. After you take a look at it, you should realize why I modded the .snd file.

weap_strifle.cog
Code:
# Jedi Knight Cog Script
#
# WEAP_STRIFLE.COG
#
# WEAPON 3 script - Tactical Assault Pistol
#
# Uses the "seifer cog" technique to render the internal model.
#
# - Affected by MagSealed sectors/surfaces.
#
# [QM]
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved


symbols

model       povModel=strv.3do                   local
model       weaponMesh=bryg.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=trprsht2.wav              local // sound       fireSound=bossk-1.wav               local
sound       outSound=trprout.wav                local // sound       outSound=lvrclik2.wav               local

template    projectile=+bryarbolt               local

thing       player                              local

vector      randVec                             local

flex        fireWait=0.1                        local
flex        holsterWait                         local
flex        powerBoost                          local
flex        autoAimFOV=25                       local
vector      randVec2=0                          local

int         dummy                               local
int         trackID=-1                          local
model       laserModel=bry1.3do                 local
int         holsterTrack                        local
int         mode                                local

thing       weaponModel=-1                      local
model       povMesh=bryv.3do                    local
message     pulse

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

end

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

code

   player = GetSourceRef();
fire:
   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);
   // SetThingVel(dummy, vectorScale(GetThingVel(dummy), 0.01));
// Event Horizon
   ChangeInv(player, 11, -2.0-mode);
   PlayKey(weaponModel, povfireAnim, 1, 0x38);

   SetThingVel(player, randVec[mode]);
   SetThingModel(dummy, laserModel);

   SetThingLook(weaponModel, GetThingLVec(dummy));

   Return;

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

activated:
   ActivateWeapon(GetSourceRef(), fireWait/GetInv(player, 63), GetSenderRef());
   Return;

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

deactivated:
   DeactivateWeapon(GetSourceRef(), GetSenderRef());
   SetThingLook(weaponModel, GetThingLVec(player));
   Return;

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

selected:
   PlayMode(player, 41);
   PlaySoundThing(mountSound, player, 1.0, -1, -1, 0x80);
   jkSetPOVModel(player, povModel);

   weaponModel = SendMessageEx(GetInvCog(player, 51), user0, 0, 0, 0, 0);
   SetThingPos(weaponModel, GetThingPos(player));
   AttachThingToThingEx(weaponModel, player, 0x8);
   SetThingModel(weaponModel, povMesh);

   ParseArg(weaponModel, "thingflags=0x10 timer=1.0 collide=0 cog=-1 angvel=(0.000000/0.000000/0.000000) typeflags=0x1");
   SetPulse(0.1);

   SetArmedMode(player, 1);
   jkSetWeaponMesh(player, weaponMesh);
   jkSetWaggle(player, '0.0 0.0 0.0', 0);
   trackID = PlayKey(weaponModel, mountAnim, 0, 0x14); // 20
   SetMountWait(player, 1.14); // 1.133333
   jkClearFlags(player, 0x5);
   SetCurWeapon(player, 3);

   Return;

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

deselected:
   PlaySoundThing(dismountSound, player, 1.0, -1, -1, 0x80);
   PlayKey(weaponModel, dismountAnim, 0, 0x1A); // 0x18
   SetMountWait(player, 0.46); // 0.466667
newplayer:
   SetPulse(0);
   if(weaponModel != -1)
   {
      SetLifeLeft(weaponModel, 0.46);
      weaponModel = -1;
   }
   Return;

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

   '0', '0', '0';

startup:
   player = GetLocalPlayerThing();

   Return;

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

autoselect:
   // 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);
         Return;
      }
   }
   ReturnEx(-1.0);
   Return;

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

pulse:
   if(GetCurrentCamera() == 0)
      ParseArg(weaponModel, "thingflags=0x0 timer=1.0");
   else
   {
      ParseArg(weaponModel, "thingflags=0x10 timer=1.0");
   }
   Return;

end


item_keygreen.cog
Code:
# Jedi Knight Cog Script
#
# ITEM_KEYGREEN.COG
#
# INVENTORY script - Thing Desyncronizer
# Bin 51
#
# [QM]
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved

flags=0x240

symbols

sound       keysound=BactaUse01.WAV
thing       player
template    projectile=+raildet2                local

message     user0

end

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

code

user0:
   player = GetSourceRef();
   ReturnEx(CreateThing(projectile, player));
   1, 1, 1, 1;
   Return;

end


rail.snd
Code:
# Foley description for rail det [QM]
create 		RailChargeFly01.WAV     0xA8
hithard		RailChargeAttach.WAV	0x80
hitmetal	RailChargeAttach.WAV	0x80
enterwater	ploop01.wav
enterwaterslow	ploop01.wav


It doesn't sync the pitch of the weapon (not enough code to add that) but you could easily apply this method to your existing "seifer cogs" to stop the crashing. After you load a game, it looks screwy, but that's because it's a hack. If you use a custom template, it shouldn't be quite so weird. Here's the template I suggest you use in your custom static.jkl instead of what I've seen used before:
Quote:
<font face="Verdana, Arial" size="2">
+povmodel none orient=(0.000000/0.000000/0.000000) type=weapon collide=0 move=physics thingflags=0x0 timer=1.000000 model3d=bryv.3do size=0.003000 movesize=0.003000 mass=1.000000 puppet=ra.pup surfdrag=3.000000 airdrag=0.000000 height=0.003000 physflags=0x200 vel=(0.000000/0.000000/0.000000) angvel=(0.000000/0.000000/0.000000) maxrotvel=90.000000 damageclass=0x2 typeflags=0x1
</font>

I haven't tested that template, it's just a compressed version of +raildet2 with the soundclass, cog and other various junk cut off.

Quib Mask

[Put templates in quotes, please... [http://forums.massassi.net/html/wink.gif]]

[This message has been edited by GBK (edited August 17, 2004).]

[This message has been edited by Quib Mask (edited August 19, 2004).]
2004-08-17, 5:11 AM #3
Would... a class cog attached to the pov model template cause crashing?
Cause that's what we're doing in Nightfire...

------------------
nytfyre m0d || f33l t3h p0w3r || t3h l0st c0gz || OMF > *
May the mass times acceleration be with you.
2004-08-17, 7:50 AM #4
I don't think that'll cause a problem, but it's easy to test: start a single player level, load a weapon that uses a thing based internal model, hit quicksave, then load the quicksave. If it doesn't crash, you're good to go. I think the main problem is all povmodel templates I've seen have been set as type=actor. That's the only thing I could find that may be crashing upon load. Also, it's seemed like the basic "seifer cog" was just freakishly crashy for some reason, not really sure why, would have JK just abruptly quit after 5 minutes for no good reason. I wish passing checksum didn't limit my verb count so much, else I might've tried converting all my weapons to a thing based internal model. I like the way the gun sorta drags and tilts when you strafe, though I miss the waggle.

Quib Mask
2004-08-18, 2:43 PM #5
I think I've heard someone else say they fixed the Seifer cog. Hopefully they may replay. I think it was Slaw.

------------------
_ _ _____________ _ _
Wolf Moon
Cast Your Spell On Me
Beware
The Woods At Night
The Wolf Has Come
_ _ _____________ _ _
Wolf Moon
Cast Your Spell On Me
Beware
The Woods At Night
The Wolf Has Come
2004-08-19, 12:10 AM #6
Ditto Sniperwolf [http://forums.massassi.net/html/smile.gif] - I thought Slaw had managed a fix (or if not a "fix" then at least a "work-around") for the Seifer pov-cog...

That said, it's good to see you back in the forums Slaw [http://forums.massassi.net/html/smile.gif] - don't tell me you went away for a while to try and reclaim that lost soul... [http://forums.massassi.net/html/wink.gif] [http://forums.massassi.net/html/biggrin.gif]

-Jackpot

------------------
"lucky_jackpot is the smily god..." - gothicX
"jackpot is an evil evil man... so evil, in fact, that he's awesome." - Seb

"Life is mostly froth and bubble, but two things stand in stone,
Kindness in another's trouble, courage in your own"
("Ye Wearie Wayfarer" - by Adam Lindsay Gordon)
"lucky_jackpot is the smily god..." -gothicX
"Life is mostly froth and bubble, but two things stand in stone,
Kindness in another's trouble, courage in your own"
- "Ye Wearie Wayfarer"
|| AI Builder: compatible with both JK & MotS || My website ||
2004-08-19, 3:37 AM #7
Quib do you have msn?
2004-08-19, 7:37 AM #8
Quote:
<font face="Verdana, Arial" size="2">Originally posted by lucky_jackpot:

Ditto Sniperwolf [http://forums.massassi.net/html/smile.gif] - I thought Slaw had managed a fix (or if not a "fix" then at least a "work-around") for the Seifer pov-cog...

That said, it's good to see you back in the forums Slaw [http://forums.massassi.net/html/smile.gif] - don't tell me you went away for a while to try and reclaim that lost soul... [http://forums.massassi.net/html/wink.gif] [http://forums.massassi.net/html/biggrin.gif]

-Jackpot
</font>


Nah, just went to visit some relatives in Illinois (US) for a month. [http://forums.massassi.net/html/smile.gif]
Was great to be there, but it's also great to be back [http://forums.massassi.net/html/smile.gif]

And yes, I found a workaround for the respawn crash bug in the seifer cog.(which surprisingly only occurred in single player; MP has no problems, which is a good thing [http://forums.massassi.net/html/smile.gif] )

------------------
nytfyre m0d || f33l t3h p0w3r || t3h l0st c0gz || OMF > *

[This message has been edited by Darth Slaw (edited August 19, 2004).]
May the mass times acceleration be with you.
2004-08-19, 10:28 AM #9
Quote:
<font face="Verdana, Arial" size="2">which surprisingly only occurred in single player; MP has no problems, which is a good thing</font>

I'm pretty sure this is because in multiplayer you just get back up with full hp, etc. whereas in single player, it reloads a "save" at the start of the level (to "respawn" you), causing a crash (just like when you'd manually load a saved game).

Arden Lyn, I don't have MSN and am just hard to get ahold of in general.

It does feel like I'm getting spit on though; have none of you guys looked at the code I posted? It's non-crashing "seifer cog" code, but you keep going on and on about how Soandso had fixed the problem (no offense to you Slaw) as if what I posted doesn't work. Just baffles me a little.

Quib Mask

P.S. - I updated my first post with the newest and final versions of my weap_strifle.cog and rail.snd files.

[This message has been edited by Quib Mask (edited August 19, 2004).]
2004-08-19, 1:42 PM #10
Quib Mask - it's nothing personal, really - it's just that some of us do occasionally pass by the forums whilst at work and whilst the code may look good, we may not have access to JK to test it on work machines... [http://forums.massassi.net/html/frown.gif] - goes for all cog scripts, not just yours. Given half a chance and my boss being ill though and this may well be a different story... [http://forums.massassi.net/html/wink.gif] [http://forums.massassi.net/html/biggrin.gif]

Personally, I don't see how just two people who happen to mention the same thing are "going on and on about how Soandso had fixed the problem"; the comments were merely observations, not put-downs of your achievements! Rest assured then when some of us have tested it (and found that it works) that we'll sing your praises [http://forums.massassi.net/html/wink.gif] [http://forums.massassi.net/html/smile.gif]

-Jackpot

------------------
"lucky_jackpot is the smily god..." - gothicX
"jackpot is an evil evil man... so evil, in fact, that he's awesome." - Seb

"Life is mostly froth and bubble, but two things stand in stone,
Kindness in another's trouble, courage in your own"
("Ye Wearie Wayfarer" - by Adam Lindsay Gordon)
"lucky_jackpot is the smily god..." -gothicX
"Life is mostly froth and bubble, but two things stand in stone,
Kindness in another's trouble, courage in your own"
- "Ye Wearie Wayfarer"
|| AI Builder: compatible with both JK & MotS || My website ||
2004-08-19, 7:30 PM #11
I'm gonna see if I can modify the current weapon cogs nightfire is using to use your template Quib (we can't simply use GetThingHealth() on yours like I had it to check, cause ours was an actor and yours is a weapon, but setting it up so "if(weaponpov != -1)" will work should fix it).

I was going to wait until I had done so to mention this, but I suppose that might have been a bad decision on my part (I'm kinda going to be busy these next few days -- summer reading that, for various reasons (as in more than just my laziness [http://forums.massassi.net/html/wink.gif] [http://forums.massassi.net/html/redface.gif] ), was put off to the last minute).

But thanks for providing the template [http://forums.massassi.net/html/smile.gif]

------------------
nytfyre m0d || f33l t3h p0w3r || t3h l0st c0gz || OMF > *

[This message has been edited by Darth Slaw (edited August 19, 2004).]
May the mass times acceleration be with you.
2004-08-19, 9:59 PM #12
Bah, I wasn't looking for that much of a reply lucky_jackpot, was really just making sure you realized I was providing "seifer cog" code that didn't crash, and wasn't just posting garbage.

Darth Slaw, if your mod's "seifer cog" isn't super secret or something, could you post it and the template(s) you use so I could see it? I've actually only seen the "seifer cog" used in JK Advanced by Ace1, and have no idea of the "seifer cog"s history, who this "seifer" guy was, or anything else about it. If anyone would care to tell the tale, I'd apreciate it.

Quib Mask
2004-08-20, 1:00 AM #13
Well as far as I can recall (and please someone who's been around a lot longer than me correct/modify this tale as appropriate [http://forums.massassi.net/html/smile.gif]) but the tale of Seifer or *_Seifer_* as he was known back in his time, is an interesting one...

Without doubt, he was one of the early generation of budding COG gods - along with Hideki, Pele, Obsidian, Uber(HOV), Aglar, GBK and SaberMaster (if I seem to recall - apologies if I'm missing names [http://forums.massassi.net/html/redface.gif] - I'm not getting drawn into that old debate [http://forums.massassi.net/html/wink.gif]). However, sometimes his knowledge of the COG language came across as that of a know-it-all and a "well I've done that before" -- but not provide any actual helpful information as to how to do it. As such, trekking through the forum archives, there was one post at the time that creased me (paraphrased because I can't find the actual post, but it got a chuckle out of me at the time):

[courtesy of an individual who was irked by Seifer's occassionally less than helpful input]
"Well we all know that Seifer has made, 3 times over, every cog ever known to mankind."

This said, there was no denying that he was a talented editor [http://forums.massassi.net/html/smile.gif] - but how the actual cog came about I can't recall (I was still absent-mindedly potting around with JED at the time). I was also only casually lurking at Massassi at the time (not signed-up) so other older members may well have more knowledge than I [http://forums.massassi.net/html/wink.gif] - indeed my interpretation of Seifer may well be incorrect, but that was how he appeared to me...

Just my two pennies worth [http://forums.massassi.net/html/smile.gif]

-Jackpot

------------------
"lucky_jackpot is the smily god..." - gothicX
"jackpot is an evil evil man... so evil, in fact, that he's awesome." - Seb

"Life is mostly froth and bubble, but two things stand in stone,
Kindness in another's trouble, courage in your own"
("Ye Wearie Wayfarer" - by Adam Lindsay Gordon)
"lucky_jackpot is the smily god..." -gothicX
"Life is mostly froth and bubble, but two things stand in stone,
Kindness in another's trouble, courage in your own"
- "Ye Wearie Wayfarer"
|| AI Builder: compatible with both JK & MotS || My website ||
2004-08-20, 8:06 AM #14
Quote:
<font face="Verdana, Arial" size="2">Originally posted by Quib Mask:
Darth Slaw, if your mod's "seifer cog" isn't super secret or something, could you post it and the template(s) you use so I could see it?</font>


No it's not secret. I'll post it for you [http://forums.massassi.net/html/smile.gif]
It's a ways different from the original cog (which Ruthven provided me with [http://forums.massassi.net/html/smile.gif] ), particularly since the template we've been using uses a class cog instead.

Modified bryar cog:
Code:
# 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.
#
# [*_seifer_*]
#
# (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  gunmodel=+gunmodel                  local

thing     player                              local
thing     weaponpov                           local

flex      fireWait=0.5                        local
flex      holsterWait                         local
flex      powerBoost                          local
flex      autoAimFOV=30                       local
flex      priority=500                        local
flex      temppriority=0                      local

int       mode                                local
int       holsterTrack                        local
int       ammobin=11                          local
int       weap=2                              local

message   startup
message   killed
message   activated
message   deactivated
message   selected
message   deselected
message   autoselect
message   fire
message   timer

end
# =======================================================================
code
# .......................................................................
startup:
	if(!IsMulti()) SetTimerEx(1.0, 1, 0, 0);	//only has respawn probs in single player...
	else temppriority = priority;			// so we can keep the normal priority in MP  [http://forums.massassi.net/html/smile.gif]

Return;
# .......................................................................
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, ammobin) < 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);
	FireProjectile(player, projectile, fireSound, 8, '0.0135 0.1624 0.0', '0 0 0', 1.0, 0x20, autoAimFOV, autoAimFOV * 2);
	ChangeInv(player, ammobin, -1.0);
	//jkPlayPOVKey(player, povfireAnim, 1, 0x38);
	PlayKey(weaponpov, 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);
	call waggleoff;
	powerBoost = GetInv(player, 63);
	ActivateWeapon(player, fireWait / powerBoost, mode);

Return;
# .......................................................................
deactivated:
	player = GetSourceRef();
	mode = GetSenderRef();
	//   jkSetWaggle(player, '10.0 7.0 0.0', 350);
	call waggleon;
	DeactivateWeapon(player, mode);

Return;
# .......................................................................
selected:
	player = GetSourceRef();
	// Setup the meshes and models.
	jkSetPOVModel(player, povModel);
	jkSetWeaponMesh(player, weaponMesh);
	SetArmedMode(player, 1);
	weaponpov = CreateThing(gunmodel, player);
	SetThingModel(weaponpov, povModel);
	PlayKey(weaponpov, mountAnim, 1, 0x14);
	// 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);
	call waggleon;
	// Clear saber flags, and allow activation of the weapon
	jkClearFlags(player, 0x5);
	SetCurWeapon(player, weap);
	SetMountWait(player, GetKeyLen(mountAnim));

Return;
# .......................................................................
deselected:
	player = GetSourceRef();
	SetTimerEx(GetKeyLen(dismountAnim), 3, 0.0, 0.0);
	PlayKey(weaponpov, dismountAnim, 1, 0x1c);
	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);
	call waggleoff;

Return;
# .......................................................................
autoselect:
	player = GetSourceRef();
	// If the player has the weapon
	if(GetInv(player, weap) != 0.0)
	{
		// If the player has ammo
		if(GetInv(player, ammobin) != 0.0)
		{
			//"temppriority" is equal to either 0 or "priority"; seifer weapons 
			// must not be selected at startup (after dying once) or JK will crash
			ReturnEx(temppriority);
		}
		else
		{
			ReturnEx(-1.0);
		}
	}
	else
	{
		ReturnEx(-1.0);
	}

Return;
# .......................................................................
timer:
	if(GetSenderID() == 1) temppriority = priority;
	if(GetSenderID() == 2) StopKey(player, holsterTrack, 0.0);
	if(GetSenderID() == 3)
	{
		if(GetThingHealth(weaponpov) > 0) DestroyThing(weaponpov);
	}

Return;
# .......................................................................
killed:
	if(GetThingHealth(weaponpov) > 0) DestroyThing(weaponpov);
	KillTimerEx(1);
	if(!IsMulti()) temppriority = 0;	//only respawn crashes in Single Player

Return;
# .......................................................................
waggleoff:
	SendMessage(GetThingClassCog(weaponpov), user0);

Return;
# .......................................................................
waggleon:
	SendMessage(GetThingClassCog(weaponpov), user1);

Return;
# .......................................................................
end


Templates: (The first group is essentially the original -- except with the attached cog -- but the second one seems to show no difference in performance.)
Quote:
<font face="Verdana, Arial" size="2">(This is the first template group)
* _gunmodelbase none orient=(0/0/0) type=weapon collide=1 move=physics thingflags=0x20000000 mass=5 physflags=0x200 maxrotvel=90 damageclass=0x2 typeflags=0x1
* +gunmodel _gunmodelbase collide=0 puppet=ky.pup type=actor mass=150 physflags=0x4a4f maxrotvel=200 maxvel=1 health=40 maxhealth=40 maxrotthrust=180 jumpspeed=1.5 eyeoffset=(0/0/0.037) minheadpitch=-80 maxheadpitch=89 lightoffset=(0/0.07/0.04) lightintensity=0.8 damageclass=0x0 typeflags=0x1 thingflags=0x20000410 model3d=fistv.3do cog=class_weaponpov.cog

+=======================================+
(This is the second template "group")
+gunmodel none orient=(0/0/0) type=actor move=physics collide=0 puppet=ra.pup physflags=0x0 health=40 maxhealth=40 damageclass=0x0 typeflags=0x0 thingflags=0x20000410 model3d=fistv.3do cog=class_gunmodel.cog
+=======================================+
(This template is used by both of the above groups)
+timedghost none orient=(0/0/0) type=ghost move=path timer=0.01</font>


And the class cog:

Code:
# Jedi Knight Cog Script
#
# class_gunmodel.cog
#
# Class cog for pov models. Uses *_seifer_*'s method for rendering and
#  waggling weapon models. This class cog makes it a little easier to
#  implement into weapon cogs and also frees up the pulse message  [http://forums.massassi.net/html/wink.gif].
# Also, if multiple weapons use the same waggling code, you only need to
#  edit it once (here) to change it, instead of changing it in each cog.
#
# The waggle code is *_seifer_*'s original waggle; a few minor
#  modifications made by Darth Slaw.
#
# [*_seifer_* & Darth Slaw]
#
# =======================================================================
flags=0x240

symbols

template  ghost=+timedghost       local

thing     player                  local
thing     weaponpov               local
thing     weappos                 local

flex      v_player                local
flex      y_vec=0                 local
flex      x_thrust                local
flex      y_thrust                local

vector    f_vec                   local

int       cursig                  local
int       direction=0             local
int       resetwaggle=0           local
int       waggle=0                local

message   created
message   pulse
message   user0
message   user1

end
# =======================================================================
code
# .......................................................................
created:
	waggle = 1;
	y_vec = 0;
	direction = 0;
	weaponpov = GetSenderRef();
	cursig = GetThingSignature(weaponpov);
	player = GetLocalPlayerThing();
	ParseArg(player, "maxheadpitch=89.50");
	SetThingPos(weaponpov, GetThingPos(player));
	AttachThingToThingEx(weaponpov, player, 0x8);
	SetThingPulse(weaponpov, 0.01);

Return;
# .......................................................................
pulse:
	player = GetLocalPlayerThing();
	weaponpov = GetSenderRef();
	if(GetThingSignature(GetSenderRef()) != cursig)         //fixes bug with falling into pits
	{
		SetThingPulse(GetSenderRef(), 0.0);
		if(GetThingHealth(GetSenderRef()) > 0) DestroyThing(GetSenderRef());
		Return;
	}

	// [Seifer's Waggle Code]
	if(GetCurrentCamera() == 0) ClearThingFlags(weaponpov, 0x10);
	else SetThingFlags(weaponpov, 0x10);
	if(waggle)
	{
		x_thrust = VectorX(GetThingVel(player));
		y_thrust = VectorY(GetThingVel(player));
		v_player = VectorLen(VectorSet(x_thrust, y_thrust, 0)) * 0.001;
		if(!(GetAttachFlags(player) & 1) && !(GetAttachFlags(player) & 2))
		{
			v_player = v_player / 2;
		}
		if(y_vec >= 0.003)
		{
			direction = 0;				// lets go backward
		}
		if(y_vec <= -0.003)
		{
			direction = 1;				// lets go forward
		}
		if(direction == 0)				// backward
		{
			y_vec = y_vec - v_player / 2;
		}
		if(direction == 1)				// forward
		{
			y_vec = y_vec + v_player / 2;
		}
	}
	f_vec = VectorSet(0, y_vec, 0);
	weappos = FireProjectile(player, ghost, -1, -1, f_vec, '0 0 0', 0, 0, 0, 0);
	SetThingLook(weaponpov, GetThingLVec(weappos));
	SetThingPos(weaponpov, GetThingPos(weappos));
	// [/Seifer's Waggle Code]

Return;
# .......................................................................
user0:
	waggle = 0;
	if(resetwaggle)   //if we want to recenter the weapon when waggle is stopped by weapon cog
	{
		direction = 0;
		y_vec = 0;
	}

Return;
# .......................................................................
user1:
	waggle = 1;

Return;
# .......................................................................
end


[This message has been edited by Darth Slaw (edited August 20, 2004).]
May the mass times acceleration be with you.

↑ Up to the top!