Creon
Well-Known Member
Ive got this npc which gives you blessings and it works fine. You only lose around 1-2 lvls, But you lose all your items. Im not sure how to fix this. Please help. Here is the npc:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Oliver" floorchange="0" walkinterval="0">
<health now="150" max="150"/>
<look type="128" head="77" body="65" legs="59" feet="116" addons="1"/>
<interaction range="3" idletime="30">
<interact keywords="hi" focus="1">
<!--These are the keywords will trigger this interaction-->
<keywords>hello</keywords>
<keywords>greet</keywords>
<keywords>hei</keywords>
<response>
<action name="script">
selfSay("Hello there, I sell blessings. Just type {first blessing} to buy first blessing, second, third and so on...", cid)
</action>
</response>
</interact>
<interact keywords="first">
<response>
<action name="script">
if getPlayerBlessing(cid, 1) then
selfSay('You already have this blessing.', cid)
else
if doPlayerRemoveMoney(cid, 10000) == true then
doPlayerAddBlessing(cid, 1)
selfSay('You got the first blessing!', cid)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_HOLYDAMAGE)
else
selfSay('You need 10k for this blessing!', cid)
end
end
</action>
</response>
</interact>
<interact keywords="second">
<response>
<action name="script">
if getPlayerBlessing(cid, 2) then
selfSay('You already have this blessing.', cid)
else
if doPlayerRemoveMoney(cid, 10000) == true then
doPlayerAddBlessing(cid, 2)
selfSay('You got the second blessing!', cid)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_HOLYDAMAGE)
else
selfSay('You need 10k for this blessing!', cid)
end
end
</action>
</response>
</interact>
<interact keywords="third">
<response>
<action name="script">
if getPlayerBlessing(cid, 3) then
selfSay('You already have this blessing.', cid)
else
if doPlayerRemoveMoney(cid, 10000) == true then
doPlayerAddBlessing(cid, 3)
selfSay('You got the third blessing!', cid)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_HOLYDAMAGE)
else
selfSay('You need 10k for this blessing!', cid)
end
end
</action>
</response>
</interact>
<interact keywords="fourth">
<response>
<action name="script">
if getPlayerBlessing(cid, 4) then
selfSay('You already have this blessing.', cid)
else
if doPlayerRemoveMoney(cid, 10000) == true then
doPlayerAddBlessing(cid, 4)
selfSay('You got the fourth blessing!', cid)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_HOLYDAMAGE)
else
selfSay('You need 10k for this blessing!', cid)
end
end
</action>
</response>
</interact>
<interact keywords="fifth">
<response>
<action name="script">
if getPlayerBlessing(cid, 5) then
selfSay('You already have this blessing.', cid)
else
if doPlayerRemoveMoney(cid, 10000) == true then
doPlayerAddBlessing(cid, 5)
selfSay('You got the fifth blessing!', cid)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_HOLYDAMAGE)
else
selfSay('You need 10k for this blessing!', cid)
end
end
</action>
</response>
</interact>
<interact keywords="bye" focus="0">
<keywords>farewell</keywords>
<response>
<action name="script">
selfSay('Farewell! Good luck to you!', cid)
</action>
</response>
</interact>
</interaction>
</npc>