Not sure where I went wrong. Just trying to create a simple coin collecting script.
-- LUA Script - precede every function and global member
with lowercase name of script + '_main'
-- Player Collect a coin
coins = 0
function item_coin_init(e)
end
function item_coin_main(e)
PlayerDist = GetPlayerDistance(e)
if PlayerDist < 80 then
coins = coins + 1
PromptDuration("Coins Collected: ".. coins,3000)
PlaySound(e,0)
Destroy(e)
ActivateIfUsed(e)
end
end
EDIT:
Oh wow I figured out the issue... and its a weird one... scripts only work when they are in the root folder of scriptbank. Rather than say scriptbank\examples\
I've successfully been able to create a cash system where you have to collect a certain amount of coins in order to open a door. I guess from here its very easy to make weapons and ammo purchasable too now from a vendor. Be nice to try all this out with some HUDs for an inventory type system with Buy and Sell options.
i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce 420 GT