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 → 1 hotkey for two weapons; Quick cog help
1 hotkey for two weapons; Quick cog help
2001-10-30, 2:12 PM #1
Okay, I want the hotkey to check if you're using one weapon and switch to another if you are...I got this:
Code:
symbols
message		activated
thing 		player 		local

end

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

code
activated:
player = GetSourceRef();
if(GetCurWeapon(player) == 119)
	SelectWeapon(player, 125);
else
	SelectWeapon(player, 119);
return;
end


And nothing happens.

Any ideas?

Thanks a heap,
-TIE

*Even better (while I'm here), the ultimate goal I guess is to switch back, as well...
So if you're using 119 go to 125, if you're using 125 go to 119, and if you're using neither go to 119.

Complicated, I know, but you guys are the geniuses. [http://forums.massassi.net/html/smile.gif]

[This message has been edited by TIE_14 (edited October 30, 2001).]
2001-10-30, 3:27 PM #2
*COUGH* weapon bins go from 1 to 10. 1 = fists, 2=bryar, 3=strifle, etc.
no clue where you got the 119+ idea lol
2001-10-30, 3:36 PM #3
*COUGH* (?)
My weapon isn't one of the original 10, in fact niether of them are, therefore I gave them new bins...hence 119 and 125.

-TIE
2001-10-30, 5:42 PM #4
Strike please try and help ...

Anyway, put Print("called"); under SelectWeapon verbs to see. If it's acculy calling it , if it is then check to se ein your custom weapon cogs taht you put SetCurWeapon(player, 122); like that...
2001-10-30, 6:37 PM #5
I don't *think* SelectWeapon() will let you select a weapon other than 0-9, but I'm not positive about that.
2001-10-30, 7:03 PM #6
Is there another verb I should use, then?

-TIE
2001-10-30, 7:32 PM #7
I would probably modify the various weapon cogs, so that if a certain bin (say 119) was activated, it would use a different weapon than the default one. if that makes sense.
2001-10-31, 12:47 AM #8
Maybe your SetCurWeapon(player, xxx); is pointing to old 0 to 10 value?

Change them accordingly or GetCurWeapon(player) will not return as you'd expect.

------------------
http://millennium.massassi.net/ - Millennium
2001-10-31, 1:46 PM #9
All my weapons cogs work fine, they're bin settings are correct, and they work without this cog to activate them.
But I'm still getting nothing...
I've got this, after some pointless tinkering, too, just so you can see it:
Code:
symbols
message		activated
thing 		player 		local
int			IsActive		local

end

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

code
activated:
player = GetSourceRef();
IsActive = IsInvActivated(player,119); 

	if(IsActive == 1)
		ActivateBin(player,0,125);
	else
		ActivateBin(player,0,119);
return;
end


Any help is appreciated.

Thanks,
-TIE
2001-10-31, 6:19 PM #10
Make sure that ...

Your gun can acculy be selected, mannuly , e.g no sytax errors, no , not having enough ammo , etc ...

Also try changing around the autoselect code to see if thats getting in the way, I can't be sure if it calls it when the SelectWeapon() verb is used...
2001-10-31, 7:13 PM #11
Seifer - I've tested both my weapons without the cog I'm trying here, using the same bins and everything, and they work fine. So it's definetly not the weapons.
I'll try that autoselect thing, but as you see above I've switched to "ActivateBin" with no results as well...

-TIE
2001-11-02, 7:24 AM #12
So you made two new weapons and you want to make them work in JK?

Instead of making one hotkey for both weapons, why not use two hotkeys? If you aren't going to use more than one hotkey besides the weapons, that would be much nicer.

Anyway, if you want to find out which of your two new weapons is selected, use: If(GetCurInvWeapon(player) == bin) I think that will work whether you use SetCurInvWeapon or SetCurWeapon.

You said your weapon worked, did it fire correctly? I took the strifle and changed the SetCurWeapon(player, 3) to SetCurWeapon(player, 117) which lets you select the gun, but you can't fire. SetCurInvWeapon(player, 117) works. So put that in your new weapon's selected message.

The verb, SelectWeapon(), is not limited from 1 to 10. So yes, you can use it to select your new weapon.

When I was testing the above, I used two bins. Bin 116 was the selectweapon hotkey(flagged 0x120), and bin 117 was the new weapon(flagged 0x0a4 like the other weaps).

Is it working now? I can email you the mod if you want.

------------------
Thank you for sending me a copy of your book - I'll waste no time reading it.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2001-11-02, 9:22 AM #13
No, geez, it still won't work!
I have no idea what could be going wrong, I put a "printUNIstring" (or whatever it's called, I copied it from the saber code) in my weapon select code, just after the player= part, and it didn't print anything...what's it doing!?
And I tested both my weapons, under the same 119 and 125 bins, and both worked and fired fine, but this damn select cog still does nothing!

Aaaah....well, here's what I have now:
Code:
symbols
message		activated
thing 		player 		local

end

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

code
activated:
player = GetSourceRef();

	if(GetCurInvWeapon(player) == 119) 
		SetCurInvWeapon(player, 125);
	else
		SetCurInvWeapon(player, 119);

return;
end


Thanks for your guys' help...

-TIE
2001-11-04, 1:29 AM #14
Your select weapon cog should be something like the code below. Don't have time to test it right now, sorry.

Code:
#============================================
symbols
	int	weap		local
	thing	player		local
	message	activated
end
#============================================
code
#--------------------------------------------
activated:
	player=GetLocalPlayerThing();
	weap=GetCurInvWeapon(player);
	if(weap == 119) SelectWeapon(player, 125);
	else SelectWeapon(player, 119);

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


------------------
Thank you for sending me a copy of your mod - I'll waste no time playing it.

[This message has been edited by SaberMaster (edited November 04, 2001).]
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2001-11-04, 8:17 PM #15
SaberMaster did you even bother to read the start of the thread ?
2001-11-05, 2:57 AM #16
Yeah, Seifer, I know TIE started out with almost the same cog, but he didn't understand my first post on this thread so I wrote the selectweap cog as an example.

TIE: If you still can't get it working, email me the jkstrings.uni, the items.dat, both weapon cogs, and your latest version of the select weapon cog. I'll look through them and find out what's wrong.

[This message has been edited by SaberMaster (edited November 05, 2001).]
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.

↑ Up to the top!