Hello, its my first npc in my life. Sorry for language errors, my from poland.
Test on TFS 0.4 and 8.60 Tibia client.
Npc info: http://tibia.wikia.com/wiki/Testserver_Assistant
NPC in script:
-Add 10 crystal coins
-Add 254237300 exp (only one)
Install:
/*/data/npc create Testserver Assistant.xml and add
/*/data/npc/scripts create testserver_assistant.lua and add
You can edit items and exp here:
Green color - Edit count (example 10 crystal coins)
Red color - Edit exp (254237300 = 250 level)
Test on TFS 0.4 and 8.60 Tibia client.
Npc info: http://tibia.wikia.com/wiki/Testserver_Assistant
NPC in script:
-Add 10 crystal coins
-Add 254237300 exp (only one)
Install:
/*/data/npc create Testserver Assistant.xml and add
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Testserver Assistant" script="testserver_assistant.lua" walkinterval="4000" floorchange="0">
<health now="100" max="100"/>
<look type="73" />
<parameters>
<parameter key="message_greet" value="Hey |PLAYERNAME|. I'm Testserver Assistant and can give {money} and {experience} which will be useful for testing on Exodum server."/>
<parameter key="message_farewell" value="Good bye!"/>
<parameter key="message_walkaway" value="Good bye!" />
</parameters>
</npc>
/*/data/npc/scripts create testserver_assistant.lua and add
Code:
--EXODUM OTS
--BY SZAFI (Old Sessam)
--http://tibia.net.pl/members/156613-Old-Sessam
--http://otland.net/members/szafi.32524/
--skype: sessam5
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
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
--DAWANIE 10 CRYSTAL COINS
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if msgcontains(msg, "money") then
selfSay("Do you want 10 crystal coins?", cid)
talkState[talkUser] = 1
elseif msgcontains(msg, "yes") and talkState[talkUser] == 1 then
selfSay("Here you are.", cid)
doPlayerAddItem(cid, 2160, 10)
talkState[talkUser] = 0
if(not npcHandler:isFocused(cid)) then
return false
end
--DAWANIE 254237300 EXPA
elseif msgcontains(msg, "experience") then
selfSay("Do you want experience?", cid)
talkState[talkUser] = 2
elseif msgcontains(msg, "yes") and talkState[talkUser] == 2 and getPlayerStorageValue(cid, 15211) == 1 then
selfSay("Sorry. Experience I can add only one time per character.", cid)
elseif
getPlayerStorageValue(cid, 15211) == -1 then
selfSay("Here you are.", cid)
doPlayerAddExp(cid, 254237300)
doCreatureSetStorage(cid, 15211, 1)
talkState[talkUser] = 0
if(not npcHandler:isFocused(cid)) then
return false
end
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
You can edit items and exp here:
Cyan color - Edit ITEMID (2160 = crystal coins)Green color - Edit count (example 10 crystal coins)
Red color - Edit exp (254237300 = 250 level)
Last edited: