• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua NPC that exchanges your coins

Loney

#!
Senator
Premium User
Joined
Jul 23, 2012
Messages
2,044
Solutions
31
Reaction score
243
Location
México
Hi. I was wondering if is possible to create a NPC script that changes your currency to a bigger coin.

Example:
(500 platinum coins in backpack)
Player: Hi
Player: Platinum coins
NPC: Do you want to change your 500 platinum coins for 5 crystal coins?
Player: Yes

or

Example:
(500 gold coins in backpack)
Player: Hi
Player: Gold coins
NPC: Do you want to change your 500 gold coins for 5 platinum coins?
Player: Yes

I'm actually using The Forgotten Server 1.3. 8.60 version.
 
Yeah but actually my server doesn't got a bank system so I won't use a bank NPC, that's why i'm looking for one that does specifically this.

also, I was wondering if is possible to the npc auto detect how much money the player got to exchange.

Example:
Player: hi.
Platinum coins.
NPC: Do you want to exchange your XXXXX gold to XXXX platinum coins?
 
Last edited:
Thank you for your response.

But I am actually not looking for a fully bank npc,
Already tried to edit this one
But failed.
I mean, since I’m not an expert at lua I can’t figure out some things, like how can the npc Auto detect the $ amount you got in your bp to change.

Loney
 
Pretty sure there's a function like CountMoney() for the player. but all money, idk about just gold.

You could easily do a getItemCount() on the player to define 3 lariables for gold, plat and crystal coins at the start though.

Can you post your current bank npc files? I'd start by making sure you can atleast get the npc workign in game and to be able to say hi/bye as a base template if you've not gottne that far already.
 
Thank you for your response,
I tried using this one local keywordHandler = KeywordHandler:new()local npcHandler = NpcHandler:new(k - Pastebin.com (https://pastebin.com/4CG7h8B4) but changing some parts because I'm not interested in withdraw, balance, etc. Only change coins.
I made some edits in the code but didn't worked and deleted it.
How hard is it to delete everything except the change gold part?

Here, took me less then 3 minutes.
 
Back
Top