• Do not use Works in Progress as a way of avoiding the releases system! Works in Progress can be used for sharing early betas and for getting suggestions for improvement. Releases of finished content are not allowed in this forum! If you would like to submit a finished addon, click here for instructions on how to do so.

Set the ammo count of a given weapon and detect the weapon "on hand" in Lua

Status
Not open for further replies.

amperbee

thunderdome denizen
That.
I'd like to know how to change the value of ammo for a given weapon and to be able to detect the weapon the player has in hand.

EDIT: I think I found the way to get which weapon is the player holding, like, ready to fire, but I still don't know how to change the ammo.
 
Last edited:
player.powers[pw_*] controls various powerups, including the ammo count of a particular weapon ring. The specific entries for each weapon ring's ammo count are pw_infinityring, pw_bouncering, pw_railring, pw_automaticring, pw_explosionring, pw_scatterring, and pw_grenadering.

To check if a player has a weapon, use (player.ringweapons & RW_*), available options RW_AUTO, RW_BOUNCE, RW_SCATTER, RW_GRENADE, RW_EXPLODE, RW_RAIL. The player's current weapon is stored under player.currentweapon, options same as before but replacing RW_ with WEP_, and using 0 for red/infinity ring.
 
Oh, thanks RedEnchilada!
Quick question, player.powers also contains the panels for every weapon too, right?

---------- Post added at 02:02 AM ---------- Previous post was at 01:59 AM ----------

Nevermind, checked some more wiki to find out the panels are stored somewhere else.
 
Status
Not open for further replies.

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top