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!
coin functions
Moderator: Team Members
-
Jabantiz
- Lead Developer
- Posts: 2912
- Joined: Wed Jul 25, 2007 2:52 pm
- Location: California
Re: coin functions
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
loot coin functions:
SetLootCoin()
GetLootCoin() - this page seems to have been deleted, will fix that as well
-
Jabantiz
- Lead Developer
- Posts: 2912
- Joined: Wed Jul 25, 2007 2:52 pm
- Location: California
Re: coin functions
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
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
-
patrikpatrik
- Posts: 16
- Joined: Wed Aug 03, 2016 8:43 am
Re: coin functions
Terrific! Can't wait to try these out.
- Gangrenous
- Posts: 812
- Joined: Sun Apr 24, 2016 6:54 am
- Characters: Dinsmoor
Re: coin functions
Tagging in here for official commit, please post when it hits so I can merge it to my source.
Resident Dirty Hippy
-
Jabantiz
- Lead Developer
- Posts: 2912
- Joined: Wed Jul 25, 2007 2:52 pm
- Location: California
Re: coin functions
This has all been migrated to public svn now.Gangrenous wrote:Tagging in here for official commit, please post when it hits so I can merge it to my source.
Who is online
Users browsing this forum: No registered users and 0 guests