Game Development Community

Need some Advice/Help - Recoding The Ammo System for weapons.

by Lee Wickham · in Torque 3D Professional · 09/12/2011 (6:33 pm) · 3 replies

Hey guys, as the thread topic states im looking for some advice and help with Recoding The Ammo System for weapons.

Why do i want to do this ?

Simple explanation

I have a weapon in game currently lets say the "ak47" that is loaded with a magazine that hold's "30" rounds.
In my players inventory are an additional 6 Mag's again each carries "30" rounds in them.

my weapons also have firemode states were applicable e.g "Selective FireMode, Burst FireMode and Fully Automatic FireMode."

I have noticed a bug after adding thease in were after expending the weapons cuttent ammo (but still having mag's left in the inventory) when you switch fire mode you are able to fire off an unlimated amount of ammo.

I have determined that is is happening because the current Ammo Inventory system is not compatable with my "Mag and Fire Mode System", what is happening is this:

When the weapon's ammo count reaches zero, indicated by the ammo count hud item, and the weapon firemode state is changes, Torque fires the "Ammo Check function", and checks the players inventory for ammo, on seeing that there is ammo avalable it allows the gum to be fired, however it dose not decreace the ammmount of ammo left in the inventory any more, thus you get an unlimated ammount of ammo.


What i need to do is the follow: (Not in any order)

1. Recode the onFire even so that when a bullet is fired from my weapon it decreaces the ammo count in the current loaded magazine only.
2. Recode the Ammo checking function so that it
a. Checks the current loaded magazine for remaining ammo.
b. checks the players inventory for remaining magazine (if found)
3. Recode the reload function so that it decreaces the magazine count in the players inventory after reloading the weapon with a new magazine.
4. Remove any referance to ammo i.e "Individual Bullets" in the players inventory.


Any suggestions, advice or exmaples of how you guys have done this (that is if any one has) woudl be greatly appreciated.

#1
09/12/2011 (10:01 pm)
Check the resources section - there's a few old resources for "weapon clips". They'll all probably predate the filtering system, so try search.
#2
09/13/2011 (3:22 pm)
I have some very old bookmarks in my browser, and as steve said if you haven't found them yet maybe these
might help
www.garagegames.com/community/resources/view/2286
www.garagegames.com/community/resources/view/2225
www.garagegames.com/community/forums/viewthread/3523
#3
09/15/2011 (1:02 pm)
Cheers guys, it looks like im going to have to recode the whole ammo system as well as the reload as i want to have it so there is now "ammo" in the payer inventory just mags and the "ammo" is within the mags them selves.