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 → Cog Request
Cog Request
2002-08-15, 10:02 AM #1
While working on my current mod, Lotus, I realized that the standard JK weapon system is useless for me. You see, this mod is very much quest based, so there are many more than 10 weapons. My thought was to have something similar to MotS, where you would press the 2 key to cycle through all the daggers in your inventory, the 3 key for all the swords in your inventory. If all together there are 6 catagories (1=fists, 2=daggers, 3=swords, 4=axes, 5=ranged, 6=unique), how would I set that up (Please keep in mind that I have very little cog understanding/experience)?


------------------
SuperS51's Editing Corner

"Just because you're paranoid doesn't mean they're not out to get you."
2002-08-16, 11:44 AM #2
Here's a part of a cog that has rotating charges.
Code:
# Jedi Knight Missions Cog Script
#
# WEAP_CHARGES.COG
#
# WEAPON 8 Script - Rotating Charges
#
# Heartier than the Thermals and the DF IM Mines these are used by placing them on
# the ground or on walls.  Have three different types here, timed, proxy, and trip wire.
# Let weap_manseq_m handle one type, remote.
#
# - Not affected by MagSealed sectors/surfaces.
#
# [YB & CYW] + [RF] + [DP]
#
# ========================================================================================

symbols

model       povModel=seqb.3do             local
model       povModel1=seqb.3do            local
model       povModel2=seqb.3do            local
model       weaponMesh=seqg.3do           local
model       weaponMesh1=seqg.3do          local
model       weaponMesh2=seqg.3do          local

# Animations that deal with bringing stuff up
keyframe    mountAnim=SeqBmntr.key        local


# Animations that deal with bringing stuff down
keyframe    dismountAnim=SeqbDisr.key     local

# Charge laying animations
keyframe    povFireAnim=SeqBpstR.key      local
keyframe    povFire2Anim=SeqBpstR.key     local


flex        mountWait                     local
flex        fireWait=0.8                  local
flex        holsterWait                   local

template    projectile_tpl=+timed         local
template    projectile_tpl1=+proxy        local
template    projectile_tpl2=+trip_wire    local

template		projectileB=+dudseqchrg			local

keyframe    holsterAnim=kyhlstr.key       local


	# The next 10 items actually function
	# as an array of lain projectiles.
int         projectile                    local

int         iCounter                      local
material    flashing=seq0mtp3.mat         local
int         cel                           local
int         mode                          local

thing       player                        local
int         trackID=-1                    local
int         holsterTrack                  local

int         selectMode=1                  local
int         type=0                        local

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

end

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

code

startup:
   // Setup delays and variables.
   mountWait    = GetKeyLen(mountAnim);

   // Start the material flashing.
   MaterialAnim( flashing, 4, 1 );

   Return;

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

fire:
   player = GetSourceRef();
   mode = GetSenderRef();

   // Check that the player is still alive.
   if(GetThingHealth(player) <= 0)
   {
      Return;
   }

      If(mode == 1)
      {
         Call rotate;
         Return;
      }
	SendMessageEx(GetThingClassCog(GetLocalPlayerThing()), user1, 3, 0, 0, 0);

	if (GetInv(player, 93) > 0.0)
		projectile = FireProjectile(player, projectileB, -1, 16, '0 0.05 0.00', '0 0 0', 1.0, 0, 0.0, 0.0);
	else
		projectile = FireProjectile(player, projectile_tpl[type], -1, 16, '0 0.05 0.00', '0 0 0', 1.0, 0, 0.0, 0.0);

	if (GetSenderID() == 2)
	{
		StopKey(player, holsterTrack, 0.0);
	}
	else
   jkPlayPOVKey(player, povfireAnim, 1, 0x38);

   ChangeInv(player, 5[type], -1.0);
   ChangeInv(player, 128, -1.0);

	// If out of ammo try to autoswitch to another weapon
	// if autoswitch is enabled else just switch to fists.
	if(GetInv(player, GetWeaponBin(8)) < 1)
	{
			// If the manual sequencer has no charges down and we are out of
			// charges, do not allow it to be selected.
		if (GetInv(player, GetWeaponBin(18)) == 1.0)
			SetInv(player, GetWeaponBin(18), 0.0);

		if(GetAutoSwitch() & 1)
		{
         SelectWeapon(player, GetWeaponBin(AutoSelectWeapon(player, 1)));
		}
		else
		{
			SelectWeapon(player, 1);
		}
	}

   Return;

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

activated:
   player = GetSourceRef();
   mode = GetSenderRef();

	if (GetInv(player, 93) > 0.0)
		SendMessageEx(GetThingClassCog(player), skill, 1100, 0, 0, 0);

   if(mode > 1) Return;

	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();

	jkPrintUNIString(player, 390[type]);

   PlayMode(player, 40);
   jkSetPOVModel(player, povModel[type]);
   SetArmedMode(player, 0);
   jkSetWeaponMesh(player, weaponMesh[type]);
   trackID = jkPlayPOVKey(player, mountAnim, 0, 20);

   jkSetWaggle(player, '10.0 7.0 0.0', 350);

   SetMountWait(player, GetKeyLen(mountAnim));
   jkClearFlags(player, 0x5);
   SetCurWeapon(player, GetWeaponBin(8));

   Return;

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

deselected:
   player = GetSourceRef();

   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:
   selectMode = GetSenderRef();
   player = GetSourceRef();

   // If the player has ammo
   if(GetInv(player, GetWeaponBin(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:
	if (GetSenderID() == 2)
	{
		StopKey(player, holsterTrack, 0.0);
	}

   Return;

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

Rotate:

   // Handles the Rotation
   type = type + 1;
   If(type == 3) type = 0;
   disID = jkPlayPOVKey(player, dismountAnim, 0, 18);
   holsterWait = GetKeyLen(holsterAnim);
   SetMountWait(player, holsterWait);
   holsterTrack = PlayKey(player, holsterAnim, 1, 0x4);
   If (trackID != -1)
   {
      jkStopPOVKey(player, trackID, 0);
      trackID = -1;
   }
   SetInv(Player, 128[type], GetInv(player, 5[type]));
   jkSetWaggle(player, '0.0 0.0 0.0', 0);

   Sleep(.25);

   jkPrintUNIString(player, 390[type]);
   StopKey(player, holsterTrack, 0);
   PlayMode(player, 40);
   jkStopPOVKey(player, disID, 0);
   jkSetWeaponMesh(player, weaponMesh);
   trackID = jkPlayPOVKey(player, mountAnim, 0, 20);
   jkSetWaggle(player, '10.0 7.0 0.0', 350);
   SetMountWait(player, GetKeyLen(mountAnim));
   Return;

end
This is configured for MotS Sequence Charges. Any questions, just ask. [http://forums.massassi.net/html/wink.gif]

------------------
The Sniper Missions. Current project, The Sniper Missions

The Magician Saber System.

[This message has been edited by Descent_pilot (edited August 16, 2002).]
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2002-08-16, 11:55 AM #3
If your could somehow make that cog for the lightsaber, that would be absolutely perfect. Sorry to ask this of you, but I'm not capable of doing it myself.
2002-08-16, 12:26 PM #4
Change the seconday fire to go to Rotate message, and have the selected spit out the correct name and model and you have winner. You have to get rid of the changing bins in Rotate, PlayMode(player, 42); (40 to 42) in there too. You also have to add Strings and change the print number to the correct numbers, and change the max 'type' to however many. You should be able to do it if you follow my directions. If you get confused with any of them, just ask. [http://forums.massassi.net/html/wink.gif]

------------------
The Sniper Missions. Current project, The Sniper Missions

The Magician Saber System.
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2002-08-17, 11:08 AM #5
Ach, I wanted to do that for RoX, too, so if this is resolved, could I use the source for the final version of Super's cog as a reference?
Cordially,
Lord Tiberius Grismath
1473 for '1337' posts.
2002-08-17, 1:46 PM #6
So far, the modified version I made of the above cog works for weap_saber based weapons (life all of the ones in my mod). As far as I'm concerned Grismath, you're welcome to use the cog when I get it working well. I'll even e-mail you a copy of it.
2002-08-18, 4:23 AM #7
Sure go ahead, give me credit, both of you. [http://forums.massassi.net/html/wink.gif]

------------------
The Sniper Missions. Current project, The Sniper Missions

The Magician Saber System.
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2002-08-19, 1:27 PM #8
Here are the beginnings of an old cog that I started for this purpose (there are probably several errors thus far, not to mention its incompleteness). I haven't yet looked at this.

Code:
# Rites of Xanthus TC Cog Script
#
# WEAPLIST.COG
# 5.25.02
# -by Lord_Grismath (GrismathDynasty@Hotmail.com)
#
# Description
# 
#   This allows the player to have a theoretically
# limitless number of weapons (bins permitting)
# and not governed by the default weapon slots.
#
# WORK IN PROGRESS
#
# 	SendMessage(converse01_cog, user0);
#
# This Cog is Not supported by LucasArts Entertainment Co

symbols

message	startup
message	playeraction

int		input=-1	local

cog		weap_saber_m_cog=0

end

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

code

startup:

	SetActionCog(GetSelfCog(), 0x80);
	input=0;

return;


playeraction:

if(GetParam(0) == 7.0) {
	if(input == -1) {
		if(GetParam(2) == 13.0)
		{
			input=1;
			print("Unarmed");
			// Unarmed
		}
		if(GetParam(2) == 14.0)
		{
			input=2;
			print("Daggers");
			// Daggers
		}

		if(GetParam(2) == 15.0)
		{
			input=3;
			print("Swords");
			// Swords
		}

		if(GetParam(2) == 16.0)
		{
			input=4;
			print("Bludgeons");
			// Bludgeons
		}

		if(GetParam(2) == 17.0)
		{
			input=5;
			print("Ranged Weapons");
			// Ranged Weapons
		}
		if(GetParam(2) == 18.0)
		{
			input=6;
			print("Heavy Weapons");
			// Heavy Weapons
		}
		if(GetParam(2) == 19.0)
		{
			input=7;
			print("Staves");
			// Staves
		}
		if(GetParam(2) == 20.0)
		{
			input=8;
			print("Mystic Weapons");
			// Mystic Weapons
		}
		if(GetParam(2) == 21.0)
		{
			input=9;
			print("Tools");
			// Tools
		}
		if(GetParam(2) == 22.0)
		{
			input=0;
			print("Miscellaneous");
			// Miscellaneous
		}
	} if(input == 1) {
			if(GetParam(2) == 13.0)
		{
			input=-1;
			print("Bare Fists");
			// Bare Fists
		}
		if(GetParam(2) == 14.0)
		{
			input=-1;
			print("Gauntlets");
			// Gauntlets
		}
	}	
	} if(input == 2) {
			if(GetParam(2) == 13.0)
		{
			input=-1;
			print("Knife");
			SendMessage(weap_saber_m_cog, selected);
			// Knife
		}
		if(GetParam(2) == 14.0)
		{
			input=-1;
			print("Poinard");
			// Poniard
		}
}
	
	ReturnEx(0.0);
	Return;

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


end
Cordially,
Lord Tiberius Grismath
1473 for '1337' posts.
2002-08-19, 5:50 PM #9
Here's how I'd do it. [http://forums.massassi.net/html/wink.gif]
Code:
# Rites of Xanthus TC Cog Script
#
# WEAPLIST.COG
# 5.25.02
# -by Lord_Grismath + [DP](GrismathDynasty@Hotmail.com)
#
# Description
# 
#   This allows the player to have a theoretically
# limitless number of weapons
# and not governed by the default weapon slots.
#
# WORK IN PROGRESS
#
# 	SendMessage(converse01_cog, user0);
#
# This Cog is Not supported by LucasArts Entertainment Co

symbols

message		startup
message		playeraction

Int		input=-1	local
Thing		player		local

end

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

code

Startup:
	Sleep(.25);	// Safeguard, do not remove
	SetActionCog(GetSelfCog(), 0x80);
	input = GetCurrentWeapon(player) % 10;
	// % = remainder, so if it's say weap 12, its returns as 2
	// Can be removed to allow the rest of the weapons
	Return;


PlayerAction:

If(GetParam(0) == 7.0) {
	If(input == -1) {
		If(GetParam(2) == 13.0)
		{
			input=1;
			print("Unarmed");
			// Unarmed
		}
		If(GetParam(2) == 14.0)
		{
			input=2;
			print("Daggers");
			// Daggers
		}

		If(GetParam(2) == 15.0)
		{
			input=3;
			print("Swords");
			// Swords
		}
		If(GetParam(2) == 16.0)
		{
			input=4;
			print("Bludgeons");
			// Bludgeons
		}
		If(GetParam(2) == 17.0)
		{
			input=5;
			print("Ranged Weapons");
			// Ranged Weapons
		}
		If(GetParam(2) == 18.0)
		{
			input=6;
			print("Heavy Weapons");
			// Heavy Weapons
		}
		If(GetParam(2) == 19.0)
		{
			input=7;
			print("Staves");
			// Staves
		}
		If(GetParam(2) == 20.0)
		{
			input=8;
			print("Mystic Weapons");
			// Mystic Weapons
		}
		If(GetParam(2) == 21.0)
		{
			input=9;
			print("Tools");
			// Tools
		}
		If(GetParam(2) == 22.0)
		{
			input=0;
			print("Miscellaneous");
			// Miscellaneous
		}
	} Else If(input == 1) {
		SelectWeapon(player, 2);
		input = GetParam(2) - 13;
		If(GetParam(2) == 13.0)
		{
			SendMessageEx(GetInvCog(player, 1), user0, input, 0, 0, 0);
			print("Bare Fists");
			// Bare Fists
		}
		If(GetParam(2) == 14.0)
		{
			SendMessageEx(GetInvCog(player, 1), user0, input, 0, 0, 0);
			print("Gauntlets");
			// Gauntlets
		}
		input=-1;
	} Else If(input == 2) {
		SelectWeapon(player, 2);
		input = GetParam(2) - 13;
		If(GetParam(2) == 13.0)
		{
			SendMessageEx(GetInvCog(player, 2), user0, input, 0, 0, 0);
			print("Knife");
			// Knife
		}
		If(GetParam(2) == 14.0)
		{
			SendMessageEx(GetInvCog(player, 2), user0, input, 0, 0, 0);
			print("Poinard");
			// Poniard
		}
		input=-1;
		// Copy and paste with small changes for the rest.
	}
}
	
	ReturnEx(0);
	Return;

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


end

Final things to do, change the Rotate message to User0 (or any other user if need be). Add this line right after User0: 'type = GetParam(0);' w/o quotes. You can have secondary attack instead of a rotation. Any questions, just ask.

BTW - Can I use this for Operation Extreme (I like to plan ahead. It's a good thing to do. BTW - OE is MotS, not JK like TSM, TWW, and TXP. Go to my (incomplete) site for more details. [http://forums.massassi.net/html/wink.gif] )? Your already giving me credit. Problems solved. (I guess *shurgs* )

edit - why should you use SendMessageEx you say?, So you only have to use 10 weapon cogs with only user0s. But then agian your's was incomplete. [http://forums.massassi.net/html/wink.gif]

edit - small mistakes, now it will work. [http://forums.massassi.net/html/redface.gif]

------------------
The Sniper Missions. Current project, The Sniper Missions

The Magician Saber System.

[This message has been edited by Descent_pilot (edited August 22, 2002).]
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2002-08-21, 1:44 PM #10
Good work on the update/editation.
Cordially,
Lord Tiberius Grismath
1473 for '1337' posts.
2002-08-21, 7:53 PM #11
So, can I use it?

------------------
The Sniper Missions. Current project, The Sniper Missions

The Magician Saber System.
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2002-08-22, 3:01 AM #12
Yeah, sure.
Cordially,
Lord Tiberius Grismath
1473 for '1337' posts.
2002-08-22, 4:03 AM #13
Thank you. *bow humbuly* You idea, so if I did something very similar, copyright entrenchment. (kinda) [http://forums.massassi.net/html/wink.gif]

------------------
The Sniper Missions. Current project, The Sniper Missions

The Magician Saber System.
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2002-08-22, 2:39 PM #14
enfringement, but whatever.
Cordially,
Lord Tiberius Grismath
1473 for '1337' posts.

↑ Up to the top!