Here's the problem:
I managed how to work with NPCs and the quests.xml, but it also involves a movement and an action
1st - There is a hole close to the NPC. I want it so the player can't go down unless he/she started the quest: "You are not yet prepared to enter this cave."
So, player talks to NPC to start the quest, now he/she can go down the cave.
2nd - In the cave, there is another NPC the player must talk and return to the first to complete the quest and get his/her reward.
3rd - Ok, quest finished, now in the cave there is a pickhole, only when the quest IS finished, the player can Pick it, when walking on it (going down), it closes back.
Still haven't figured how to do all that, been reading the forum for a while now
----------
The NPCs are finished
However, the problem is within the damn hole (id 293 and 294)
In my movements.xml I found this line:
So, I created a new one:
and created a LUA file similar to "increment.lua"
When I step on the hole (293) I do get the green message, but... I still go down ¬¬"
Haven't tried the PICK yet, but I guess when this one is fixed, I'll be able to do it with the PICK
I managed how to work with NPCs and the quests.xml, but it also involves a movement and an action
1st - There is a hole close to the NPC. I want it so the player can't go down unless he/she started the quest: "You are not yet prepared to enter this cave."
So, player talks to NPC to start the quest, now he/she can go down the cave.
2nd - In the cave, there is another NPC the player must talk and return to the first to complete the quest and get his/her reward.
3rd - Ok, quest finished, now in the cave there is a pickhole, only when the quest IS finished, the player can Pick it, when walking on it (going down), it closes back.
Still haven't figured how to do all that, been reading the forum for a while now
----------
The NPCs are finished
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Robin" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="128" head="41" body="17" legs="90" feet="1" addons="3" mount="379"/>
<interaction range="5" idletime="150" idleinterval="300" defaultpublic="0">
<interact keywords="hi" focus="1"><keywords>hello</keywords>
<response>
<action name="script">
<![CDATA[
if (getPlayerStorageValue(cid, 40001)) == 2 then
selfSay("Hello, " .. getCreatureName(cid) .. "! Would you like to buy some fishes?", cid)
else
selfSay("Hello, " .. getCreatureName(cid) .. "! Oh my... My {brother}... My brother is missing!", cid)
end
]]>
</action>
</response>
</interact>
<interact keywords="bye" focus="0"><keywords>farewell</keywords>
<response>
<action name="script">
<![CDATA[
if (getPlayerStorageValue(cid, 40001)) == 2 then
selfSay("Good bye.", cid)
else
selfSay("Good bye and if you see him...", cid)
end
]]>
</action>
</response>
</interact>
<interact event="onBusy">
<response text="Please, wait your turn.">
<action name="addqueue" value="|NAME|"/>
</response>
</interact>
<interact event="onPlayerLeave">
<response text="Bye then..."/>
</interact>
<interact keywords="brother" storageId="40001" storageValue="0" storageComp="less">
<response text="Oh my... My brother is missing... Could you help me find him?">
<interact keywords="yes">
<response text="Thank you, thank you! I'm so happy someone is going to help me... I've heard there is a small hole near this place, perhaps he fell in there? Could you go and take a look?">
<interact keywords="yes">
<response text="Thank you! If you see him, report back immediatly, I'm sooooo worried!">
<action name="storage" key="40000" value="1"/>
<action name="storage" key="40001" value="0"/>
<action name="script">
<![CDATA[
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_BLUE)
]]>
</action>
</response>
</interact>
</response>
</interact>
</response>
</interact>
<interact keywords="report" storageId="40001" storageValue="1" storageComp="equal">
<response text="Did you find my brother?!">
<interact keywords="yes">
<response text="Oh my! What? He is... HIDING from me?! I can't believe him! Anyway, thank you very much for helping me, here is your reward!">
<action name="storage" key="40001" value="2"/>
<action name="script">
<![CDATA[
doPlayerAddExp(cid, 500)
doPlayerGiveItem(cid, 2152, 3)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_BLUE)
]]>
</action>
</response>
</interact>
</response>
</interact>
<interact keywords="reward" storageId="40001" storageValue="2" storageComp="equal">
<response><action name="script">
<![CDATA[
doPlayerAddExp(cid, 500)
doPlayerGiveItem(cid, 2152, 3)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_BLUE)
]]>
</action></response>
</interact>
<itemlist listid="fishes">
<item keywords="fish" id="2667" sellprice="2" buyprice="5"/>
<item keywords="salmon" id="2668" sellprice="0" buyprice="10"/>
</itemlist>
<interact keywords="trade">
<list>fishes</list>
<response text="Check these delicious fishes!">
<action name="script">
<![CDATA[
if (getPlayerStorageValue(cid, 40001)) == 2 then
openShopWindow(cid, itemlist, -1, -1)
else
selfSay("I am too busy now to make any business.", cid)
end
]]>
</action>
</response>
</interact>
<interact event="onPlayerShopSell">
<response>
<action name="price" value="|SELLPRICE|"/>
<action name="script">
<![CDATA[
if(doPlayerRemoveItem(cid, _state.itemid, _state.amount, _state.subtype) == TRUE) then
doPlayerAddMoney(cid, _state.price * _state.amount)
selfSay("Here you are.", cid)
else
selfSay("Sorry, you do not have one.", cid)
end
]]>
</action>
</response>
</interact>
<interact event="onPlayerShopBuy">
<response>
<action name="price" value="|BUYPRICE|"/>
<action name="script">
<![CDATA[
if(getPlayerMoney(cid) >= _state.amount * _state.price) then
--doSellItem(cid, itemid, amount, <optional> subtype, <optional> actionid, <optional: default: 1> canDropOnMap)
local sellAmount = doSellItem(cid, _state.itemid, _state.amount, _state.subtype, 0, 0)
if(sellAmount ~= _state.amount) then
if(sellAmount == 0) then
selfSay("Sorry, but you don't have room to take it.", cid)
return
elseif(sellAmount > 0) then
selfSay("I've sold some for you, but it seems you can't carry more than this. I won't take more money than necessary.", cid)
doPlayerRemoveMoney(cid, sellAmount * _state.price)
return
end
end
selfSay("Here you are.", cid)
doPlayerRemoveMoney(cid, _state.price * _state.amount)
else
selfSay("Sorry, you do not have enough gold.", cid)
end
]]>
</action>
</response>
</interact>
<interact event="onPlayerShopClose" focus="0">
<response text="It was a pleasure to help you."/>
</interact>
</interaction>
</npc>
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Brangoth" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="153" head="2" body="41" legs="110" feet="33" addons="3" mount="379"/>
<interaction range="3" idletime="150" idleinterval="300" defaultpublic="0">
<interact keywords="hi" focus="1"><keywords>hello</keywords>
<response text="Shhhh, |NAME|. My brother cannot know I am here.">
</response>
</interact>
<interact keywords="bye" focus="0"><keywords>farewell</keywords>
<response text="Good bye, |NAME|! Do not tell my brother I'm here.">
</response>
</interact>
<interact event="onBusy">
<response text="Please, be quiet.">
<action name="addqueue" value="|NAME|"/>
</response>
</interact>
<interact event="onPlayerLeave">
<response text="Shhh!"/>
</interact>
<interact keywords="brother" storageId="40001" storageValue="0" storageComp="less">
<response text="Shhhhh! Don't let my brother know I'm here... Why are you here, did he send you?">
<interact keywords="yes" focus="0">
<response text="Argh... Anyway, my brother is an... can't say, sorry. I don't want to see him for a while.">
<action name="storage" key="40001" value="1"/>
<action name="script">
<![CDATA[
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_BLUE)
]]>
</action>
</response>
</interact>
</response>
</interact>
</interaction>
</npc>
However, the problem is within the damn hole (id 293 and 294)
In my movements.xml I found this line:
Code:
<moveevent event="StepIn" itemid="293" script="increment.lua" />
Code:
<moveevent event="StepIn" uniqueid="4001" script="fishhole.lua" />
Code:
function onStepIn(cid, item, pos)
if item.uid == 4001 and getPlayerStorageValue(cid, 40001) < 0 then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You are not yet prepared to enter this place.")
doPlayerSendCancel(cid, "")
end
return true
end
When I step on the hole (293) I do get the green message, but... I still go down ¬¬"
Haven't tried the PICK yet, but I guess when this one is fixed, I'll be able to do it with the PICK