Page 1 of 1
coin functions
Posted: Tue Aug 09, 2016 8:57 am
by patrikpatrik
Hello,
I have 2 questions: Is there a lua function that destroys coins? And is there one that will give coins/remove coins from player to npc? Thanks!
Re: coin functions
Posted: Tue Aug 09, 2016 3:07 pm
by Jabantiz
There is no LUA to destroy coins. Coins is also exclusive to players, npcs didn't have any on live. That being said they can drop coins as loot and you can set and get the coin loot so that might work for NPC's, for players I will add a Get/Set/Remove for coins to the todo list, they should be simple though and I might be able to get to them tonight.
loot coin functions:
SetLootCoin()
GetLootCoin() - this page seems to have been deleted, will fix that as well
Re: coin functions
Posted: Tue Aug 09, 2016 5:36 pm
by Jabantiz
I
added the coin functions, they will be up on the emu server tonight, will make it to public svn by Sunday I think.
To transfer coins from player to npc it would be something like this
Code: Select all
function hailed(NPC, Spawn)
-- 1 Silver
local coins = 100
-- Check if Spawn is a player and if so attempt to remove the coins
if IsPlayer(Spawn) and RemoveCoin(Spawn, coins) then
-- Successfully removed the coins from the player so lets add it to the npc
-- Get the current amount of coin the NPC has
local npc_coins = GetLootCoin(NPC)
-- Add our one silver to the amount
npc_coins = npc_coins + coins
-- Now set the coins the NPC has to the new amount
SetLootCoin(NPC, npc_coins)
end
end
Re: coin functions
Posted: Wed Aug 10, 2016 10:54 am
by patrikpatrik
Terrific! Can't wait to try these out.
Re: coin functions
Posted: Wed Aug 10, 2016 4:19 pm
by Gangrenous
Tagging in here for official commit, please post when it hits so I can merge it to my source.
Re: coin functions
Posted: Mon Aug 15, 2016 3:20 pm
by Jabantiz
Gangrenous wrote:Tagging in here for official commit, please post when it hits so I can merge it to my source.
This has all been migrated to public svn now.