Scripts / Ammo Dispenser

Author
Message
Nathan38
13
Years of Service
User Offline
Joined: 13th Feb 2011
Location:
Posted: 30th Jun 2016 16:10 Edited at: 30th Jun 2016 19:22
Hi all,
Trying to make a script that gives the player 30 bullets each time the E key is pressed:



However when the E key is pressed, all of the money is taken (instead of just 50), and no ammo is given either?

Please can anyone help me with this? Thanks!
J_C
17
Years of Service
User Offline
Joined: 9th Nov 2007
Location:
Posted: 1st Jul 2016 17:52
Hi Nathan38
I have just changed the ammo script to do most of what you ask...



see how I use the keypressed variable to stop the g_KeyPressE from using up all your money..
the g_KeyPressE varriable is passed in by the GG main loop so you can't just set it to zero...

also the g_PlayerGunClipCount variable you are trying to use is a global variable passed in by GG main control loop
it is not a variable you can set... as the GG loop will continually change it back...as with the g_KeyPressE..

To Use..
I used the Uzi and placed 1 uzi ammo on the ground... I scaled the Ammo model bigger and attached this script to it..
Hope it helps you


PM
Nathan38
13
Years of Service
User Offline
Joined: 13th Feb 2011
Location:
Posted: 2nd Jul 2016 10:08
Thanks Very much @J_C, did exactly what you did with the scaled up ammo model and it works perfectly. Also, thanks for your clarification on those variables and the main loop!
J_C
17
Years of Service
User Offline
Joined: 9th Nov 2007
Location:
Posted: 2nd Jul 2016 15:06
Glad to help Nathan38...

also remember the quantity of ammo added is from the FPE file for the Uzi ammo model...[ 9mm Parabellum(Uzi) ]
so you could make a copy of the ammo fpe and bitmap file rename them [ 9mm Uzi-30 ]
and change the [ quantity = 30 ] instead of 10..
and the [ desc = 9mm Uzi-30 ]

so you could have your own collection of ammo with different quantities..
PM

Login to post a reply

Server time is: 2024-12-22 18:45:18
Your offset time is: 2024-12-22 18:45:18