• 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!

scripting a npc !!!

Sexy Vampire

New Member
Joined
Jan 11, 2010
Messages
71
Reaction score
0
hi im trying to script a npc but use the item id for vampire king.
im trying to make it so her can do promotions like a king but act like the oracal dose and be a statue.
here is whut i have so far

Vamp king
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Vampire King" script="promotion.lua" walkinterval="1000" floorchange="0">
    <health now="100" max="100"/>
    <item id="9242"/>
    <parameters>
        <parameter key="message_greet" value="Hi there, how's it hanging, |PLAYERNAME|!"/>
        <parameter key="message_farewell" value="Good bye, |PLAYERNAME|!"/>
        <parameter key="module_keywords" value="1" />
        <parameter key="keywords" value="hail king;job;promotion;" />
        <parameter key="keyword_reply1" value="I greet thee, my loyal subject |PLAYERNAME|." />
        <parameter key="keyword_reply2" value="I am your sovereign, King Tibianus III, and it's my duty to provide justice and guidance for my subjects." />
        <parameter key="keyword_reply3" value="Do you want to be promoted in your vocation for 20000 gold?" />

        <parameter key="module_shop" value="1"/>
        <parameter key="shop_sellable" value="" />
        <parameter key="shop_buyable" value="" />
    </parameters>

my oracal

Code:
<?xml version="1.0" encoding="UTF-8"?>
<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">
          <!--
          if(getPlayerVocation(cid) ~= 0) then
            selfSay("SORRY, YOU HAVE ALREADY MADE YOUR CHOICE IN LIFE!")
            _state.isidle = true
            return
          end
          -->

          if(getPlayerLevel(cid)) >= 8 then
            selfSay(getCreatureName(cid) .. ", ARE YOU PREPARED O FACE YOUR DESTINY?")
            _state.b1 = (isPremium(cid) == TRUE)
            _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 is set in above-->
      <response b1="1" text="IN WHICH TOWN DO YOU WANT TO LIVE: CARLIN, EDRON, THAIS, OR VENORE?">
        <action name="topic" value="2"/>
      </response>

      <!--Normal account-->
      <response text="IN WHICH TOWN DO YOU WANT TO LIVE: CARLIN, THAIS, OR VENORE?">
        <action name="topic" value="2"/>
      </response>
    </interact>

    <interact keywords="carlin" topic="2">
      <response text="IN CARLIN! AND WHAT PROFESSION HAVE YOU CHOSEN: KNIGHT, PALADIN, SORCERER, OR DRUID?">
        <!--n1: 1 = carlin, 2 = edron, 3 = thais, 4 = venore-->
        <action name="script">
          _state.n1 = 1
          _state.topic = 3
        </action>
      </response>
    </interact>

    <interact keywords="thais" topic="2">
      <response text="IN THAIS! AND WHAT PROFESSION HAVE YOU CHOSEN: KNIGHT, PALADIN, SORCERER, OR DRUID?">
        <!--n1: 1 = carlin, 2 = edron, 3 = thais, 4 = venore-->
        <action name="script">
          _state.n1 = 2
          _state.topic = 3
        </action>
      </response>
    </interact>

    <interact keywords="venore" topic="2">
      <response text="IN VENORE! AND WHAT PROFESSION HAVE YOU CHOSEN: KNIGHT, PALADIN, SORCERER, OR DRUID?">
        <!--n1: 1 = carlin, 2 = edron, 3 = thais, 4 = venore-->
        <action name="script">
          _state.n1 = 3
          _state.topic = 3
        </action>
      </response>
    </interact>

    <interact keywords="edron" topic="2">
      <response text="YOU NEED A PREMIUM ACCOUNT IN ORDER 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 EDRON! AND WHAT PROFESSION HAVE YOU CHOSEN: KNIGHT, PALADIN, SORCERER, OR DRUID?">
        <!--n1: 1 = carlin, 2 = edron, 3 = thais, 4 = venore-->
        <action name="script">
          _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="CARLIN, EDRON, THAIS, OR VENORE?"/>
      <response text="CARLIN, EDRON, THAIS, OR VENORE?"/>
    </interact>

    <interact keywords="sorcerer" topic="3">
      <response text="A SORCERER! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!">
        <!--n2: 1 = sorcerer, 2 = druid, 3 = paladin, 4 = knight-->
        <action name="script">
          _state.n2 = 1
          _state.topic = 4
        </action>
      </response>
    </interact>

    <interact keywords="druid" topic="3">
      <response text="A DRUID! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!">
        <!--n2: 1 = sorcerer, 2 = druid, 3 = paladin, 4 = knight-->
        <action name="script">
          _state.n2 = 2
          _state.topic = 4
        </action>
      </response>
    </interact>

    <interact keywords="paladin" topic="3">
      <response text="A PALADIN! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!">
        <!--n2: 1 = sorcerer, 2 = druid, 3 = paladin, 4 = knight-->
        <action name="script">
          _state.n2 = 3
          _state.topic = 4
        </action>
      </response>
    </interact>

    <interact keywords="knight" topic="3">
      <response text="A KNIGHT! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!">
        <!--n2: 1 = sorcerer, 2 = druid, 3 = paladin, 4 = knight-->
      <action name="script">
          _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="KNIGHT, PALADIN, SORCERER, OR DRUID?"/>
    </interact>

    <interact keywords="yes" topic="4">
      <response>
        <!--n1: 1 = carlin, 2 = edron, 3 = thais, 4 = venore-->
        <!--n2: 1 = knight, 2 = paladin, 3 = sorcerer, 4 = druid-->
        <action name="script">
          local pos = 0
          if(_state.n1 == 1) then
            pos = {x=180, y=233, z=7}
          elseif(_state.n1 == 2) then
            pos = {x=180, y=233, z=7}
          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 KNOW WHAT PROFESSION THAT IS, ASK THE GODS FOR GUIDANCE!")
            return
          end

          selfSay("SO BE IT!")
          doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)

          if(doTeleportThing(cid, pos) == 0) then
            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. 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.

ty in advance :thumbup:
 
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Vampire King" script="promotion.lua" walkinterval="2000">
    <look typeex="9242"/>
    <interaction range="3" idletime="60">
    <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("SORRY, YOU HAVE ALREADY MADE YOUR CHOICE IN LIFE!")
            _state.isidle = true
            return
          end
          -->

          if(getPlayerLevel(cid)) >= 8 then
            selfSay(getCreatureName(cid) .. ", ARE YOU PREPARED O FACE YOUR DESTINY?")
            _state.b1 = (isPremium(cid) == TRUE)
            _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 is set in above-->
      <response b1="1" text="IN WHICH TOWN DO YOU WANT TO LIVE: CARLIN, EDRON, THAIS, OR VENORE?">
        <action name="topic" value="2"/>
      </response>

      <!--Normal account-->
      <response text="IN WHICH TOWN DO YOU WANT TO LIVE: CARLIN, THAIS, OR VENORE?">
        <action name="topic" value="2"/>
      </response>
    </interact>

    <interact keywords="carlin" topic="2">
      <response text="IN CARLIN! AND WHAT PROFESSION HAVE YOU CHOSEN: KNIGHT, PALADIN, SORCERER, OR DRUID?">
        <!--n1: 1 = carlin, 2 = edron, 3 = thais, 4 = venore-->
        <action name="script">
          _state.n1 = 1
          _state.topic = 3
        </action>
      </response>
    </interact>

    <interact keywords="thais" topic="2">
      <response text="IN THAIS! AND WHAT PROFESSION HAVE YOU CHOSEN: KNIGHT, PALADIN, SORCERER, OR DRUID?">
        <!--n1: 1 = carlin, 2 = edron, 3 = thais, 4 = venore-->
        <action name="script">
          _state.n1 = 2
          _state.topic = 3
        </action>
      </response>
    </interact>

    <interact keywords="venore" topic="2">
      <response text="IN VENORE! AND WHAT PROFESSION HAVE YOU CHOSEN: KNIGHT, PALADIN, SORCERER, OR DRUID?">
        <!--n1: 1 = carlin, 2 = edron, 3 = thais, 4 = venore-->
        <action name="script">
          _state.n1 = 3
          _state.topic = 3
        </action>
      </response>
    </interact>

    <interact keywords="edron" topic="2">
      <response text="YOU NEED A PREMIUM ACCOUNT IN ORDER 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 EDRON! AND WHAT PROFESSION HAVE YOU CHOSEN: KNIGHT, PALADIN, SORCERER, OR DRUID?">
        <!--n1: 1 = carlin, 2 = edron, 3 = thais, 4 = venore-->
        <action name="script">
          _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="CARLIN, EDRON, THAIS, OR VENORE?"/>
      <response text="CARLIN, EDRON, THAIS, OR VENORE?"/>
    </interact>

    <interact keywords="sorcerer" topic="3">
      <response text="A SORCERER! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!">
        <!--n2: 1 = sorcerer, 2 = druid, 3 = paladin, 4 = knight-->
        <action name="script">
          _state.n2 = 1
          _state.topic = 4
        </action>
      </response>
    </interact>

    <interact keywords="druid" topic="3">
      <response text="A DRUID! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!">
        <!--n2: 1 = sorcerer, 2 = druid, 3 = paladin, 4 = knight-->
        <action name="script">
          _state.n2 = 2
          _state.topic = 4
        </action>
      </response>
    </interact>

    <interact keywords="paladin" topic="3">
      <response text="A PALADIN! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!">
        <!--n2: 1 = sorcerer, 2 = druid, 3 = paladin, 4 = knight-->
        <action name="script">
          _state.n2 = 3
          _state.topic = 4
        </action>
      </response>
    </interact>

    <interact keywords="knight" topic="3">
      <response text="A KNIGHT! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!">
        <!--n2: 1 = sorcerer, 2 = druid, 3 = paladin, 4 = knight-->
      <action name="script">
          _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="KNIGHT, PALADIN, SORCERER, OR DRUID?"/>
    </interact>

    <interact keywords="yes" topic="4">
      <response>
        <!--n1: 1 = carlin, 2 = edron, 3 = thais, 4 = venore-->
        <!--n2: 1 = knight, 2 = paladin, 3 = sorcerer, 4 = druid-->
        <action name="script">
          local pos = 0
          if(_state.n1 == 1) then
            pos = {x=180, y=233, z=7}
          elseif(_state.n1 == 2) then
            pos = {x=180, y=233, z=7}
          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 KNOW WHAT PROFESSION THAT IS, ASK THE GODS FOR GUIDANCE!")
            return
          end

          selfSay("SO BE IT!")
          doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)

          if(doTeleportThing(cid, pos) == 0) then
            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. Recommend us, if you were satisfied with our service."/>
    </interact>
</npc>
 
Back
Top Bottom