Nexuiz Ninjaz - Practicing the Ninja Art of Nexuiz

Full Version: [cfg] SVN - bestweapon and cycleweapon deprecated
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
For those curious, here's an explanation using the ninja pack as an example of how the new weapon bind system works.

Code:
// Weapon Binds
//
// In SVN, bestweapon and cycleweapon are deprecated.  Replaced by the bind style below
// the first two numbers are identifiers for how you'd like the weapons to cycle:
//
// 20x = backwards
// 21x = best
// 22x = forwards
//
// The last number coincides with the cl_weaponpriority number.  This means, you have
// up to 10 ways you can arrange the weapons and 3 ways to access them

bind c "impulse 210; bestweapon 5 4 8"         // electro, mortar, hagar
set cl_weaponpriority0 "5 4 8"            // electro, mortar, hagar

bind v "impulse 211; bestweapon 4 5 8"     // mortar, electro, hagar
set cl_weaponpriority1 "4 5 8"            // mortar, elextro, hagar

bind e "impulse 1"                  // laser

bind f "impulse 212; bestweapon 7 3 1"         // nex, mg, laser
set cl_weaponpriority2 "7 3 1    "        // nex, mg, laser

bind q "impulse 213; bestweapon 9 4 8"         // rocket, mortar, hagar
set cl_weaponpriority3 "9 4 8"             // rocket, mortar, hagar

bind r "impulse 214; bestweapon 3 6 5 8"    // mg, crylink, electro, hagar
set cl_weaponpriority4 "3 6 5 8"             // mg, crylink, electro, hagar

bind t "impulse 215; bestweapon 6 3 5 8"    // crylink, mg, electro, hagar
set cl_weaponpriority5 "6 3 5 8"             // crylink, mg, electro, hagar


edit: fixed some errors

Quote:
bind c "impulse 200; cycleweapon 5 4 8" // electro, mortar, hagar
set cl_weaponpriority0 "5 4 8" // electro, mortar, hagar


Seems like you want to support both the old and new ways to switch guns. Maybe it would be less customization work if you use:

Quote:
set cl_weaponpriority0 "5 4 8" // electro, mortar, hagar
bind c "impulse 200; cycleweapon $cl_weaponpriority0"

set cl_weaponpriority3 "9 4 8" // rocket, mortar, hagar
bind q "impulse 203; cycleweapon $cl_weaponpriority3"

But its untested, so i'm not sure if that does work. But i think it should

WHat does it do?
Where do you put it?
Disregard all of the following; It does work. You just have to make sure the cfg file works before loading the server.


Just tried both methods on the Phoenix server. Neither worked.

Quote:
bind z "impulse 200; cycleweapon $cl_weaponpriority0"
set cl_weaponpriority0 "7 4"

bind a "impulse 211; cycleweapon 9 5 6"
set cl_weaponprioirty1 "9 5 6"

keep in mind that you need nexuiz svn to do this not just the server. those commands will not work with nexuiz 2.4.2
Is that confirmed?

I thought MooKow claimed that he was able to set it up using 2.4.2 client. Hmm. I'll have to ask him more about that.
Ok, Pav set me straight. I was running a cfg file AFTER I connected to the server. The server doesn't update cvars except for when it's loading; thus, it wasn't getting the message. And, I misspelled priority.

The easy solution is to drop the code in the autoexec.cfg file instead of having a separate file, like I did. The same code works in 2.4.2; I tested it.

Anyway, it does work. Thanks Pav!
This is a life saver! I've made bestweapon an integral part of my weaponry and was greatly missing it when I played on Galt's servers. Thank s -z-
Wait, you can switch 3 weapons with one bind?

Dj~ Wrote:
Wait, you can switch 3 weapons with one bind?

You make a list of weapons in the order you prefer, then use the impulse commands (for SVN builds) or cycleweapon and bestweapon commands (for Nexuiz 2.4) to select a weapon from your list. In -z-'s code, he uses both so it will work on both 2.4 and SVN servers.

bestweapon and impulse 210 choose the first weapon in your list that you carry and have enough ammo to fire.

cycleweapon and impulse 220 choose the next weapon in your list that you carry and have enough ammo to fire.

impulse 200 chooses the previous weapon in your list that you carry and have enough ammo to fire.

As an example, look at this code:
set cl_weaponpriority0 "9 5 4 8 6 3 7 2 1"
bind c "impulse 210; bestweapon $cl_weaponpriority0"

When you press c, Nexuiz will check if you have the rocket launcher (weapon 9) and rockets. If so it will select this weapon. If not, it checks if you have the electro (weapon 5) and cells (the ammo for the electro). If so it selects this weapon. If not it checks the next on the list and so on. If you don't have any other weapons or ammo, it selects the last weapon on the list, which is the laser (weapon 1) which doesn't need ammo.

With bestweapon and cycleweapon you can make as many lists as you like. I think the new method in the SVN builds is limited to 10 lists, numbered 0 through 9.

Nexuiz impulse numbers: 9=rocket, 8=hagar, 7=nex, 6=crylink, 5=electro, 4=mortar, 3=machinegun, 2=shotgun, 1=laser

Pages: 1 2
Reference URL's