Demon Oak Quest
This is the script for the new Demon Oak Quest(Full). It works only on TFS 3.0(Latest revision and items.otb v.3).
All credits to Mazen from ******.
THE QUEST SCRIPTS:
Don't forget to add the monsters and their positions in the script. Change "doSummonCreature("", summonmediumtwo2Position)" to for example "doSummonCreature("Demon", summonmediumtwo2Position)" . The summon positions must be inside the arena and the backpositions must be outside the arena so the player will be teleported out when he finiched the quest.
actions/scripts/tools/Hallowed Axe.lua :
Add this in the actions.xml file:
Add dotile.lua to movments :
Add this on movments.xml :
THE REWARD:
This is the reward script, quests/DOQChests.lua :
Add this on actions.xml :
THE GRAVESTONE:
This is the gravestone script. The gravestone that you have to use to teleport to the reward room.
Add this action script, DOQgravestone.lua :
Add this on actions.xml :
THE NPC:
Here is the npc that is selling you the hallowed axe.
oldrak.lua :
Oldrak.xml :
REMEMBER: REPORT BUGS IF YOU FIND ANY!
Enjoy!
This is the script for the new Demon Oak Quest(Full). It works only on TFS 3.0(Latest revision and items.otb v.3).
All credits to Mazen from ******.
THE QUEST SCRIPTS:
Don't forget to add the monsters and their positions in the script. Change "doSummonCreature("", summonmediumtwo2Position)" to for example "doSummonCreature("Demon", summonmediumtwo2Position)" . The summon positions must be inside the arena and the backpositions must be outside the arena so the player will be teleported out when he finiched the quest.
actions/scripts/tools/Hallowed Axe.lua :
Code:
--- Made by GM Rufus ---
function onUse(cid, item, fromPosition, itemEx, toPosition)
--- Config --
blocktree = {32193} --- The uniqueid of the dead tree. ---
levelneeded = 120 --- How much level you need to enter the arena ---
--- First part ---
summonweak1Position = {x=XXX, y=XXX, z=X}
summonweak2Position = {x=XXX, y=XXX, z=X}
summonweak3Position = {x=XXX, y=XXX, z=X}
summonweak4Position = {x=XXX, y=XXX, z=X}
summonweakone1Position = {x=XXX, y=XXX, z=X}
summonweakone2Position = {x=XXX, y=XXX, z=X}
summonweakone3Position = {x=XXX, y=XXX, z=X}
summonweakone4Position = {x=XXX, y=XXX, z=X}
summonweaktwo1Position = {x=XXX, y=XXX, z=X}
summonweaktwo2Position = {x=XXX, y=XXX, z=X}
summonweaktwo3Position = {x=XXX, y=XXX, z=X}
summonweaktwo4Position = {x=XXX, y=XXX, z=X}
--- Second Part ---
summonnormal1Position = {x=XXX, y=XXX, z=X}
summonnormal2Position = {x=XXX, y=XXX, z=X}
summonnormal3Position = {x=XXX, y=XXX, z=X}
summonnormal4Position = {x=XXX, y=XXX, z=X}
summonnormalone1Position = {x=XXX, y=XXX, z=X}
summonnormalone2Position = {x=XXX, y=XXX, z=X}
summonnormalone3Position = {x=XXX, y=XXX, z=X}
summonnormalone4Position = {x=XXX, y=XXX, z=X}
summonnormaltwo1Position = {x=XXX, y=XXX, z=X}
summonnormaltwo2Position = {x=XXX, y=XXX, z=X}
summonnormaltwo3Position = {x=XXX, y=XXX, z=X}
summonnormaltwo4Position = {x=XXX, y=XXX, z=X}
--- Third Part ---
summonmedium1Position = {x=XXX, y=XXX, z=X}
summonmedium2Position = {x=XXX, y=XXX, z=X}
summonmedium3Position = {x=XXX, y=XXX, z=X}
summonmedium4Position = {x=XXX, y=XXX, z=X}
summonmediumone1Position = {x=XXX, y=XXX, z=X}
summonmediumone2Position = {x=XXX, y=XXX, z=X}
summonmediumone3Position = {x=XXX, y=XXX, z=X}
summonmediumone4Position = {x=XXX, y=XXX, z=X}
summonmediumtwo1Position = {x=XXX, y=XXX, z=X}
summonmediumtwo2Position = {x=XXX, y=XXX, z=X}
summonmediumtwo3Position = {x=XXX, y=XXX, z=X}
summonmediumtwo4Position = {x=XXX, y=XXX, z=X}
--- Fourth Part ---
summonhard1Position = {x=XXX, y=XXX, z=X}
summonhard2Position = {x=XXX, y=XXX, z=X}
summonhard3Position = {x=XXX, y=XXX, z=X}
summonhard4Position = {x=XXX, y=XXX, z=X}
summonhardone1Position = {x=XXX, y=XXX, z=X}
summonhardone2Position = {x=XXX, y=XXX, z=X}
summonhardone3Position = {x=XXX, y=XXX, z=X}
summonhardone4Position = {x=XXX, y=XXX, z=X}
--- Teleport Back Positions ---
back1Position = {x=XXX, y=XXX, z=X}
back2Position = {x=XXX, y=XXX, z=X}
back3Position = {x=XXX, y=XXX, z=X}
back4Position = {x=XXX, y=XXX, z=X}
back5Position = {x=XXX, y=XXX, z=X}
--- End Config ---
demonoak = {8288, 8289, 8290, 8291}
if itemEx.itemid == 2717 and itemEx.itemuid == blocktree and getPlayerLevel(cid) >= levelneeded and (getPlayerStorageValue(cid, 21544) == 3) == FALSE then
doTransformItem(itemEx.uid, 3669)
doTeleportThing(cid, toPosition, TRUE)
elseif itemEx.itemid == demonoak then
if getPlayerStorageValue(cid, itemEx.itemid) == -1 and getPlayerStorageValue(cid, 21541) == -1 then
if math.random(1, 2) == 1 then
setPlayerStorageValue(cid, 21541, 1)
doSendMagicEffect(toPosition, 0)
doSummonCreature("", summonweak1Position)
doSummonCreature("", summonweak2Position)
doSummonCreature("", summonweak3Position)
doSummonCreature("", summonweak4Position)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -270, -310, CONST_ME_BIGPLANTS)
elseif math.random(1, 2) == 2 then
doSendMagicEffect(toPosition, 0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -270, -310, CONST_ME_BIGPLANTS)
end
elseif getPlayerStorageValue(cid, itemEx.itemid) == -1 and getPlayerStorageValue(cid, 21541) == 1 then
if math.random(1, 2) == 1 then
setPlayerStorageValue(cid, 21541, 2)
doSendMagicEffect(toPosition, 0)
doSummonCreature("", summonweakone1Position)
doSummonCreature("", summonweakone2Position)
doSummonCreature("", summonweakone3Position)
doSummonCreature("", summonweakone4Position)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -270, -310, CONST_ME_BIGPLANTS)
elseif math.random(1, 2) == 2 then
doSendMagicEffect(toPosition, 0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -270, -310, CONST_ME_BIGPLANTS)
end
elseif getPlayerStorageValue(cid, itemEx.itemid) == -1 and getPlayerStorageValue(cid, 21541) == 2 then
if math.random(1, 2) == 1 then
setPlayerStorageValue(cid, 21541, 3)
doSendMagicEffect(toPosition, 0)
doSummonCreature("", summonweaktwo1Position)
doSummonCreature("", summonweaktwo2Position)
doSummonCreature("", summonweaktwo3Position)
doSummonCreature("", summonweaktwo4Position)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -270, -310, CONST_ME_BIGPLANTS)
if itemEx.itemid == 8288 then
setPlayerStorageValue(cid, itemEx.itemid, 1)
elseif itemEx.itemid == 8289 then
setPlayerStorageValue(cid, itemEx.itemid, 1)
elseif itemEx.itemid == 8290 then
setPlayerStorageValue(cid, itemEx.itemid, 1)
elseif itemEx.itemid == 8291 then
setPlayerStorageValue(cid, itemEx.itemid, 1)
end
elseif math.random(1, 2) == 2 then
doSendMagicEffect(toPosition, 0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -270, -310, CONST_ME_BIGPLANTS)
end
elseif getPlayerStorageValue(cid, itemEx.itemid) == -1 and getPlayerStorageValue(cid, 21541) == 3 and getPlayerStorageValue(cid, 21542) == -1 then
if math.random(1, 2) == 1 then
setPlayerStorageValue(cid, 21542, 1)
doSendMagicEffect(toPosition, 0)
doSummonCreature("", summonnormal1Position)
doSummonCreature("", summonnormal2Position)
doSummonCreature("", summonnormal3Position)
doSummonCreature("", summonnormal4Position)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -270, -310, CONST_ME_BIGPLANTS)
elseif math.random(1, 2) == 2 then
doSendMagicEffect(toPosition, 0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -270, -310, CONST_ME_BIGPLANTS)
end
elseif getPlayerStorageValue(cid, itemEx.itemid) == -1 and getPlayerStorageValue(cid, 21541) == 3 and getPlayerStorageValue(cid, 21542) == 1 then
if math.random(1, 2) == 1 then
setPlayerStorageValue(cid, 21542, 2)
doSendMagicEffect(toPosition, 0)
doSummonCreature("", summonnormalone1Position)
doSummonCreature("", summonnormalone2Position)
doSummonCreature("", summonnormalone3Position)
doSummonCreature("", summonnormalone4Position)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -270, -310, CONST_ME_BIGPLANTS)
elseif math.random(1, 2) == 2 then
doSendMagicEffect(toPosition, 0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -270, -310, CONST_ME_BIGPLANTS)
end
elseif getPlayerStorageValue(cid, itemEx.itemid) == -1 and getPlayerStorageValue(cid, 21541) == 3 and getPlayerStorageValue(cid, 21542) == 2 then
if math.random(1, 2) == 1 then
setPlayerStorageValue(cid, 21542, 3)
doSendMagicEffect(toPosition, 0)
doSummonCreature("", summonnormaltwo1Position)
doSummonCreature("", summonnormaltwo2Position)
doSummonCreature("", summonnormaltwo3Position)
doSummonCreature("", summonnormaltwo4Position)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -270, -310, CONST_ME_BIGPLANTS)
if itemEx.itemid == 8288 then
setPlayerStorageValue(cid, itemEx.itemid, 1)
elseif itemEx.itemid == 8289 then
setPlayerStorageValue(cid, itemEx.itemid, 1)
elseif itemEx.itemid == 8290 then
setPlayerStorageValue(cid, itemEx.itemid, 1)
elseif itemEx.itemid == 8291 then
setPlayerStorageValue(cid, itemEx.itemid, 1)
end
elseif math.random(1, 2) == 2 then
doSendMagicEffect(toPosition, 0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -270, -310, CONST_ME_BIGPLANTS)
end
elseif getPlayerStorageValue(cid, itemEx.itemid) == -1 and getPlayerStorageValue(cid, 21541) == 3 and getPlayerStorageValue(cid, 21542) == 3 and getPlayerStorageValue(cid, 21543) == -1 then
if math.random(1, 2) == 1 then
setPlayerStorageValue(cid, 21543, 1)
doSendMagicEffect(toPosition, 0)
doSummonCreature("", summonmedium1Position)
doSummonCreature("", summonmedium2Position)
doSummonCreature("", summonmedium3Position)
doSummonCreature("", summonmedium4Position)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -270, -310, CONST_ME_BIGPLANTS)
elseif math.random(1, 2) == 2 then
doSendMagicEffect(toPosition, 0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -270, -310, CONST_ME_BIGPLANTS)
end
elseif getPlayerStorageValue(cid, itemEx.itemid) == -1 and getPlayerStorageValue(cid, 21541) == 3 and getPlayerStorageValue(cid, 21542) == 3 and getPlayerStorageValue(cid, 21543) == 1 then
if math.random(1, 2) == 1 then
setPlayerStorageValue(cid, 21543, 2)
doSendMagicEffect(toPosition, 0)
doSummonCreature("", summonmediumone1Position)
doSummonCreature("", summonmediumone2Position)
doSummonCreature("", summonmediumone3Position)
doSummonCreature("", summonmediumone4Position)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -270, -310, CONST_ME_BIGPLANTS)
elseif math.random(1, 2) == 2 then
doSendMagicEffect(toPosition, 0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -270, -310, CONST_ME_BIGPLANTS)
end
elseif getPlayerStorageValue(cid, itemEx.itemid) == -1 and getPlayerStorageValue(cid, 21541) == 3 and getPlayerStorageValue(cid, 21542) == 3 and getPlayerStorageValue(cid, 21543) == 2 then
if math.random(1, 2) == 1 then
setPlayerStorageValue(cid, 21543, 3)
doSendMagicEffect(toPosition, 0)
doSummonCreature("", summonmediumtwo1Position)
doSummonCreature("", summonmediumtwo2Position)
doSummonCreature("", summonmediumtwo3Position)
doSummonCreature("", summonmediumtwo4Position)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -270, -310, CONST_ME_BIGPLANTS)
if itemEx.itemid == 8288 then
setPlayerStorageValue(cid, itemEx.itemid, 1)
elseif itemEx.itemid == 8289 then
setPlayerStorageValue(cid, itemEx.itemid, 1)
elseif itemEx.itemid == 8290 then
setPlayerStorageValue(cid, itemEx.itemid, 1)
elseif itemEx.itemid == 8291 then
setPlayerStorageValue(cid, itemEx.itemid, 1)
end
elseif math.random(1, 2) == 2 then
doSendMagicEffect(toPosition, 0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -270, -310, CONST_ME_BIGPLANTS)
end
elseif getPlayerStorageValue(cid, itemEx.itemid) == -1 and getPlayerStorageValue(cid, 21541) == 3 and getPlayerStorageValue(cid, 21542) == 3 and getPlayerStorageValue(cid, 21543) == 3 and getPlayerStorageValue(cid, 21544) == -1 then
if math.random(1, 2) == 1 then
setPlayerStorageValue(cid, 21544, 1)
doSendMagicEffect(toPosition, 0)
doSummonCreature("", summonmedium1Position)
doSummonCreature("", summonmedium2Position)
doSummonCreature("", summonmedium3Position)
doSummonCreature("", summonmedium4Position)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -270, -310, CONST_ME_BIGPLANTS)
elseif math.random(1, 2) == 2 then
doSendMagicEffect(toPosition, 0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -270, -310, CONST_ME_BIGPLANTS)
end
elseif getPlayerStorageValue(cid, itemEx.itemid) == -1 and getPlayerStorageValue(cid, 21541) == 3 and getPlayerStorageValue(cid, 21542) == 3 and getPlayerStorageValue(cid, 21543) == 3 and getPlayerStorageValue(cid, 21544) == 1 then
if math.random(1, 2) == 1 then
setPlayerStorageValue(cid, 21544, 2)
doSendMagicEffect(toPosition, 0)
doSummonCreature("", summonmediumone1Position)
doSummonCreature("", summonmediumone2Position)
doSummonCreature("", summonmediumone3Position)
doSummonCreature("", summonmediumone4Position)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -270, -310, CONST_ME_BIGPLANTS)
elseif math.random(1, 2) == 2 then
doSendMagicEffect(toPosition, 0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -270, -310, CONST_ME_BIGPLANTS)
end
elseif getPlayerStorageValue(cid, itemEx.itemid) == -1 and getPlayerStorageValue(cid, 21541) == 3 and getPlayerStorageValue(cid, 21542) == 3 and getPlayerStorageValue(cid, 21543) == 3 and getPlayerStorageValue(cid, 21544) == 2 then
if math.random(1, 2) == 1 then
setPlayerStorageValue(cid, 21544, 3)
doSendMagicEffect(toPosition, 0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -270, -310, CONST_ME_BIGPLANTS)
if itemEx.itemid == 8288 then
setPlayerStorageValue(cid, itemEx.itemid, 1)
if getPlayerStorageValue(cid, demonoak) == 1 then
setPlayerStorageValue(cid, 21545, 1)
if math.random(1, 5) == 1 then
doSendMagicEffect(fromPosition, 10)
doTeleportThing(cid,back1Position)
elseif math.random(1, 5) == 2 then
doSendMagicEffect(fromPosition, 10)
doTeleportThing(cid,back2Position)
elseif math.random(1, 5) == 3 then
doSendMagicEffect(fromPosition, 10)
doTeleportThing(cid,back3Position)
elseif math.random(1, 5) == 4 then
doSendMagicEffect(fromPosition, 10)
doTeleportThing(cid,back4Position)
elseif math.random(1, 5) == 5 then
doSendMagicEffect(fromPosition, 10)
doTeleportThing(cid,back5Position)
end
end
elseif itemEx.itemid == 8289 then
setPlayerStorageValue(cid, itemEx.itemid, 1)
if getPlayerStorageValue(cid, demonoak) == 1 then
setPlayerStorageValue(cid, 21545, 1)
if math.random(1, 5) == 1 then
doSendMagicEffect(fromPosition, 10)
doTeleportThing(cid,back1Position)
elseif math.random(1, 5) == 2 then
doSendMagicEffect(fromPosition, 10)
doTeleportThing(cid,back2Position)
elseif math.random(1, 5) == 3 then
doSendMagicEffect(fromPosition, 10)
doTeleportThing(cid,back3Position)
elseif math.random(1, 5) == 4 then
doSendMagicEffect(fromPosition, 10)
doTeleportThing(cid,back4Position)
elseif math.random(1, 5) == 5 then
doSendMagicEffect(fromPosition, 10)
doTeleportThing(cid,back5Position)
end
end
elseif itemEx.itemid == 8290 then
setPlayerStorageValue(cid, itemEx.itemid, 1)
if getPlayerStorageValue(cid, demonoak) == 1 then
setPlayerStorageValue(cid, 21545, 1)
if math.random(1, 5) == 1 then
doSendMagicEffect(fromPosition, 10)
doTeleportThing(cid,back1Position)
elseif math.random(1, 5) == 2 then
doSendMagicEffect(fromPosition, 10)
doTeleportThing(cid,back2Position)
elseif math.random(1, 5) == 3 then
doSendMagicEffect(fromPosition, 10)
doTeleportThing(cid,back3Position)
elseif math.random(1, 5) == 4 then
doSendMagicEffect(fromPosition, 10)
doTeleportThing(cid,back4Position)
elseif math.random(1, 5) == 5 then
doSendMagicEffect(fromPosition, 10)
doTeleportThing(cid,back5Position)
end
end
elseif itemEx.itemid == 8291 then
setPlayerStorageValue(cid, itemEx.itemid, 1)
if getPlayerStorageValue(cid, demonoak) == 1 then
setPlayerStorageValue(cid, 21545, 1)
if math.random(1, 5) == 1 then
doSendMagicEffect(fromPosition, 10)
doTeleportThing(cid,back1Position)
elseif math.random(1, 5) == 2 then
doSendMagicEffect(fromPosition, 10)
doTeleportThing(cid,back2Position)
elseif math.random(1, 5) == 3 then
doSendMagicEffect(fromPosition, 10)
doTeleportThing(cid,back3Position)
elseif math.random(1, 5) == 4 then
doSendMagicEffect(fromPosition, 10)
doTeleportThing(cid,back4Position)
elseif math.random(1, 5) == 5 then
doSendMagicEffect(fromPosition, 10)
doTeleportThing(cid,back5Position)
end
end
end
elseif math.random(1, 2) == 2 then
doSendMagicEffect(toPosition, 0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -270, -310, CONST_ME_BIGPLANTS)
end
else
doSendMagicEffect(toPosition, 2)
end
end
return TRUE
end
Add this in the actions.xml file:
Code:
<action itemid="8293" script="tools/Hallowed Axe.lua"/>
Add dotile.lua to movments :
Code:
--- Made by Mazen ---
function onStepOut(cid, item, position, fromPosition)
if item.itemuid == 32193 then
doTransformItem(item.itemid,2717)
end
end
Add this on movments.xml :
Code:
<movevent event="StepOut" uniqueid="32193" script="dotile.lua" />
THE REWARD:
This is the reward script, quests/DOQChests.lua :
Code:
--- Made by Mazen ---
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.uid == 12901 then
queststatus = getPlayerStorageValue(cid,50090)
if queststatus == -1 then
doPlayerSendTextMessage(cid,22,"You have found a Demon Legs.")
doPlayerAddItem(cid,2495,1)
setPlayerStorageValue(cid,50090,1)
else
doPlayerSendTextMessage(cid,22,"It is empty.")
end
elseif item.uid == 12902 then
queststatus = getPlayerStorageValue(cid,50090)
if queststatus == -1 then
doPlayerSendTextMessage(cid,22,"You have found a Rainbow Shield.")
doPlayerAddItem(cid,8905,1)
setPlayerStorageValue(cid,50090,1)
else
doPlayerSendTextMessage(cid,22,"It is empty.")
end
elseif item.uid == 12903 then
queststatus = getPlayerStorageValue(cid,50090)
if queststatus == -1 then
doPlayerSendTextMessage(cid,22,"You have found a Spellbook of Dark Mysteries.")
doPlayerAddItem(cid,8918,1)
setPlayerStorageValue(cid,50090,1)
else
doPlayerSendTextMessage(cid,22,"It is empty.")
end
elseif item.uid == 12904 then
queststatus = getPlayerStorageValue(cid,50090)
if queststatus == -1 then
doPlayerSendTextMessage(cid,22,"You have found a Royal Crossbow.")
doPlayerAddItem(cid,8851,1)
setPlayerStorageValue(cid,50090,1)
else
doPlayerSendTextMessage(cid,22,"It is empty.")
end
end
return 1
end
Add this on actions.xml :
Code:
<action uniqueid="12901" script="quests/DOQChest.lua.lua" /> --- Demon Legs ---
<action uniqueid="12902" script="quests/DOQChest.lua.lua" /> --- Rainbow Shield ---
<action uniqueid="12903" script="quests/DOQChest.lua.lua" /> --- Spellbook of Dark Mysteries ---
<action uniqueid="12904" script="quests/DOQChest.lua.lua" /> --- Royal Crossbow ---
THE GRAVESTONE:
This is the gravestone script. The gravestone that you have to use to teleport to the reward room.
Add this action script, DOQgravestone.lua :
Code:
--- Made by Mazen ---
function onUse(cid, item, fromPosition, itemEx, toPosition)
newnPosition = {x=XXX, y=XXX, z=X} --- Reward Room Position ---
if item.itemuid == 55100 and getPlayerStorageValue(cid,21545) == 2 then
doTeleportThing(cid,newnPosition)
doSendMagicEffect(newnPosition,10)
else
return 0
end
return 1
end
Add this on actions.xml :
Code:
<action uniqueid="55100" script="DOQgravestone.lua" />
THE NPC:
Here is the npc that is selling you the hallowed axe.
oldrak.lua :
Code:
-- 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 isPremium(cid) == TRUE 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 and 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 and 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
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())
Oldrak.xml :
Code:
<npc name="Oldrak" script="data/npc/scripts/oldrak.lua" walkinterval="2000" floorchange="0" access="3" level="1" maglevel="1">
<health now="150" max="150"/>
<look type="57" head="115" body="113" legs="31" feet="38" addons="3" corpse="2212"/>
<parameters>
<parameter key="message_greet" value="Hello, |PLAYERNAME|!" />
<parameter key="message_needmoremoney" value="Try again when you have more money."/>
<parameter key="message_decline" value="Why would you tease me like that?"/>
</parameters>
</npc>
REMEMBER: REPORT BUGS IF YOU FIND ANY!
Enjoy!
Last edited: