Action Script: Demon Oak Quest

Gregor

New Member
Joined
Feb 29, 2008
Messages
770
Best answers
0
Reaction score
3
Location
UK/POLAND
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 :
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!
:D
 
Last edited:
Joined
Dec 31, 2007
Messages
176
Best answers
0
Reaction score
2
Location
Vivalla
gr8, cant try it with my rl map tho... getting crash since i updated it with the new 8.2 spawns, so now i have an 8.2 server with demon oak and inquisition quest... but not working instead of the other way around xD
 

Mazen

Developer
Joined
Aug 20, 2007
Messages
612
Best answers
0
Reaction score
36
Location
Sweden
It works only with TFS 3.0 rev. 1015+ bucous it is a 8.21 code x
 
Last edited by a moderator:
Joined
Dec 31, 2007
Messages
176
Best answers
0
Reaction score
2
Location
Vivalla
well my WHOLE SERVER HAS CRASHES SINCE THE DAWN OF 8.21 ON TFS NOT EVEN TESTED THIS SCRIPT BUT I WILL AND I HOPE IT WORKS XD
 
Joined
Dec 31, 2007
Messages
176
Best answers
0
Reaction score
2
Location
Vivalla
[02/08/2008 17:12:59] Warning: [Event::loadScript] Can not load script. data/actions/scripts/tools/Hallowed Axe.lua
[02/08/2008 17:12:59] data/actions/scripts/tools/Hallowed Axe.lua:219: 'then' expected near 'getPlayerStorageValue'

why is this?
 

Mazen

Developer
Joined
Aug 20, 2007
Messages
612
Best answers
0
Reaction score
36
Location
Sweden
[02/08/2008 17:12:59] Warning: [Event::loadScript] Can not load script. data/actions/scripts/tools/Hallowed Axe.lua
[02/08/2008 17:12:59] data/actions/scripts/tools/Hallowed Axe.lua:219: 'then' expected near 'getPlayerStorageValue'

why is this?
I'll check this.

EDIT: Here is the new script:
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
Simonel, please update the code.
 
Joined
Dec 31, 2007
Messages
176
Best answers
0
Reaction score
2
Location
Vivalla
This script is totally unuseful... i tried exactly everything what i know of... still its unuseable

Heres my hallowed axe
Code:
--- Made by Mazen ---
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=32711, y=32346, z=7}
summonweak2Position = {x=32716, y=32346, z=7}
summonweak3Position = {x=32709, y=32350, z=7}
summonweak4Position = {x=32717, y=32351, z=7}
summonweakone1Position = {x=32717, y=32351, z=7}
summonweakone2Position = {x=32709, y=32350, z=7}
summonweakone3Position = {x=32716, y=32346, z=7}
summonweakone4Position = {x=32711, y=32346, z=7}
summonweaktwo1Position = {x=32711, y=32346, z=7}
summonweaktwo2Position = {x=32716, y=32346, z=7}
summonweaktwo3Position = {x=32709, y=32350, z=7}
summonweaktwo4Position = {x=32717, y=32351, z=7}

--- Second Part ---
summonnormal1Position = {x=32711, y=32346, z=7}
summonnormal2Position = {x=32716, y=32346, z=7}
summonnormal3Position = {x=32709, y=32350, z=7}
summonnormal4Position = {x=32717, y=32351, z=7}
summonnormalone1Position = {x=32711, y=32346, z=7}
summonnormalone2Position = {x=32716, y=32346, z=7}
summonnormalone3Position = {x=32709, y=32350, z=7}
summonnormalone4Position = {x=32717, y=32351, z=7}
summonnormaltwo1Position = {x=32711, y=32346, z=7}
summonnormaltwo2Position = {x=32716, y=32346, z=7}
summonnormaltwo3Position = {x=32709, y=32350, z=7}
summonnormaltwo4Position = {x=32717, y=32351, z=7}

--- Third Part ---
summonmedium1Position = {x=32711, y=32346, z=7}
summonmedium2Position = {x=32716, y=32346, z=7}
summonmedium3Position = {x=32709, y=32350, z=7}
summonmedium4Position = {x=32717, y=32351, z=7}
summonmediumone1Position = {x=32711, y=32346, z=7}
summonmediumone2Position = {x=32716, y=32346, z=7}
summonmediumone3Position = {x=32709, y=32350, z=7}
summonmediumone4Position = {x=32717, y=32351, z=7}
summonmediumtwo1Position = {x=32711, y=32346, z=7}
summonmediumtwo2Position = {x=32716, y=32346, z=7}
summonmediumtwo3Position = {x=32709, y=32350, z=7}
summonmediumtwo4Position = {x=32717, y=32351, z=7}

--- Fourth Part ---
summonhard1Position = {x=32711, y=32346, z=7}
summonhard2Position = {x=32716, y=32346, z=7}
summonhard3Position = {x=32709, y=32350, z=7}
summonhard4Position = {x=32717, y=32351, z=7}
summonhardone1Position = {x=32711, y=32346, z=7}
summonhardone2Position = {x=32716, y=32346, z=7}
summonhardone3Position = {x=32709, y=32350, z=7}
summonhardone4Position = {x=32717, y=32351, z=7}

--- Teleport Back Positions ---
back1Position = {x=32718, y=32340, z=7}
back2Position = {x=32718, y=32340, z=7}
back3Position = {x=32718, y=32340, z=7}
back4Position = {x=32718, y=32340, z=7}
back5Position = {x=32718, y=32340, z=7}

--- 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("lich", summonweak1Position)
			doSummonCreature("demon", summonweak2Position)
			doSummonCreature("lich", summonweak3Position)
			doSummonCreature("demon", 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("demon", summonweakone1Position)
			doSummonCreature("juggernaut", summonweakone2Position)
			doSummonCreature("lich", summonweakone3Position)
			doSummonCreature("demon", 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("juggernaut", summonweaktwo1Position)
			doSummonCreature("demon", summonweaktwo2Position)
			doSummonCreature("demon", summonweaktwo3Position)
			doSummonCreature("demon", 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("demon", summonnormal1Position)
			doSummonCreature("juggernaut", summonnormal2Position)
			doSummonCreature("lich", summonnormal3Position)
			doSummonCreature("lich", 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("hellhound", summonnormalone1Position)
			doSummonCreature("demon", summonnormalone2Position)
			doSummonCreature("demon", summonnormalone3Position)
			doSummonCreature("hellhound", 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("demon", summonnormaltwo1Position)
			doSummonCreature("hellhound", summonnormaltwo2Position)
			doSummonCreature("hellhound", summonnormaltwo3Position)
			doSummonCreature("juggernaut", 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("hellhound", summonmedium1Position)
			doSummonCreature("crypt shambler", summonmedium2Position)
			doSummonCreature("hellhound", summonmedium3Position)
			doSummonCreature("defiler", 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("lost soul", summonmediumone1Position)
			doSummonCreature("hand of cursed faith", summonmediumone2Position)
			doSummonCreature("demon", summonmediumone3Position)
			doSummonCreature("demon", 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("demon", summonmediumtwo1Position)
			doSummonCreature("demon", summonmediumtwo2Position)
			doSummonCreature("demon", summonmediumtwo3Position)
			doSummonCreature("demon", 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("demon", summonmedium1Position)
			doSummonCreature("hand of cursed fate", summonmedium2Position)
			doSummonCreature("demon", summonmedium3Position)
			doSummonCreature("juggernaut", 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("demon", summonmediumone1Position)
			doSummonCreature("demon", summonmediumone2Position)
			doSummonCreature("demon", summonmediumone3Position)
			doSummonCreature("demon", 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
its not doing anything...just standing there and doing 0
EDIT: so here is the error on the npc too
[02/08/2008 19:14:52] [Warning - NpcScript::NpcScript] Can not load script: data/npc/scripts/oldrak.lua
[02/08/2008 19:14:52] data/npc/scripts/oldrak.lua:25: 'then' expected near 'player_money'
 
Last edited:
OP
Gregor

Gregor

New Member
Joined
Feb 29, 2008
Messages
770
Best answers
0
Reaction score
3
Location
UK/POLAND
I update the code :) Thanks Mazen
 
Joined
Dec 31, 2007
Messages
176
Best answers
0
Reaction score
2
Location
Vivalla
also the npc is not even giving the hallowed axe if i look closer in the script... make sure it works before you release it -.-
 

Mazen

Developer
Joined
Aug 20, 2007
Messages
612
Best answers
0
Reaction score
36
Location
Sweden
also the npc is not even giving the hallowed axe if i look closer in the script... make sure it works before you release it -.-
Sorry for that, I can't test the script becous I don't have the latest full items.otb. :)

Here is the fixed npc script:
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 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
			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())
Thanks for reporting it.
 

ivelios

New Member
Joined
May 31, 2008
Messages
59
Best answers
0
Reaction score
0
Location
Poland
I have error with hallowed axe :/ :
Warning: [Event::loadScript] Can not load script. data/actions/scripts/tools/Hal
lowed Axe.lua
data/actions/scripts/tools/Hallowed Axe.lua:219: 'then' expected near 'getPlayer
StorageValue'
 
Joined
Dec 31, 2007
Messages
176
Best answers
0
Reaction score
2
Location
Vivalla
the problem now is the hallowed axe script i have done everything and now it still says nothing in console but the quest dont work :S Mazen if you want i can set up an server for you that is otb v.3 and otbm v.2 so you can try out the scripts you make since i think they are useful...especially for me who has an rl map that is updating everyday... Really need this quest tho

EDIT : Just Tried the npc, it still gives
[03/08/2008 13:19:47] [Warning - NpcScript::NpcScript] Can not load script: data/npc/scripts/oldrak.lua
[03/08/2008 13:19:47] data/npc/scripts/oldrak.lua:31: 'then' expected near 'player_money'
 

EvulMastah

๏̯͡๏﴿
Premium User
Joined
Aug 19, 2007
Messages
4,833
Best answers
0
Reaction score
184
the problem now is the hallowed axe script i have done everything and now it still says nothing in console but the quest dont work :S Mazen if you want i can set up an server for you that is otb v.3 and otbm v.2 so you can try out the scripts you make since i think they are useful...especially for me who has an rl map that is updating everyday... Really need this quest tho

EDIT : Just Tried the npc, it still gives
[03/08/2008 13:19:47] [Warning - NpcScript::NpcScript] Can not load script: data/npc/scripts/oldrak.lua
[03/08/2008 13:19:47] data/npc/scripts/oldrak.lua:31: 'then' expected near 'player_money'
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())
There were missing "and"s.

Also there was a wrong check - isPlayer(cid) when you are checking premium it is isPremium(cid) :S
 

Mazen

Developer
Joined
Aug 20, 2007
Messages
612
Best answers
0
Reaction score
36
Location
Sweden
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())
There were missing "and"s.

Also there was a wrong check - isPlayer(cid) when you are checking premium it is isPremium(cid) :S
Thank you! I'll update that.
 

koitsalu

Banned User
Joined
Sep 27, 2007
Messages
562
Best answers
0
Reaction score
1
Hey, how does the mapping of this quest look like? If I wish to add it..
 
OP
Gregor

Gregor

New Member
Joined
Feb 29, 2008
Messages
770
Best answers
0
Reaction score
3
Location
UK/POLAND
Update the NPC.
Thanks Marcinek Paladinek :)
 

darkjav

Senior Developer
Joined
Apr 29, 2008
Messages
195
Best answers
0
Reaction score
12
Location
Mexico City
i have too this error:

[Warning - NpcScript::NpcScript] Can not load script: data/npc/script
a
data/npc/scripts/oldrak.lua:31: 'then' expected near 'player_money'

need help plx
 

EvulMastah

๏̯͡๏﴿
Premium User
Joined
Aug 19, 2007
Messages
4,833
Best answers
0
Reaction score
184
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 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 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())
 

darkjav

Senior Developer
Joined
Apr 29, 2008
Messages
195
Best answers
0
Reaction score
12
Location
Mexico City
when i say hallowed axe:

Code:
Lua Script Error: [Npc interface]
data/npc/scripts/oldrak.lua:onCreatureSay

data/npc/scripts/oldrak.lua:30: attempt to call global 'isPremium' (a nil value)

stack traceback:
        data/npc/scripts/oldrak.lua:30: in function 'callback'
        data/npc/lib/npcsystem/npchandler.lua:268: in function 'onCreatureSay'
        data/npc/scripts/oldrak.lua:11: in function <data/npc/scripts/oldrak.lua
:11>
 
Top