TheGameCreators / GameGuruRepo

The GameGuru Repository For Community Collaboration
http://www.game-guru.com
137 stars 56 forks source link

weapon ammo #617

Open mtrm92 opened 5 years ago

mtrm92 commented 5 years ago

We made a script 4 droping weapons when pressing the T replace key so the weapon dont just dissapear, it is droping down and u can take it later again.The problem is that the pool seems bugged, we can't get it to not keep adding ammo everytime if u take the weapon again. https://www.youtube.com/watch?v=hoSpIXCgfy4 would be cool if u fix it, thank u

A-Workaround commented 4 years ago

I have encountered the same (or a similar) issue. If a weapon is hidden using Hide(e) instead of being destroyed to make a swap possible by 'dropping' your current weapon to pick up the new one (repositioning the hidden weapon and making it visible again) then a new clip of ammo is added to the picked up weapon. If you repeatedly cycle the swap, the clips accumulate. This is done in iterations of the 'Ammo' 'Quantity' field of the entity Properties menu in the editor. So a 'Quantity' value of 10 will increase per swap as 10, 20, 30... Oddly if you set it to 0 it will increment the clip one bullet at a time and not stay as 0. If set to -1 it decreases the count by -1 per swap. Attempts to set the ammo clip in Lua after the weapon swap fail to change the added (or reduced) amount caused by swapping the weapons.