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 → Sabers again...
Sabers again...
2003-08-09, 8:03 AM #1
Code:
user0:

   if(!Staff)      //Going to be a Lightstaff.
   {
      ParseArg(getlocalplayerthing(), "puppet=lsky.pup");      // Change the puppet for the lightstaff one
      jkSetFlags(player, 0x10);      //Set the second blade to come out.
      PlaySoundThing(mountSound, player, 1.0, -1, -1, 0x80);      //Play another ignition sound.
      // SetThingModel(getlocalplayerthing(), dualmodel);

      //Now, don't let it shrink already! So, give it a wait.
      SetBinWait(player, 116, GetSoundLen(mountSound));
   }
   else      //Back to saber.
   {
      ParseArg(getlocalplayerthing(), "ky.pup");      // Change the puppet bak to the original
      jkClearFlags(player, 0x10);      // If going back to saber clear the second blade.
      PlaySoundThing(dismountSound, player, 1.0, -1, -1, 0x80);      //Play shrinking sound.
      // Setthingmodel(GetLocalPlayerThing(), playermodel);
      SetBinWait(player, 116, GetSoundLen(dismountSound));      //And give it a wait.
   }

   staff = 1 - staff;      //Change variable, so the cog knows if it's staff or saber at the moment.
   // ---------------------------------------------------------------------
   if(!dsaber)     //Going to be dual sabers
   {
      ParseArg(getlocalplayerthing(), "puppet=dsky.pup");
      jkSetFlags(player, 0x10);      //Set the second saber.
      PlaySoundThing(mountSound, player, 1.0, -1, -1, 0x80);      //Play another ignition sound.
      // SetThingModel(getlocalplayerthing(), dualmodel);

      //Now, don't let it shrink already! So, give it a wait.
      SetBinWait(player, 116, GetSoundLen(mountSound));
   }
   else      //Back to single saber.
   {
      ParseArg(player, "ky.pup");      // Change the puppet bak to the original
      jkClearFlags(player, 0x10);      // If going back to saber clear the second blade.
      PlaySoundThing(dismountSound, player, 1.0, -1, -1, 0x80);      //Play shrinking sound.
      // Setthingmodel(GetLocalPlayerThing(), playermodel);
      SetBinWait(player, 116, GetSoundLen(dismountSound));      //And give it a wait.
   }

   dsaber = 1 - dsaber;      //Change variable, so the cog knows if it's single or dual sabers at the moment.


Ok, I have this in the weap_saber.cog and I'm going to make 2 hotkeys to call the two different conditions(?) (like the lightstaff mod if I didn't explain that too well). I want it to put the staff away before it selects the dual sabers and vice versa, but how would I get it to do that?
Would it be better if I just put the dual saber part in say, a user1 message?

------------------
Look for my current project, The Force in Your Soul.
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 "S-TROOPER WUZ 'ERE!!!"
2003-08-09, 8:58 AM #2
Since you plan to have two hotkeys, two messages in your weap_saber would be much better. I'd suggest something like this:

Code:
#------------------------------------------------------
user0:
	// user presses the lightstaff hotkey.
	// if enabled, disable - go back to saber.
	// else, give us the lightstaff.

	// if we have the saber, give us the staff.
	if(saber_mode == 0)
	{
		// give us the lightstaff puppet.
		ParseArg(player, "puppet=lsky.pup");
		call enable_second;
		saber_mode = 1;
	}
	// else if we do have the staff, go back to the saber.
	else if(saber_mode == 1)
	{
		call disable_second;
		saber_mode = 0;
	}

Return;
#------------------------------------------------------
user1:
	// user presses the dual saber hotkey.
	// if he has anything else, give him the dual sabers.
	// else if he has the dual sabers, take them away.

	// if we have the saber, give us the dsabers.
	if(saber_mode == 0)
	{
		// give the player the dsaber puppet.
		ParseArg(player, "puppet=dsky.pup");
		call enable_second;
		saber_mode = 2;
	}
	// else if we do have the dsabers, go back to the saber.
	else if(saber_mode == 2)
	{
		call disable_second;
		saber_mode = 0;
	}

Return;
#------------------------------------------------------
enable_second:
	// enable a second saber.
	jkSetFlags(player, 0x10);
	// play a sound for the second blade.
	PlaySoundThing(mountsound, player, 1.0, -1, -1, 0x80);
	// use a new bin for a saber mount wait (?)
	SetBinWait(player, 116, GetSoundLen(mountsound));

Return;
#------------------------------------------------------
disable_second:
	// get rid of the second blade.
	jkClearFlags(player, 0x10);
	// play the shrinking sound.
	PlaySoundThing(dismountsound, player, 1.0, -1, -1, 0x80);
	// use a new bin for a saber mount wait (?)
	SetBinWait(player, 116, GetSoundLen(dismountsound));
	// back to the original puppet.
	ParseArg(player, "ky.pup");

Return;
#------------------------------------------------------


I don't see why you have bin 116 used as some sort of mount wait. A timer in weap_saber would be far better.

------------------
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2003-08-09, 9:29 AM #3
Thanks, I'll try the way you suggested, The way's I've tried have ended up in either not selecting the saber, or crashing the game.

Oh, and using bin 116 as a wait was how the lightstaff mod had it, and I based this cog heavily off of that. I do plan to change it, along with a few other things after I get it working.

------------------
Look for my current project, The Force in Your Soul.
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 "S-TROOPER WUZ 'ERE!!!"
2003-08-09, 9:56 AM #4
Ok, that way almost works, the same thing happened with some of my tries, I select the saber and press the lightstaff hotkey, it changes the puppet and sets the second blade, when I press it again it takes it away and changes the puppet back to ky.pup, just like it's supposed to, but if I press the dual sabers hotkey after putting the light staff away, it crashes. And the same goes for the other way, if I press the dual saber hotkey first, it does what it's supposed to, then I press the hotkey again to put it away, then I press the lightstaff hotkey and it crashes, any ideas?

[EDIT]Just a thought, could the problem be with using bin 116 as a wait? And how would I set up a timer for the wait instead? Thanks[/EDIT]

------------------
Look for my current project, The Force in Your Soul.
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 "S-TROOPER WUZ 'ERE!!!"

[This message has been edited by Stormtrooper (edited August 09, 2003).]
2003-08-09, 2:28 PM #5
I don't think any part of the code you've posted can crash JK. Can you post the hotkey cogs?

------------------
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2003-08-09, 4:46 PM #6
Here's one:
Code:
symbols
message		activated
end

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

code
activated:
if(GetCurWeapon(GetSourceRef()) == 10)
	SendMessage(GetInvCog(GetSourceRef(), 10), user0);
return;
end

and the other one is exatly the same except it says user1 instead of user0.

------------------
Look for my current project, The Force in Your Soul.
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 "S-TROOPER WUZ 'ERE!!!"
2003-08-10, 7:45 AM #7
I don't see anything there that checks bin 116 to make sure the wait's over. But nevermind that, just send me the patch so I can fix it. [http://forums.massassi.net/html/wink.gif]

email to danadf@earthlink.net.

------------------
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2003-08-10, 9:51 AM #8
I'm moments away from clicking the send button and just so you know, it can only work with ky.3do so far. I know you'd figure it out after you took a look at it, but I just wanted you to know beforehand.

Like I said before, I pretty much copied how it was done in the LightStaff 2 mod, so that's why it has the bin 116 as a wait.

Again, Thanks for all the help. The e-mail will be from jeditrooper87@hotmail.com.

[Edit]Gahh, I accidentally sent the gob instead of the zip file, It shouldn't make a difference though, just a little bit bigger filesize, sorry. [http://forums.massassi.net/html/redface.gif][/EDIT]

------------------
Look for my current project, The Force in Your Soul.
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 "S-TROOPER WUZ 'ERE!!!"

[This message has been edited by Stormtrooper (edited August 10, 2003).]
2003-08-10, 5:36 PM #9
Define your puppets in the static.jkl and the crashing will go away. [http://forums.massassi.net/html/wink.gif]

I have to say that's a good idea for a sabers mod, I hope you put some effort into the dsaber animations. And as for the binwaits, they're alright - I'd use timers, but binwaits will work just as well.

------------------
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.

[This message has been edited by SaberMaster (edited August 10, 2003).]
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2003-08-11, 3:45 AM #10
Thank you, I've been working on the animations for the dsabers for a few days now, but they still need quite a lot of work, thanks for the compliment though. [http://forums.massassi.net/html/smile.gif]

------------------
Look for my current project, The Force in Your Soul.
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 "S-TROOPER WUZ 'ERE!!!"

↑ Up to the top!