-- WAS NOT Made by Coltain13 // Coltain, I only made it work for TFS --
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
-- OTServ event handling functions start
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
-- OTServ event handling functions end
function creatureSayCallback(cid, type, msg)
-- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
if(npcHandler.focus ~= cid) then
return false
end
player_gold = getPlayerItemCount(cid,2148)
player_plat = getPlayerItemCount(cid,2152)*100
player_crys = getPlayerItemCount(cid,2160)*10000
player_money = player_gold + player_plat + player_crys
playerCap = getPlayerFreeCap(cid)
item = 8293 --Hallowed Axe
itemweight = getItemWeight(item, 1)
if msgcontains(msg, 'hallowed axe') then
if isPlayer(cid) then
if getPlayerItemCount(cid,2386) >= 1 player_money >= 3500000 then
selfSay('Do you want to buy a Hallowed Axe from me?')
talk_state = 1
else
selfSay('You have to bring me an axe and 1000 gp first.')
talk_state = 0
end
else
selfSay('You need premium to buy this axe from me.')
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 1 then
talk_state = 0
if getPlayerItemCount(cid,2386) >= 1 player_money >= 3500000 then
if doPlayerTakeItem(cid,2386,1) == 1 and pay(cid,3500000) and playerCap >= itemweight then
selfSay('Here you are. You can now defeat the demon oak with this axe.')
doPlayerAddItem(cid,item,1)
talk_state = 0
else
selfSay('The Hallowed Axe is too heavy for you. Make sure that you have enough capacity.')
talk_state = 0
end
else
selfSay('Please bring with you an axe and enough with money.')
talk_state = 0
end
elseif msgcontains(msg, 'demon oak') then
if getPlayerItemCount(cid,2386) >= 1 player_money >= 3500000 then
selfSay('Did you defeat the demon oak?')
talk_state = 2
else
selfSay('Go defeat the demon oak.')
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 2 then
talk_state = 0
[B][COLOR="Red"] if getPlayerStorageValue(cid,21545) == 1 then
selfSay('Good job!')
setPlayerStorageValue(cid,21545,2)[/COLOR][/B]
end
------------------------------------------------ confirm no ------------------------------------------------
elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 1) then
selfSay('Ok thanks.')
talk_state = 0
end
-- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
-- WAS NOT Made by Coltain13 // Coltain, I only made it work for TFS --
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
-- OTServ event handling functions start
function onCreatureAppear(cid) npcHandlernCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandlernCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandlernCreatureSay(cid, type, msg) end
function onThink() npcHandlernThink() end
-- OTServ event handling functions end
function creatureSayCallback(cid, type, msg)
-- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
if(npcHandler.focus ~= cid) then
return false
end
player_gold = getPlayerItemCount(cid,2148)
player_plat = getPlayerItemCount(cid,2152)*100
player_crys = getPlayerItemCount(cid,2160)*10000
player_money = player_gold + player_plat + player_crys
playerCap = getPlayerFreeCap(cid)
item = 8293 --Hallowed Axe
itemweight = getItemWeight(item, 1)
if msgcontains(msg, 'hallowed axe') then
if isPremium(cid) == TRUE then
if getPlayerItemCount(cid,2386) >= 1 and player_money >= 3500000 then
selfSay('Do you want to buy a Hallowed Axe from me?')
talk_state = 1
else
selfSay('You have to bring me an axe and 3500000 gp first.')
talk_state = 0
end
else
selfSay('You need premium to buy this axe from me.')
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 1 then
talk_state = 0
if getPlayerItemCount(cid,2386) >= 1 and player_money >= 3500000 then
if playerCap >= itemweight then
if doPlayerTakeItem(cid,2386,1) == 1 and pay(cid,3500000) then
selfSay('Here you are. You can now defeat the demon oak with this axe.')
doPlayerAddItem(cid,item,1)
talk_state = 0
else
talk_state = 0
end
else
selfSay('The Hallowed Axe is too heavy for you. Make sure that you have enough capacity.')
talk_state = 0
end
else
selfSay('Please bring with you an axe and enough with money.')
talk_state = 0
end
elseif msgcontains(msg, 'demon oak') then
if getPlayerItemCount(cid,2386) >= 1 and player_money >= 3500000 then
selfSay('Did you defeat the demon oak?')
talk_state = 2
selfSay('Go defeat the demon oak.')
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 2 then
talk_state = 0
if getPlayerStorageValue(cid,21545) == 1 then
selfSay('Good job!')
setPlayerStorageValue(cid,21545,2)
end
------------------------------------------------ confirm no ------------------------------------------------
elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 1) then
selfSay('Ok thanks.')
talk_state = 0
end
-- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
function onUse(cid,item,frompos,item2,topos)
number = math.random(1,100)
chance = 80
minItem = 1
maxItem = 3
if chance > 100 or chance == 0 then
chance = 100
end
-----------------------------------------------------------------------------------------
-- Variables
leftspikedballpos11 = {x=topos.x-3, y=topos.y+2, z=topos.z}
leftspikedballpos12 = {x=topos.x+5, y=topos.y+2, z=topos.z}
leftspikedballpos13 = {x=topos.x-3, y=topos.y-3, z=topos.z}
leftspikedballpos14 = {x=topos.x+5, y=topos.y-3, z=topos.z}
leftspikedballpos21 = {x=topos.x-3, y=topos.y-2, z=topos.z}
leftspikedballpos22 = {x=topos.x-4, y=topos.y-1, z=topos.z}
leftspikedballpos31 = {x=topos.x-3, y=topos.y+3, z=topos.z}
leftspikedballpos32 = {x=topos.x-4, y=topos.y+2, z=topos.z}
birdpos11 = {x=topos.x+1, y=topos.y+2, z=topos.z}
birdpos12 = {x=topos.x+3, y=topos.y+1, z=topos.z}
birdpos13 = {x=topos.x+2, y=topos.y, z=topos.z}
birdpos14 = {x=topos.x+5, y=topos.y, z=topos.z}
birdpos21 = {x=topos.x+1, y=topos.y+2, z=topos.z}
birdpos22 = {x=topos.x+3, y=topos.y+1, z=topos.z}
birdpos31 = {x=topos.x-4, y=topos.y+1, z=topos.z}
birdpos32 = {x=topos.x-4, y=topos.y, z=topos.z}
rightspikedballpos11 = {x=topos.x+2, y=topos.y, z=topos.z}
rightspikedballpos12 = {x=topos.x+2, y=topos.y-2, z=topos.z}
rightspikedballpos13 = {x=topos.x+1, y=topos.y+2, z=topos.z}
rightspikedballpos14 = {x=topos.x+3, y=topos.y+1, z=topos.z}
rightspikedballpos21 = {x=topos.x+2, y=topos.y+2, z=topos.z}
rightspikedballpos22 = {x=topos.x+2, y=topos.y+1, z=topos.z}
rightspikedballpos31 = {x=topos.x-6, y=topos.y+4, z=topos.z}
rightspikedballpos32 = {x=topos.x-6, y=topos.y+1, z=topos.z}
faceoftreepos11 = {x=topos.x-3, y=topos.y-1, z=topos.z}
faceoftreepos12 = {x=topos.x+3, y=topos.y-1, z=topos.z}
faceoftreepos13 = {x=topos.x+2, y=topos.y-2, z=topos.z}
faceoftreepos14 = {x=topos.x-2, y=topos.y-2, z=topos.z}
faceoftreepos21 = {x=topos.x-4, y=topos.y-1, z=topos.z}
faceoftreepos22 = {x=topos.x-3, y=topos.y-3, z=topos.z}
faceoftreepos31 = {x=topos.x-5, y=topos.y+4, z=topos.z}
faceoftreepos32 = {x=topos.x-3, y=topos.y+3, z=topos.z}
-----------------------------------------------------------------------------------------
--------------------Demon oak(The left spiked ball)--------------------
if item2.itemid == 8289 then
leftspikedball = getPlayerStorageValue(cid,20000)
if leftspikedball == -1 or leftspikedball == 0 then
if number <= chance then
surp = math.random(minItem, maxItem)
if surp == 1 then
if number <= 75 then
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("bone beast",leftspikedballpos11)
doSummonCreature("bone beast",leftspikedballpos12)
doSummonCreature("bone beast",leftspikedballpos13)
doSummonCreature("bone beast",leftspikedballpos14)
else
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("lich",leftspikedballpos11)
doSummonCreature("lich",leftspikedballpos12)
doSummonCreature("lich",leftspikedballpos13)
doSummonCreature("lich",leftspikedballpos14)
end
end
if surp == 2 then
if number <= 75 then
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("lich",leftspikedballpos21)
doSummonCreature("giant spider",leftspikedballpos22)
else
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("grim reaper",leftspikedballpos21)
doSummonCreature("dark torturerdemon",leftspikedballpos22)
end
end
if surp == 3 then
if number <= 50 then
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("undead dragon",leftspikedballpos31)
else
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("grim reaper",leftspikedballpos31)
doSummonCreature("dark torturer",leftspikedballpos32)
end
end
else
doSendMagicEffect(topos,2)
setPlayerStorageValue(cid,20000,1)
end
else
doSendMagicEffect(topos,2)
end
return 1
end
--------------------Demon oak(The bird)--------------------
if item2.itemid == 8288 then
bird = getPlayerStorageValue(cid,20001)
if bird == -1 or bird == 0 then
if number <= chance then
surp = math.random(minItem, maxItem)
if surp == 1 then
if number <= 75 then
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("banshee",birdpos11)
doSummonCreature("banshee",birdpos12)
doSummonCreature("banshee",birdpos13)
doSummonCreature("banshee",birdpos14)
else
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("braindeath",birdpos11)
doSummonCreature("braindeath",birdpos12)
doSummonCreature("braindeath",birdpos13)
doSummonCreature("braindeath",birdpos14)
end
end
if surp == 2 then
if number <= 75 then
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("demon",birdpos21)
doSummonCreature("diabolic imp",birdpos22)
else
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("blightwalker",birdpos21)
doSummonCreature("betrayed wraith",birdpos22)
end
end
if surp == 3 then
if number <= 50 then
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("undead dragon",birdpos31)
else
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("hand of cursed fate",birdpos31)
doSummonCreature("dark torturer",birdpos32)
end
end
else
doSendMagicEffect(topos,2)
setPlayerStorageValue(cid,20001,1)
end
else
doSendMagicEffect(topos,2)
end
return 1
end
--------------------Demon oak(The right spiked ball)--------------------
if item2.itemid == 8290 then
rightspikedball = getPlayerStorageValue(cid,20002)
if rightspikedball == -1 or rightspikedball == 0 then
if number <= chance then
surp = math.random(minItem, maxItem)
if surp == 1 then
if number <= 75 then
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("lich",rightspikedballpos11)
doSummonCreature("lich",rightspikedballpos12)
doSummonCreature("lich",rightspikedballpos13)
doSummonCreature("lich",rightspikedballpos14)
else
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("giant spider",rightspikedballpos11)
doSummonCreature("giant spider",rightspikedballpos12)
doSummonCreature("giant spider",rightspikedballpos13)
doSummonCreature("giant spider",rightspikedballpos14)
end
end
if surp == 2 then
if number <= 75 then
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("dark torturer",rightspikedballpos21)
doSummonCreature("demon",rightspikedballpos22)
else
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("diabolic imp",rightspikedballpos21)
doSummonCreature("diabolic imp",rightspikedballpos22)
end
end
if surp == 3 then
if number <= 50 then
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("hand of cursed fate",rightspikedballpos31)
else
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("grim reaper",rightspikedballpos31)
doSummonCreature("grim reaper",rightspikedballpos32)
end
end
else
doSendMagicEffect(topos,2)
setPlayerStorageValue(cid,20002,1)
end
else
doSendMagicEffect(topos,2)
end
return 1
end
--------------------Demon oak(The face of the tree)--------------------
if item2.itemid == 8291 then
faceoftree = getPlayerStorageValue(cid,20003)
if faceoftree == -1 or faceoftree == 0 then
if number <= chance then
surp = math.random(minItem, maxItem)
if surp == 1 then
if number <= 75 then
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("vampire",faceoftreepos11)
doSummonCreature("vampire",faceoftreepos12)
doSummonCreature("vampire",faceoftreepos13)
doSummonCreature("vampire",faceoftreepos14)
else
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("diabolic imp",faceoftreepos11)
doSummonCreature("diabolic imp",faceoftreepos12)
doSummonCreature("diabolic imp",faceoftreepos13)
doSummonCreature("diabolic imp",faceoftreepos14)
end
end
if surp == 2 then
if number <= 75 then
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("demon",faceoftreepos21)
doSummonCreature("grim reaper",faceoftreepos22)
else
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("hand of cursed fate",faceoftreepos21)
doSummonCreature("hand of cursed fate",faceoftreepos22)
end
end
if surp == 3 then
if number <= 50 then
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("undead dragon",faceoftreepos31)
doSummonCreature("hand of cursed fate",faceoftreepos32)
else
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("grim reaper",faceoftreepos31)
doSummonCreature("hand of cursed fate",faceoftreepos32)
end
end
else
doSendMagicEffect(topos,2)
setPlayerStorageValue(cid,20003,1)
end
else
doSendMagicEffect(topos,2)
end
return 1
end
return 0
end
<?xml version="1.0"?>
<npc name="Oldrak" floorchange="0" walkinterval="4000">
<health now="150" max="150"/>
<look type="57" head="20" body="120" legs="75" feet="13"/>
<interaction range="3" idletime="0" defaultpublic="0">
<interact keywords="hi" focus="1">
<!--These are the alternative keywords-->
<keywords>hello</keywords>
<response text="Hello |NAME|."/>
</interact>
<interact keywords="bye" focus="0">
<keywords>farewell</keywords>
<response text="Good job!">
<!--
<action name="script">
doRemoveCreature(getNpcCid());
</action>
-->
</response>
</interact>
<interact event="onPlayerLeave" focus="0">
<response text="It was a pleasure to help you |NAME|."/>
</interact>
<!--Example of using storage values, storageComp can be less/lessorequal/equal/greater/greaterorequal-->
<!--In this example it checks if the storage value of 5500 is less than 0-->
<!--Another way to write it would be storageValue="-1" storageComp="equal"-->
<!--Basically we check if the storage id of 5500 is -1, ie. not having any value yet.-->
<interact keywords="demon;oak" storageId="21545" storageValue="0" storageComp="less">
<response text="Did you defeat the demon oak?">
<interact keywords="yes">
<response text="Go defeat the demon oak.">
<action name="storage" key="21545" value="1"/>
</response>
</interact>
</response>
</interact>
<interact keywords="demon;oak" storageId="21545" storageValue="1" storageComp="equal">
<response text="You already know my secret, now leave me alone!">
<action name="idle" value="1"/>
</response>
</interact>
<!-->End of example of using storage value-->
<!-- Buy item(s) interaction, see merchant glut for a real seller/buyer npc-->
<interact keywords="|AMOUNT|;hallowed;axe">
<keywords>hallowed;axe</keywords>
<response text="Do you want to buy a Hallowed Axe from me?">
<action name="topic" value="3"/>
<action name="item" value="8293"/>
<action name="price" value="1000"/>
<action name="amount" value="|AMOUNT|"/>
</response>
</interact>
<interact keywords="yes" topic="3">
<response param="lowmoney" text="Please bring you enough with money."/>
<response text="Here you are. You can now defeat the demon oak with this axe.">
<action name="buy" value="|PRICE|"/>
</response>
</interact>
<!-- End of buy item(s) interaction-->
</interaction>
</npc>
<?xml version="1.0"?>
<npc name="Oldrak" floorchange="0" walkinterval="4000">
<health now="150" max="150"/>
<look type="57" head="20" body="120" legs="75" feet="13"/>
<interaction range="3" idletime="0" defaultpublic="0">
<interact keywords="hi" focus="1">
<!--These are the alternative keywords-->
<keywords>hello</keywords>
<response text="Hello |NAME|."/>
</interact>
<interact keywords="bye" focus="0">
<keywords>farewell</keywords>
<response text="Good job!">
<!--
<action name="script">
doRemoveCreature(getNpcCid());
</action>
-->
</response>
</interact>
<interact event="onPlayerLeave" focus="0">
<response text="It was a pleasure to help you |NAME|."/>
</interact>
<!--Example of using storage values, storageComp can be less/lessorequal/equal/greater/greaterorequal-->
<!--In this example it checks if the storage value of 5500 is less than 0-->
<!--Another way to write it would be storageValue="-1" storageComp="equal"-->
<!--Basically we check if the storage id of 5500 is -1, ie. not having any value yet.-->
<interact keywords="demon;oak" storageId="21545" storageValue="0" storageComp="less">
<response text="Did you defeat the demon oak?">
<interact keywords="yes">
<response text="Go defeat the demon oak.">
<action name="storage" key="21545" value="1"/>
</response>
</interact>
</response>
</interact>
<interact keywords="demon;oak" storageId="21545" storageValue="1" storageComp="equal">
<response text="You already know my secret, now leave me alone!">
<action name="idle" value="1"/>
</response>
</interact>
<!-->End of example of using storage value-->
<!-- Buy item(s) interaction, see merchant glut for a real seller/buyer npc-->
<interact keywords="|AMOUNT|;hallowed;axe">
<keywords>hallowed;axe</keywords>
<response text="Do you want to buy a Hallowed Axe from me?">
<action name="topic" value="3"/>
<action name="item" value="8293"/>
<action name="price" value="1000"/>
<action name="amount" value="|AMOUNT|"/>
</response>
</interact>
<interact keywords="yes" topic="3">
<response param="lowmoney" text="Please bring you enough with money."/>
<response text="Here you are. You can now defeat the demon oak with this axe.">
<action name="buy" value="|PRICE|"/>
</response>
</interact>
<!-- End of buy item(s) interaction-->
</interaction>
</npc>
--- Made by Mazen ---
function onStepOut(cid, item, position, fromPosition)
if item.itemuid == 32193 then
doTransformItem(item.itemid,2717)
end
end