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 → Combining two weapons in one cog/hotkey
Combining two weapons in one cog/hotkey
2002-12-01, 12:14 AM #1
I don't know where to start. What I wanna do is have two weapons as weapon number one. The user can press a hotkey to switch between them. What would even be better was adding a weapon to the existing 10, but I suppose that can't be done...

------------------
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2002-12-01, 5:55 AM #2
It can be done, I've done it before in fact. But the code will be a little messy since you are writing two weapon cogs in one file. But extensive comments and a little attention to detail it wasn't too hard.
2002-12-01, 6:05 AM #3
This was talked about a few months ago, so I think its possible, but just an idea, instead of having just one cog, couldn't you make two weapon cogs and have one call the other when the hotkey is pressed?

Just an idea.

------------------
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-12-01, 6:30 AM #4
I know that it can be done. What I'm interested in is HOW it is done...

------------------
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2002-12-01, 9:47 AM #5
Code:
 Selected:
gun = GetInv(gunbin);
if(gun == 1)
{
   gun select stuff for gun 1;
}
else if(gun == 2)
{
   gun select stuff for gun 2;
}
Return
#-----------------------------------
Activated:
gun = GetInv(gunbin);
if(gun == 1)
{
   gun activate stuff for gun 1;
}
else if(gun == 2)
{
   gun activate stuff for gun 2;
}
Return; 


Something like that.

Two guns in one cog has been around for a long time, I think it has been done in SS3 Beta 9 with shotguns.

[This message has been edited by Ace1 (edited December 01, 2002).]
I am _ Ace_1 _ , and I approve this message.
2002-12-02, 4:00 AM #6
I should think it could be done in the weapon COG's selected message, rather than with a hotkey. Just check to see which weapon it is, and select the other weapon. I'd write up some code, but I'm at work at the moment.

------------------
His pot is blacker than his kettle!

Phoenix Swords
"And lo, let us open up into the holy book of Proxy2..." -genk
His pot is blacker than his kettle!
2002-12-02, 11:22 AM #7
It will have to be done with another hotkey. The selected message is only called when a weapon is selected. If the weapon has already been selected, pushing the select key will not call the selected message again. (actually, the autoselect message is called first, and if that returns a positive value then the selected message is called)
2002-12-02, 7:05 PM #8
If you change the selectweapon(); to 5 when your selecting 3, It will change to weapon 5. Go fig.

------------------
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-12-08, 2:02 AM #9
I got it working now. The only problem that remains is, that it does not change the models and that it doesn't play the mountanim when switched. Any ideas?

------------------
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)

[This message has been edited by zagibu (edited December 08, 2002).]
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2002-12-08, 7:44 AM #10
have the hotkey cog send a trigger/message to the weapon cog and use something like this in the weapon cog:
Code:
trigger:
if(weapon == 1)
{
   weapon = 0;
}
else if(weapon == 0)
{
   weapon = 1;
}
SendMessage(GetSelfCog(), deselected);
SetCurWeapon(player, 0);
SelectWeapon(player, 1);
Return;


and use something like this in every other message:
Code:
if(weapon == 0)
{
   do what you want weapon 0 to do;
}
else if(weapon == 1)
{
   do what you want weapon 1 to do;
}
Return;


[This message has been edited by Ace1 (edited December 08, 2002).]
I am _ Ace_1 _ , and I approve this message.
2002-12-13, 11:46 AM #11
Yes, that's what I'm doing. But it still won't change the models.

------------------
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)

↑ Up to the top!