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 → Saber Throw in JK.......
Saber Throw in JK.......
2002-11-16, 4:14 PM #1
Now since I'm still new to cogging, this seems to be a little out of my knowledge, so how would I make a seber throw cog for SP, I need it to be activated by a hotkey(like a force-power without overwriting an existing one) and you have to have the saber out to use it. I'll take care of the 3do's and other miscellaneous things.

If you can help me, thanks, if you can't, thanks for reading my post.....

------------------
Last week I cudn't evn spel grajuat, but now I is one.

*Takes out his blaster and fires shots at the wall, the blastmarks leave the words "STROOPER WUZ 'ERE!!!"
2002-11-17, 4:27 AM #2
As for the new force power, edit the items.dat, and add a new bin entry.
Cordially,
Lord Tiberius Grismath
1473 for '1337' posts.
2002-11-17, 4:55 PM #3
Thanks, but does anyone know how to make he cog, or explain to me how to make it?

------------------
Last week I cudn't evn spel grajuat, but now I is one.

*Takes out his blaster and fires shots at the wall, the blastmarks leave the words "STROOPER WUZ 'ERE!!!"
2002-11-18, 4:08 AM #4
The easiest way to go about this would be to take a look at the cogs in MotS that pretain to the saber throw.

Their are cog changes in weap_saber_m.cog kyle_m.cog and of course there's force_saberthrow.cog to look at. As well as having a bin for the saberthrow cog itself, I believe MotS used an additional bin as a marker for if the saber was being drawn or not to prevent throwing the saber before it was properly mounted. So you will need to bins. You will also need to add the thrown saber templates for the projectile. They will not work in multiplayer without the addition of a trigger system.

Also keep in mind that the verb getsabersidemat() doesn't exist in JK, so as far as I know there is no way to make the color of the thrown saber match yours.
2002-11-18, 12:42 PM #5
Well, considering that my saber is a glowsaber I wouldn't need to have the getsabersidemat() verb.

Thanks, I'll look at the MotS cogs and base mine off of them.

------------------
Last week I cudn't evn spel grajuat, but now I is one.

*Takes out his blaster and fires shots at the wall, the blastmarks leave the words "STROOPER WUZ 'ERE!!!"
2002-11-18, 3:54 PM #6
Ok, a bit of an updae here, I've got the cog made, but it won't throw the saber, can anyone else see if anything is wrong with it?
Code:
symbols
thing        player                             local                         

flex         cost=50.0                          local                         
int          rank=0                             local                         
flex         mana                               local                         

sound        throwSound=Score1.wav          local                         

int          saber                              local                         
int          saberIndex                         local                         

template     lightsaber=+force_saber            local                         

flex         autoAimFOV=10                      local                         

message      startup                                                          
message      shutdown                                                         
message      activated                                                        
message      timer                                                            
message      newplayer                                                        
message      killed                                                           
message      selected                                                         

end                                                                           

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

code

# ========================================================================================
Shutdown:
	call stop_force;

	Return;
# ========================================================================================

activated:

	//makes sure if the saber is not the current weapon..
	if(GetCurWeapon(player) !=11) Return;

	//if the saber is being drawn at this point
	if(SetInv(player, 89) ==1) Return;

	rank = GetInv(player, 25);

	if(rank == 1) cost=100;
	else if(rank == 2) cost = 80;
	else if(rank == 3) cost = 60;
	else if(rank == 4) cost = 40;

	if(GetInv(player, 14) < cost && GetInv(player, 14) < GetInv(player, 14)) Return;

	if(!IsInvActivated(player, 116))
	{
		SetInvActivated(player, 116, 1);

		SetInv(player, 10, 0);

		SetFireWait(player, -1);
		SetMountWait(player, 0);
		SetCurInvWeapon(player, 1);

		SendMessage(GetInvCog(player, 10), user0);

		if(getInv(player, 64) !=1) ChangeInv(player, 14, -cost);

	FireProjectile(player, lightsaber[saberIndex], saberSound, 24, 1.0, 0, autoAimFOV, autoAimFOV);

	SetTimerEx(5, 2, 0, 0);

	SetBinWait(player, 116, 5.5);
   }

	Return;

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

timer:
   if(GetSenderId() == 1) SetInv(player, 10, 1);

   call stop_force;

   Return;

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

selected:
   jkPrintUNIString(player, 116);
   Return;

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

killed:
   if(GetSenderRef() != player) Return;

newplayer:
   call stop_force;
   Return;

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

stop_force:
   SetInvActivated(player, 116, 0);

   Return;


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

end


I also have this "f_saberthrow 116 4.0 4.0 0x108 cog=saberthrow.cog" right after force absorb in the Items.dat and I do have it defined in the jkstrings.uni as "ACTIVATE17" 0 "Saber Throw"
I can't figure out where I went wrong, I've looked over the cog quite a few times and can't find anything wrong, and the syntax checker comes up clean.

[EDIT]I did base this off of the saber throw cog from MotS, if that helps any[/EDIT]

------------------
Last week I cudn't evn spel grajuat, but now I is one.

*Takes out his blaster and fires shots at the wall, the blastmarks leave the words "STROOPER WUZ 'ERE!!!"

[This message has been edited by Stormtrooper (edited November 18, 2002).]

[This message has been edited by Stormtrooper (edited November 19, 2002).]
2002-11-19, 6:05 AM #7
I'm assuming the selected message comes up when you press the hotkey, which would confirm that they hotkey and cog are working properly?

That aside, make sure you have the thrownsaber template is defined in static.jkl (you may have already done this) because that is not a template that is available in JK by default.

Then, remove that [saberindex] part in the fireprojectile line. Thats a hold over from the array of different sabers that was used in MotS to determine the saber color. Since the array isn't there anymore, and saberindex is never defined that is most likely causing the problem.
2002-11-19, 12:29 PM #8
Quote:
<font face="Verdana, Arial" size="2">Originally posted by Wave_Of_Mutilation:
I'm assuming the selected message comes up when you press the hotkey, which would confirm that they hotkey and cog are working properly?</font>


Nope, nothing comes up at all, it doesn't say anything.

Quote:
<font face="Verdana, Arial" size="2">
That aside, make sure you have the thrownsaber template is defined in static.jkl (you may have already done this) because that is not a template that is available in JK by default.</font>

Yep, I've done that, except it's in the master.tpl cause I'm doin it for a level I'm making, and I've checked that it's in the levels JKL and it's there too.

Quote:
<font face="Verdana, Arial" size="2">
Then, remove that [saberindex] part in the fireprojectile line. Thats a hold over from the array of different sabers that was used in MotS to determine the saber color. Since the array isn't there anymore, and saberindex is never defined that is most likely causing the problem.</font>


Ok, I'll try that and see if it works.

------------------
Last week I cudn't evn spel grajuat, but now I is one.

*Takes out his blaster and fires shots at the wall, the blastmarks leave the words "STROOPER WUZ 'ERE!!!"
2002-11-19, 5:19 PM #9
I think the easiest way to make a saber throw is to make a keyframe of the player throwing it but that would kinda be copying SBX, but it still would be alot faster and easier.

[This message has been edited by Ace1 (edited November 19, 2002).]
I am _ Ace_1 _ , and I approve this message.
2002-11-21, 1:39 PM #10
Quote:
<font face="Verdana, Arial" size="2">Originally posted by Stormtrooper:
Nope, nothing comes up at all, it doesn't say anything.

</font>


If nothing comes up in the selected message, then the problem most likely is that the cog isn't 'linked' correctly to the hotkey. That's assuming it passes the syntax checker, and I think I remember you saying it did. So I'd check the items.dat and jkstring.uni and make sure thats all a ok first.

I fail to see how it would be possible to accomplish this through the use of keys only. Keys are animation files, they do not have the capacity to create projectiles. Unless there's something I'm missing, I'm not very experienced with keying myself.
2002-11-21, 2:37 PM #11
Ok, here's the deal... I didn't have it defined in the jkstrings.ui, but it still didn't show in the menu so I renamed it to force_absorb.cog and it comes up as Force Saber Throw when I select it by pressing the cycle force buttons, but it still won't respond to the hotkey. I also added "Print("Checking to see if it even activates");" after activated and "Print("checking to see if activation occurs");" under selection and it prints when I select in through the cycle force buttons and when I press enter it says "Checking to see if it even activates" but that's all it does. nothing else.......

Here's a slightly updated cog.
Code:
symbols
thing        player                             local                         

flex         cost=50.0                          local                         
int          rank=0                             local                         
flex         mana                               local                         

sound        throwSound=Score1.wav          local                         

int          saber                              local                         

template     lightsaber=+force_saber            local                         

flex         autoAimFOV=10                      local                         

message      startup                                                          
message      shutdown                                                         
message      activated                                                        
message      timer                                                            
message      newplayer                                                        
message      killed                                                           
message      selected                                                         

end                                                                           

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

code

# ========================================================================================
Shutdown:
	call stop_force;

	Return;
# ========================================================================================

activated:

	Print("Checking to see if it even activates");
	//makes sure if the saber is not the current weapon..
	if(GetCurWeapon(player) !=11) Return;

	//if the saber is being drawn at this point
	if(SetInv(player, 89) ==1) Return;

	rank = GetInv(player, 35);

	if(GetInv(player, 65) < cost && GetInv(player, 14) < GetInv(player, 65)) Return;

	if(!IsInvActivated(player, 35))
	{
		SetInvActivated(player, 35, 1);

		SetInv(player, 10, 0);

		SetFireWait(player, -1);
		SetMountWait(player, 0);
		SetCurInvWeapon(player, 1);

		SendMessage(GetInvCog(player, 10), user0);

		if(getInv(player, 64) !=1) ChangeInv(player, 14, -cost);

	FireProjectile(player, lightsaber, throwSound, 24, '0 0 0', '0 0 0', 1.0, 0, autoAimFOV, autoAimFOV);

	SetTimerEx(5, 2, 0, 0);

	SetBinWait(player, 35, 5.5);
   }

	Return;

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

timer:
   if(GetSenderId() == 1) SetInv(player, 10, 1);

   call stop_force;

   Return;

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

selected:
   Print("checking to see if activation occurs");
   jkPrintUNIString(player, 35);
   Return;

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

killed:
   if(GetSenderRef() != player) Return;

newplayer:
   call stop_force;
   Return;

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

stop_force:
   SetInvActivated(player, 35, 0);

   Return;


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

end


------------------
Last week I cudn't evn spel grajuat, but now I is one.

*Takes out his blaster and fires shots at the wall, the blastmarks leave the words "STROOPER WUZ 'ERE!!!"
2002-11-22, 5:09 AM #12
Doh, I'm surprised I didn't see this before.

if(GetCurWeapon(player) !=11) Return;

I don't think weapon 11 even exists in JK, therefore it would be quite impossible to have it out. The saber is 10 in JK I think.

Also, bin 35 I think was a MotS force power bin, that should be changed to whatever it needs to me.

Did you add bin 89 (the saber mounting check bin) to items.dat and the relevent messages in kyle.cog and weap_saber.cog?
2002-11-23, 10:17 AM #13
The Jk items.dat didn't have a bin 35 so I just added it after the force absorb power bin. This is what I have in the items.dat
Code:
# Light Side Powers
f_healing               25              0       4.0     0x108    cog=force_heal.cog
f_persuasion            26              0       4.0     0x108    cog=force_persuasion.cog
f_blinding              27              0       4.0     0x108    cog=force_blinding.cog
f_absorb                28              0       4.0     0x118    cog=force_absorb.cog
f_saberthrow            35              0       4.0     0x108    cog=force_saberthrow.cog


So I should change "if(GetCurWeapon(player) !=11) Return;" to "if(GetCurWeapon(player) !=10) Return;" right?

I did make sure that the kyle.cog and the weap_saber.cog did have the needed code.

------------------
Last week I cudn't evn spel grajuat, but now I is one.

*Takes out his blaster and fires shots at the wall, the blastmarks leave the words "STROOPER WUZ 'ERE!!!"

[This message has been edited by Stormtrooper (edited November 23, 2002).]
2002-11-23, 10:24 AM #14
I also just noticed that when I press the key I have bound to force saber throw, the fieldlight activates.... [http://forums.massassi.net/html/confused.gif] I can't figure out why it's doing this..... maybe it has something to do with the cog or the items.dat?

[EDIT]Oh, and when I select force absorb (after I renamed the force saber throw cog to force_absorb.cog) and press the activate force button, it throws the saber!!! w00t!!!!! I just have to make the return saber cog. but it still won't respond the the hotkey.[/EDIT]
------------------
Last week I cudn't evn spel grajuat, but now I is one.

*Takes out his blaster and fires shots at the wall, the blastmarks leave the words "STROOPER WUZ 'ERE!!!"

[This message has been edited by Stormtrooper (edited November 23, 2002).]
2002-11-24, 11:22 AM #15
You are missing a relevent entry in jkstrings.uni most likely. If you add a bin 35 that can accept a hotkey binding then everything will be moved up and it will screw up the order.

↑ Up to the top!