Ir para conteúdo

[8.22]the Demon Oak Quest


ShadowMapper

Posts Recomendados

Olá XTibianos,

 

Esse script foi postado na OTFans, então todos créditos vão para Mazen, eu apenas traduzi o tópico.

Esse é o script para o novo The Demon Oak Quest (completo). Foi feito para rodar somente em The Forgotten Server 3.0. (Última revisão e items.otb v3).

 

Os Scripts da Quest

 

Não esqueça de adicionar os monstros e suas posições no script. Mude o: "doSummonCreature("", summonmediumtwo2Position)". Exemplo: "doSummonCreature("Demon", summonmediumtwo2Position)". Os summonposition precisa estar dentro da area e os backpostion precisam estar fora da arena, então o player será teleportado para fora quando ele terminar a quest.

 

actions/scripts/tools/Hallowed Axe.lua:

 

--- 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

 

Adicione isto no arquivo actions.xml:

 

  <action itemid="8293" script="tools/Hallowed Axe.lua"/>

 

Adicione dotile.lua em data/movemments/scripts:

 

--- Made by Mazen ---

function onStepOut(cid, item, position, fromPosition)
if item.itemuid == 32193 then
	doTransformItem(item.itemid,2717)
end	
end

 

E adicione isto em movemments.xml:

 

<movevent event="StepOut" uniqueid="32193" script="dotile.lua" />

 

As recompensas:

 

Este é o script da recompensa, quests/DOQChests.lua:

 

--- 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

 

Adicione isto em actions.xml:

 

<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 ---

 

O cemitério:

 

Adicione este script, DOQgravestone.lua:

 

--- 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

 

Adicione isto em actions.xml:

 

<action uniqueid="55100" script="DOQgravestone.lua" />

 

O NPC:

 

Aqui está o NPC que vende o Hallowed Axe.

 

npc/scripts/oldrak.lua:

 

-- 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())

 

npcs/Oldrak.xml:

 

<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>

 

Lembrando que este script não foi feito por mim, eu apenas traduzi o post do Mazen.

Para ver mais sobre a Demon Oak Quest clique aqui.

 

Att,

ShadowMapper.

Editado por ShadowMapper
Link para o comentário
Compartilhar em outros sites

a cara no meu nao deu certo nao, apaece esse erro:

 

[19/09/2008 11:02:06] [Warning - NpcScript::NpcScript] Can not load script: data/npc/scripts/oldrak.lua

[19/09/2008 11:02:06] data/npc/scripts/oldrak.lua:31: 'then' expected near 'player_money'

 

sabe oq eh?

Link para o comentário
Compartilhar em outros sites

Adicionei um link sobre a quest no tópico e arrumei alguns bugs meus.

Eu não posso dar suporte sobre esse script pois não fui eu que fiz, eu apenas trouxe ao fórum.

 

Obrigado por todos os comentários.

 

Att,

ShadowMapper.

Link para o comentário
Compartilhar em outros sites

  • 4 weeks later...

Realmente é ótimo mas ta meio confuso o script..Nunca fui na demon oak quest no global dai me confundi todo ;(

No caso de summona os bichos são o que? Todos demon? Sorry a noobice ^^ Não conheço bem essa quest...Apesar de ser ebm famosa ja 0_0 mas o script ta ótimo..Obrigado por trazer ao XTibia

Link para o comentário
Compartilhar em outros sites

  • 2 weeks later...
  • 2 months later...
×
×
  • Criar Novo...