Scripts / Shop script & entity number

Author
Message
Honkeyboy
3D Media Maker
8
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 6th May 2016 15:54 Edited at: 6th May 2016 15:55
Hi all, ive been messing about with a universal shop script, which ties in with other currency to make it all blend in nicely, i have it working up to the point of the weapon being added to the players inventory e.g arrows, bolts etc . Problem is nothing is being added, i can buy ok using the right currency but no arrows added. Here's the code



Any ideas as to why? im using the entity number from the bottom of the editor
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 6th May 2016 18:21 Edited at: 6th May 2016 18:47
Quote: "AddPlayerWeapon(item_number[item])"

it is only set to add weapons, not ammo
you would need to put
Quote: "AddPlayerAmmo(item_number[item])"


edit, to use both weapons & ammo you need a way to define the item type
like
item_type[1] = "weapon"
item_type[2] = "ammo"
etc

then in the script you would check that value and give the appropriate response (as above)
like
if item_type[item] == "weapon" then
AddPlayerWeapon(item_number[item])
elseif item_type[item] == "ammo" then
AddPlayerAmmo(item_number[item])
end

etc
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Honkeyboy
3D Media Maker
8
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 6th May 2016 19:17
Yeah realized the ammo part was missing while reading through it again i added the top code but not the bottom thanks smallg

Login to post a reply

Server time is: 2024-04-27 08:44:51
Your offset time is: 2024-04-27 08:44:51