Nyarl666
Member
- Joined
- Sep 25, 2022
- Messages
- 63
- Reaction score
- 7
Hello.
It overwhelmed me
I need an NPC (in TFS 1.4) that gives 10,000 gp to each character only once. Not once an account, but only once per each character from the account.
Now it only gives money if you don't keep it with you. If you throw them out, you can take another one over and over again
It overwhelmed me
I need an NPC (in TFS 1.4) that gives 10,000 gp to each character only once. Not once an account, but only once per each character from the account.
Now it only gives money if you don't keep it with you. If you throw them out, you can take another one over and over again
XML:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Kasian" script="Kasian.lua" walkinterval="2000" floorchange="0" speechbubble="3">
<health now="100" max="100" />
<look type="128" head="94" body="113" legs="132" feet="115" addons="2" />
</npc>
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
function creatureSayCallback(cid, type, msg)
if not npcHandler:isFocused(cid) then
return false
end
local player = Player(cid)
if msgcontains(msg, "yes") then
if player:getMoney() >= 10000 then
selfSay("You can not take it anymore.", cid)
else
selfSay("Enjoy game.", cid)
player:addItem(2160, 1)
end
return
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:setMessage(MESSAGE_GREET, "|PLAYERNAME|. I am the messenger of King Worldianus. Each newcomer gets 10000 gp to start. Want? By the way, welcome to " .. configManager.getString(configKeys.SERVER_NAME) .. "!")
npcHandler:addModule(FocusModule:new())