Hello guys, ive been working on an NPC script for afew days now and i have no idea whats wrong with it. For now its just a simple script where you have 2 lines of conversation before an NPC teleports you to a new location (i will be adding more interactivity later).
Here is what i have so far..
I am currently using the latest version of TFS (cryingdamson 3.4 pl2 i believe it is called) and any help would be very appreciated.
Here is what i have so far..
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Percy" floorchange="0" walkinterval="2000">
<health now="150" max="150"/>
<look type="134" head="57" body="59" legs="40" feet="76" corpse="2212"/>
<interaction range="3" idletime="30">
<interact keywords="hi" focus="1">
<!--These are the keywords will trigger this interaction-->
<keywords>hello</keywords>
<keywords>greet</keywords>
<response>
<action name="script">
<!--
if(getPlayerVocation(cid) ~= 0) then
selfSay("You do not require my assistance.")
_state.isidle = true
return
end
-->
if(getPlayerLevel(cid)) >= 8 then
selfSay(getCreatureName(cid) .. ", are you ready to take your journey into the unknown?")
_state.topic = 1
else
selfSay("You are not yet ready to begin your travels!")
_state.isidle = true
end
</action>
</response>
</interact>
<interact keywords="yes" topic="1">
<!--Normal account-->
<response text="Are you certian you are ready?">
<action name="topic" value="2"/>
_state.n1 = 1
_state.topic = 2
</response>
</interact>
<interact keywords="yes" topic="2">
<response>
<!--n1: 1 = yes, 2 = yes, 3 = thais, 4 = venore-->
<action name="script">
local pos = 0
if(_state.n1 == 1) then
pos = {x=99, y=235, z=7}
else
selfSay("My hearing is bad, what did you say?!")
return
end
selfSay("Here we go!")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
if(doTeleportThing(cid, pos) == 0) then
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
end
</action>
<action name="idle" value="1"/>
</response>
</interact>
<interact keywords="bye" focus="0">
<keywords>farewell</keywords>
<response text="Good bye. Recommend us, if you were satisfied with our service."/>
</interact>
<!--
If the event onBusy exists, the npc will make a queue like Tibia, if the event is removed
the npc will be able to talk to all customers at the same time without problems.
-->
<interact event="onBusy">
<response text="WAIT UNTIL IT IS YOUR TURN!">
<action name="addqueue" value="|PLAYER|"/>
</response>
</interact>
<!--This event triggers if the player goes to far away from the npc/logout/idle timeout-->
<interact event="onPlayerLeave" focus="0">
<response text="What a nice young fellow!"/>
</interact>
</interaction>
</npc>
I am currently using the latest version of TFS (cryingdamson 3.4 pl2 i believe it is called) and any help would be very appreciated.