Scripts / add player ammo question

Author
Message
Voodoo
GameGuru TGC Backer
10
Years of Service
User Offline
Joined: 19th Dec 2013
Location: Germany
Posted: 6th Jun 2015 11:10
hi guys i made an Ammo station have a look here:
https://forum.game-guru.com/thread/212279#msg2520586
is it possible to add ammunition?
visit my homepage to download 3D Content
http://voodoogstudios.webs.com/
!nullptr
Forum Support
9
Years of Service
User Offline
Joined: 27th Mar 2015
Location: Australia
Posted: 6th Jun 2015 11:41 Edited at: 6th Jun 2015 11:49
AddPlayerAmmo(e)

e of course is the ammo itself and the ammo count is controlled by the value you give it in properties.
AKA SisterMatic (Steam)
Development/ Gaming Rigs
Sys 1: i7-4770 (3.5)/16Gb/128 SSD/3Tb/970gtx/2 x 23, 1 x 27 LCD - Sys 2: i7/8Gb/670gtx/1.5Tb/1 x 23 LCD - Sys 3: Amd Quad/8Gb/645gtx/1Tb/30" LCD
PM
Voodoo
GameGuru TGC Backer
10
Years of Service
User Offline
Joined: 19th Dec 2013
Location: Germany
Posted: 6th Jun 2015 11:47
ok thats the problem: how do i cycle through e?
visit my homepage to download 3D Content
http://voodoogstudios.webs.com/
!nullptr
Forum Support
9
Years of Service
User Offline
Joined: 27th Mar 2015
Location: Australia
Posted: 6th Jun 2015 11:51
Sorry, I rephrased my answer. "e" is the ammo entity when you press "E" to pickup the ammo.

Whatever value "e" is will be added to your ammo.
AKA SisterMatic (Steam)
Development/ Gaming Rigs
Sys 1: i7-4770 (3.5)/16Gb/128 SSD/3Tb/970gtx/2 x 23, 1 x 27 LCD - Sys 2: i7/8Gb/670gtx/1.5Tb/1 x 23 LCD - Sys 3: Amd Quad/8Gb/645gtx/1Tb/30" LCD
PM
!nullptr
Forum Support
9
Years of Service
User Offline
Joined: 27th Mar 2015
Location: Australia
Posted: 6th Jun 2015 11:52 Edited at: 6th Jun 2015 11:53
Look at the ammo.lua script. It's all there. Attach that script to each clip.
AKA SisterMatic (Steam)
Development/ Gaming Rigs
Sys 1: i7-4770 (3.5)/16Gb/128 SSD/3Tb/970gtx/2 x 23, 1 x 27 LCD - Sys 2: i7/8Gb/670gtx/1.5Tb/1 x 23 LCD - Sys 3: Amd Quad/8Gb/645gtx/1Tb/30" LCD
PM
Voodoo
GameGuru TGC Backer
10
Years of Service
User Offline
Joined: 19th Dec 2013
Location: Germany
Posted: 6th Jun 2015 12:39
sorry i'm a noob at lua,
does this mean that if i set AddPlayerAmmo(20) it will give 20 ammo to the weapon?
visit my homepage to download 3D Content
http://voodoogstudios.webs.com/
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 6th Jun 2015 14:35
nope, unfortunately there's no way to specify a specific ammo type or amount, you have to actually place the ammo onto the map somewhere and then use AddPlayerAmmo() to reference that item

i.e.
- place your ammo station
- place 1 type of each ammo (that it will be able to create) - remove the script from these and hide them (just remember to store the entity number or give them a script to store it)
- inside the ammo station script you can now reference the ammo numbers you stored above using "AddPlayerAmmo(#)"

it would be nice to get a real command to see/edit ammo types and amounts without this long method but for now that's all we have
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11

Login to post a reply

Server time is: 2024-05-03 09:50:55
Your offset time is: 2024-05-03 09:50:55