Is it possible to count the use of ammo in a fight?

Post » Thu Mar 18, 2010 8:19 pm

Hello everyone, I would appreciate any help you could give me with this little idea.
I want to count the amount of ammo a player "consumed" during in a fight. In particular I want to create "empty energy cells" after a fight, so the player can recharge them at a portable recharger. My problem is, that any way I thought of to do this ends up with major problems. For example, using a quest to check on the difference between the amount of any ammo type every couple of seconds would not account to the fact, that the player could pick some ammo up during the fight, and so on...

Does anyone have an idea how to accomplish my idea to count ammo "consumption" during a fight? Maybe I'm just blind...
User avatar
Eileen Collinson
 
Posts: 3208
Joined: Thu Dec 28, 2006 2:42 am

Post » Thu Mar 18, 2010 6:19 pm

I could imagine doing that with ease using C++ or something similar, but I don't have much of an idea for the G.E.C.K, sorry :(.
User avatar
Steeeph
 
Posts: 3443
Joined: Wed Apr 04, 2007 8:28 am

Post » Thu Mar 18, 2010 7:49 pm

Yea I'm not sure if you can do it... the GECK uses lua scripting language. (Or at least a chopper down version for the public version) Or something really close to lua, like really close if it isnt.

But if I find anything that could be used to do this I'll let you know. I am just learning more complicated scripted right now, so I don't know anything. But doesnt really seem like its possible. The only thing I could think of, is making a unique gun and when you fire it, it adds 1 to a 'counter' then at the end of the battle it uses the counter number as the number of shots fired. I dunno :/
User avatar
joeK
 
Posts: 3370
Joined: Tue Jul 10, 2007 10:22 am

Post » Thu Mar 18, 2010 10:12 pm

Maybe you could keep track of all the ammo you have, then when that number goes down, see if you are in a combat state; if not, watch for a combat state for 10 seconds, and if you enter combat wait until you leave combat and then compare the new ammo total, then report the difference for all ammo that was reduced in volume, also taking into account any ammo looted during combat.
User avatar
JAY
 
Posts: 3433
Joined: Fri Sep 14, 2007 6:17 am

Post » Thu Mar 18, 2010 2:30 pm

Maybe you could keep track of all the ammo you have, then when that number goes down, see if you are in a combat state; if not, watch for a combat state for 10 seconds, and if you enter combat wait until you leave combat and then compare the new ammo total, then report the difference for all ammo that was reduced in volume, also taking into account any ammo looted during combat.


Something similiar came also to mind but I don't know how to keep track of the ammo looted during a fight.
User avatar
Bryanna Vacchiano
 
Posts: 3425
Joined: Wed Jan 31, 2007 9:54 pm

Post » Thu Mar 18, 2010 10:50 am

Something similiar came also to mind but I don't know how to keep track of the ammo looted during a fight.


You'd just check for an increase in ammo the same way you're watching for a decrease, I'd imagine.
User avatar
Dan Wright
 
Posts: 3308
Joined: Mon Jul 16, 2007 8:40 am

Post » Thu Mar 18, 2010 4:54 pm

Maybe you could do a script that would do the following. I would try adding the script to the weapon first. I am unsure how to do a script that would run in the background constantly

1. Check the players state i.e. (isincombat) and set that number to a variable
2. If the player is in combat do a get.itemcount on the player to check the number of cells and set that number to another var
3. Check the players state again and if it is not in combat get.item count and set it to a third variable.
3. subtract the difference and set that number to a variable
4. Add.item * variable of the difference

Or

1. Check to see if the weapon is firing and if it is get an item count on the player for the ammo and set that to a variable
2. Check again to see if the weapon is firing, if it is not get the item count again and set that number to a variable
3. subtract the difference and set that number to another variable
4. Add.item player * variable of the difference


I know I am probably oversimplifying something that is much more complex. As for the looted ammo I am unsure as how to go about doing this.
User avatar
Tiffany Holmes
 
Posts: 3351
Joined: Sun Sep 10, 2006 2:28 am

Post » Thu Mar 18, 2010 1:24 pm

Any way you do it, it will be buggy. What about when I shoot the gun and I am not in combat? For example, to shoot the Quantum Cola off the dock pier so I can get it. Or when I shoot the gun and the enemy does not see me yet (not in combat)?

Then there is adding ammo, and removing ammo to other containers. I really see no way around this issue...

Unless you go with a new ammo type that you have more control over, perhaps. :shrug:
User avatar
Marina Leigh
 
Posts: 3339
Joined: Wed Jun 21, 2006 7:59 pm

Post » Thu Mar 18, 2010 10:47 pm

You can have the weapon add used ammo to the inventory of the person firing it. Not only with you get your ammo usage, you will also be able to receive the used ammo from the enemies you kill.
User avatar
TIhIsmc L Griot
 
Posts: 3405
Joined: Fri Aug 03, 2007 6:59 pm

Post » Fri Mar 19, 2010 1:44 am

It's been done.

http://www.fallout3nexus.com/downloads/file.php?id=1899

This mod was incorporated into Phalanx, actually, and my internal version has some corrections and improvements.
User avatar
gandalf
 
Posts: 3400
Joined: Wed Feb 21, 2007 6:57 pm

Post » Thu Mar 18, 2010 11:22 am

Yeah, this isn't exactly difficult. Count inventory, if it goes up then the player's picked something up, if it goes down during MenuMode it was sold/put into a container, if it goes down during GameMode it was fired.
User avatar
Big Homie
 
Posts: 3479
Joined: Sun Sep 16, 2007 3:31 pm


Return to Fallout 3