STiX
Intermediate OT User
It's been a while, and I haven't had much experience with the new NPC systems of late.
Can someone point me in the right direction to fix this?
I'm also hoping that if the player meets multiple states, that it'd push out all the available options.
Like if a player is playing on a premium account AND is an elf, the Oracle would say:
So, any ideas of where I went wrong?
Can someone point me in the right direction to fix this?
XML:
<npc name="The Oracle" floorchange="0" walkinterval="0">
<health now="150" max="150"/>
<look typeex="1448"/>
<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">
<![CDATA[
if(getPlayerLevel(cid)) >= 8 then
selfSay(getCreatureName(cid) .. ", are you ready to face your destiny?")
_state.b1 = (isPremium(cid) == TRUE)
_state.b2 = (getPlayerSex(cid) == 2)
_state.b3 = (getPlayerSex(cid) == 3)
_state.topic = 1
else
selfSay("CHILD! COME BACK WHEN YOU HAVE GROWN UP!")
_state.isidle = true
end
]]>
</action>
</response>
</interact>
<interact keywords="yes" topic="1">
<!--Premium Account (B1)-->
<response b1="1" text="In which town do you wish to live: Silverkeep or Forsaken Bay?">
<action name="topic" value="2"/>
</response>
<!--Elvish Character (B2)-->
<response b2="1" text="Or, as you are an Elf perhaps ELVEN-TOWN-NAME?">
<action name="topic" value="2"/>
</response>
<!--Dwarvish Character (B3)-->
<response b3="1" text="Or, as you are a Dwarf perhaps, DWARVEN-TOWN-NAME?"">
<action name="topic" value="2"/>
</response>
<!--Normal Player-->
<response text="You are able to reside in Silverkeep, if you want.">
<action name="topic" value="2"/>
</response>
</interact>
<interact keywords="Silverkeep" topic="2">
<response text="Ah Silverkeep! And which profession have you chosen? Knight, Paladin, Sorcerer or Druid?">
<!--n1: 1 = Silverkeep, 2 = Forsaken Bay, 3 = ELVEN-TOWN-NAME, 4 = DWARVEN-TOWN-NAME-->
<action name="script">
<![CDATA[
_state.n1 = 1
_state.topic = 3
]]>
</action>
</response>
</interact>
<interact keywords="ELVEN-TOWN-NAME" topic="2">
<response text="You need to be an Elf to go there!">
<!--Set the topic back to 2, ie. choose a new town.-->
<action name="topic" value="2"/>
</response>
<!--b1: premium account, see <interact keywords="hi" focus="1"> where _state.b1 is is set.-->
<response b2="1" text="Okay, ELVEN-TOWN-NAME! And which profession have you chosen? Knight, Paladin, Sorcerer or Druid?">
<!--n1: 1 = Silverkeep, 2 = Forsaken Bay, 3 = ELVEN-TOWN-NAME, 4 = DWARVEN-TOWN-NAME-->
<action name="script">
<![CDATA[
_state.n1 = 3
_state.topic = 3
]]>
</action>
</response>
</interact>
<interact keywords="DWARVEN-TOWN-NAME" topic="2">
<response text="You need to be a Dwarf to go there!">
<!--Set the topic back to 2, ie. choose a new town.-->
<action name="topic" value="2"/>
</response>
<!--b1: premium account, see <interact keywords="hi" focus="1"> where _state.b1 is is set.-->
<response b3="1" text="Okay, DWARVEN-TOWN-NAME! And which profession have you chosen? Knight, Paladin, Sorcerer or Druid?">
<!--n1: 1 = Silverkeep, 2 = Forsaken Bay, 3 = ELVEN-TOWN-NAME, 4 = DWARVEN-TOWN-NAME-->
<action name="script">
<![CDATA[
_state.n1 = 3
_state.topic = 3
]]>
</action>
</response>
</interact>
<interact keywords="Forsaken Bay" topic="2">
<response text="You need a premium account to go there!">
<!--Set the topic back to 2, ie. choose a new town.-->
<action name="topic" value="2"/>
</response>
<!--b1: premium account, see <interact keywords="hi" focus="1"> where _state.b1 is is set.-->
<response b1="1" text="IN Forsaken Bay! And which profession have you chosen? Knight, Paladin, Sorcerer or Druid?">
<!--n1: 1 = Silverkeep, 2 = Forsaken Bay, 3 = ELVEN-TOWN-NAME, 4 = DWARVEN-TOWN-NAME-->
<action name="script">
<![CDATA[
_state.n1 = 3
_state.topic = 3
]]>
</action>
</response>
</interact>
<!--If the player does not say any city, repeat our question-->
<interact keywords="|*|" topic="2">
<response b1="1" text="Silverkeep or Forsaken Bay?"/>
<response b2="1" text="Silverkeep, Forsaken Bay or ELVEN-TOWN-NAME?"/>
<response b3="1" text="Silverkeep, Forsaken Bay, or DWARVEN-TOWN-NAME?"/>
<response text="Do you wish to live in Silverkeep?"/>
</interact>
<interact keywords="sorcerer" topic="3">
<response text="A sorcerer! Are you sure? The decision is irreversible!!">
<!--n2: 1 = sorcerer, 2 = druid, 3 = paladin, 4 = knight-->
<action name="script">
<![CDATA[
_state.n2 = 1
_state.topic = 4
]]>
</action>
</response>
</interact>
<interact keywords="druid" topic="3">
<response text="A druid! Are you sure? The decision is irreversible!!">
<!--n2: 1 = sorcerer, 2 = druid, 3 = paladin, 4 = knight-->
<action name="script">
<![CDATA[
_state.n2 = 2
_state.topic = 4
]]>
</action>
</response>
</interact>
<interact keywords="paladin" topic="3">
<response text="A paladin! Are you sure? The decision is irreversible!!">
<!--n2: 1 = sorcerer, 2 = druid, 3 = paladin, 4 = knight-->
<action name="script">
<![CDATA[
_state.n2 = 3
_state.topic = 4
]]>
</action>
</response>
</interact>
<interact keywords="knight" topic="3">
<response text="A knight! Are you sure? The decision is irreversible!!">
<!--n2: 1 = sorcerer, 2 = druid, 3 = paladin, 4 = knight-->
<action name="script">
<![CDATA[
_state.n2 = 4
_state.topic = 4
]]>
</action>
</response>
</interact>
<!--If the player does not say any profession, repeat our question-->
<interact keywords="|*|" topic="3">
<response text="Do you wish to be a knight, paladin, sorcerer or druid?"/>
</interact>
<interact keywords="yes" topic="4">
<response>
<!--n1: 1 = Silverkeep, 2 = Forsaken Bay, 3 = ELVEN-TOWN-NAME, 4 = DWARVEN-TOWN-NAME-->
<!--n2: 1 = knight, 2 = paladin, 3 = sorcerer, 4 = druid-->
<action name="script">
<![CDATA[
local pos = 0
if(_state.n1 == 1) then
pos = {x=628, y=589, z=9}
elseif(_state.n1 == 2) then
pos = {x=772, y=568, z=6}
elseif(_state.n1 == 3) then
pos = {x=180, y=233, z=7}
elseif(_state.n1 == 4) then
pos = {x=180, y=233, z=7}
else
selfSay("I do not recognise what profession that is.")
return
end
selfSay("SO BE IT!")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
if(doTeleportThing(cid, pos) == 0) then
doPlayerSetTown(cid, _state.n1)
doPlayerSetVocation(cid, _state.n2)
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 then!."/>
</interact>
<interact event="onBusy">
<response text="Please show some patience!">
<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="Come back once you are ready to begin your journey!"/>
</interact>
</interaction>
</npc>
Like if a player is playing on a premium account AND is an elf, the Oracle would say:
The Oracle: In which town do you wish to live: Silverkeep or Forsaken Bay?
The Oracle: Or, as you are an Elf perhaps ELVEN-TOWN-NAME?
So, any ideas of where I went wrong?