2 or more weapons in one bind?

2 or more weapons in one bind?

Postby Alebrije » 24 Mar 2013, 19:58

There is the possibility to use one key (bind) for 2 or more weapons? :D

For example: The key "G" to swap between Shotgun and SMG.

I play Sauerbraten and there is one command to switch between 2 or more weapons, the command cycleweapon. And Red Eclipse is based on Cube Engine (too) so... i guess this could be possible (or not?) :?
Alebrije
 
Posts: 1
Joined: 24 Mar 2013, 19:44

Re: 2 or more weapons in one bind?

Postby ZeroKnight » 25 Mar 2013, 08:13

This is pretty hackish, but it works...
{l Code}: {l Select All Code}
bind <key> [ if $weaptog [weapon (weapslot $weapidxsmg); weaptog = 0] [weapon (weapslot $weapidxshotgun); weaptog = 1] ]

You'll just have to define weaptog beforehand (autoexec would be ideal).

If there were a way to return your current weapon, this bind could be a lot less hackish :P

[EDIT]

You can get a bit fancy with this, which will return the name of the weapon that you have in your hand:
{l Code}: {l Select All Code}
(getweap (weapslot -1) -1)

The best part is that it's <weap>name agnostic, meaning if the weapon's name is non-default, it will still return its base name (ie. 'shotgun'). Combine this with hasweap, and you can make a small function that will only toggle if you have the weapon.
[ Github ][ WazuClan -- irc.wazuclan.com #wazuclan ][ Zero's Archive of RE Extensions, Scripts, WeapMods & More! ]
User avatar
ZeroKnight
 
Posts: 524
Joined: 08 Jun 2011, 01:24
Location: Ohio, United States

Re: 2 or more weapons in one bind?

Postby qreeves » 25 Mar 2013, 08:54

Alebrije {l Wrote}:For example: The key "G" to swap between Shotgun and SMG.

Try this:
{l Code}: {l Select All Code}
bind G [case (weapselect) 3 [if (hasweap 8) [weapon (weapslot 8)]] () [if (hasweap 3) [weapon (weapslot 3)]]]
Quinton "quin" Reeves | Lead Developer, Red Eclipse | http://redeclipse.net/ | http://www.facebook.com/redeclipse.net
User avatar
qreeves
 
Posts: 1294
Joined: 17 Mar 2011, 03:46
Location: Queensland, Australia

Who is online

Users browsing this forum: No registered users and 1 guest