Fala galera...
Trago aqui para vocês um novo script para a Demon Oak Quest.
Informações:
Nome do script: The Demon Oak QuestData de atualização: 24/01/09
Dificuldade:
3/5
Versão testada: 0.3beta3
Créditos: Simonel, AlissonLinneker
- O que há de novo?
Este novo script, é mais pratico de se configurar, precisa configurar apenas algunmas posições, e requer apenas duas UID no mapa.
- Introdução:
Os Ruthless Seven mandaram uma poderoso demônio para Plains Of Havoc. Você tem o que precisa para impedi-lo?
- Iniciando:
Iremos trabalhar apenas com 5 scripts e 1 npc. Pegaremos a parte das actions, depois movements, e depois o npc.
Actions:
Dando função ao Hallowed Axe:
Primeiramente, crie um arquivo de nome Hallowed Axe.lua, dentro da pasta data/actions/scripts/tools, e adicione o conteúdo a ele:
function onUse(cid,item,frompos,item2,topos)number = math.random(1,100)
chance = 80
minItem = 1
maxItem = 3
mind = 300
maxd = 500
if chance > 100 or chance == 0 then
chance = 100
end
----------------- Variables ----------------------
leftspikedballpos11 = {x=topos.x-1, y=topos.y+2, z=topos.z}
leftspikedballpos12 = {x=topos.x+2, y=topos.y+1, z=topos.z}
leftspikedballpos13 = {x=topos.x-1, y=topos.y-2, z=topos.z}
leftspikedballpos14 = {x=topos.x+2, y=topos.y-1, z=topos.z}
leftspikedballpos21 = {x=topos.x-1, y=topos.y-2, z=topos.z}
leftspikedballpos22 = {x=topos.x-2, y=topos.y-1, z=topos.z}
leftspikedballpos31 = {x=topos.x-1, y=topos.y+2, z=topos.z}
leftspikedballpos32 = {x=topos.x-2, y=topos.y+1, z=topos.z}
birdpos11 = {x=topos.x+2, y=topos.y+1, z=topos.z}
birdpos12 = {x=topos.x+1, y=topos.y+2, z=topos.z}
birdpos13 = {x=topos.x+2, y=topos.y, z=topos.z}
birdpos14 = {x=topos.x+1, y=topos.y, z=topos.z}
birdpos21 = {x=topos.x+2, y=topos.y+1, z=topos.z}
birdpos22 = {x=topos.x+1, y=topos.y+2, z=topos.z}
birdpos31 = {x=topos.x-2, y=topos.y+1, z=topos.z}
birdpos32 = {x=topos.x-1, y=topos.y, z=topos.z}
rightspikedballpos11 = {x=topos.x+1, y=topos.y, z=topos.z}
rightspikedballpos12 = {x=topos.x+2, y=topos.y-1, z=topos.z}
rightspikedballpos13 = {x=topos.x+1, y=topos.y+2, z=topos.z}
rightspikedballpos14 = {x=topos.x+2, y=topos.y+1, z=topos.z}
rightspikedballpos21 = {x=topos.x+1, y=topos.y+2, z=topos.z}
rightspikedballpos22 = {x=topos.x+2, y=topos.y+1, z=topos.z}
rightspikedballpos31 = {x=topos.x-1, y=topos.y+2, z=topos.z}
rightspikedballpos32 = {x=topos.x-2, y=topos.y+1, z=topos.z}
faceoftreepos11 = {x=topos.x-2, y=topos.y-1, z=topos.z}
faceoftreepos12 = {x=topos.x+1, y=topos.y-2, z=topos.z}
faceoftreepos13 = {x=topos.x+2, y=topos.y-1, z=topos.z}
faceoftreepos14 = {x=topos.x-1, y=topos.y-2, z=topos.z}
faceoftreepos21 = {x=topos.x-2, y=topos.y-1, z=topos.z}
faceoftreepos22 = {x=topos.x-1, y=topos.y-2, z=topos.z}
faceoftreepos31 = {x=topos.x-2, y=topos.y+1, z=topos.z}
faceoftreepos32 = {x=topos.x-1, y=topos.y+2, z=topos.z}
--------------------Demon oak(O braço esquerdo da arvore)--------------------
if item2.itemid == 8289 then
leftspikedball = getPlayerStorageValue(cid,20000)
if leftspikedball == -1 or leftspikedball == 0 then
if number <= chance then
surp = math.random(minItem, maxItem)
if surp == 1 then
if number <= 75 then
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("bone beast",leftspikedballpos11)
doSummonCreature("bone beast",leftspikedballpos12)
doSummonCreature("bone beast",leftspikedballpos13)
doSummonCreature("bone beast",leftspikedballpos14)
else
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("lich",leftspikedballpos11)
doSummonCreature("lich",leftspikedballpos12)
doSummonCreature("lich",leftspikedballpos13)
doSummonCreature("lich",leftspikedballpos14)
end
end
if surp == 2 then
if number <= 75 then
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("lich",leftspikedballpos21)
doSummonCreature("giant spider",leftspikedballpos22)
else
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("grim reaper",leftspikedballpos21)
doSummonCreature("dark torturer",leftspikedballpos22)
end
end
if surp == 3 then
if number <= 50 then
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("undead dragon",leftspikedballpos31)
else
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("grim reaper",leftspikedballpos31)
doSummonCreature("dark torturer",leftspikedballpos32)
end
end
else
doSendMagicEffect(topos,2)
setPlayerStorageValue(cid,20000,1)
end
else
doSendMagicEffect(topos,2)
end
return 1
end
--------------------Demon oak(O passaro atraz da arvore)--------------------
if item2.itemid == 8288 then
bird = getPlayerStorageValue(cid,20001)
if bird == -1 or bird == 0 then
if number <= chance then
surp = math.random(minItem, maxItem)
if surp == 1 then
if number <= 75 then
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("banshee",birdpos11)
doSummonCreature("banshee",birdpos12)
doSummonCreature("banshee",birdpos13)
doSummonCreature("banshee",birdpos14)
else
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("braindeath",birdpos11)
doSummonCreature("braindeath",birdpos12)
doSummonCreature("braindeath",birdpos13)
doSummonCreature("braindeath",birdpos14)
end
end
if surp == 2 then
if number <= 75 then
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("demon",birdpos21)
doSummonCreature("diabolic imp",birdpos22)
else
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("blightwalker",birdpos21)
doSummonCreature("betrayed wraith",birdpos22)
end
end
if surp == 3 then
if number <= 50 then
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("undead dragon",birdpos31)
else
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("hand of cursed fate",birdpos31)
doSummonCreature("dark torturer",birdpos32)
end
end
else
doSendMagicEffect(topos,2)
setPlayerStorageValue(cid,20001,1)
end
else
doSendMagicEffect(topos,2)
end
return 1
end
--------------------Demon oak(O braço direito da arvore)--------------------
if item2.itemid == 8290 then
rightspikedball = getPlayerStorageValue(cid,20002)
if rightspikedball == -1 or rightspikedball == 0 then
if number <= chance then
surp = math.random(minItem, maxItem)
if surp == 1 then
if number <= 75 then
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("lich",rightspikedballpos11)
doSummonCreature("lich",rightspikedballpos12)
doSummonCreature("lich",rightspikedballpos13)
doSummonCreature("lich",rightspikedballpos14)
else
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("giant spider",rightspikedballpos11)
doSummonCreature("giant spider",rightspikedballpos12)
doSummonCreature("giant spider",rightspikedballpos13)
doSummonCreature("giant spider",rightspikedballpos14)
end
end
if surp == 2 then
if number <= 75 then
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("dark torturer",rightspikedballpos21)
doSummonCreature("demon",rightspikedballpos22)
else
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("diabolic imp",rightspikedballpos21)
doSummonCreature("diabolic imp",rightspikedballpos22)
end
end
if surp == 3 then
if number <= 50 then
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("hand of cursed fate",rightspikedballpos31)
else
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("grim reaper",rightspikedballpos31)
doSummonCreature("grim reaper",rightspikedballpos32)
end
end
else
doSendMagicEffect(topos,2)
setPlayerStorageValue(cid,20002,1)
end
else
doSendMagicEffect(topos,2)
end
return 1
end
--------------------Demon oak(O rosto da arvore)--------------------
if item2.itemid == 8291 then
faceoftree = getPlayerStorageValue(cid,20003)
if faceoftree == -1 or faceoftree == 0 then
if number <= chance then
surp = math.random(minItem, maxItem)
if surp == 1 then
if number <= 75 then
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("vampire",faceoftreepos11)
doSummonCreature("vampire",faceoftreepos12)
doSummonCreature("vampire",faceoftreepos13)
doSummonCreature("vampire",faceoftreepos14)
else
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("diabolic imp",faceoftreepos11)
doSummonCreature("diabolic imp",faceoftreepos12)
doSummonCreature("diabolic imp",faceoftreepos13)
doSummonCreature("diabolic imp",faceoftreepos14)
end
end
if surp == 2 then
if number <= 75 then
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("demon",faceoftreepos21)
doSummonCreature("grim reaper",faceoftreepos22)
else
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("hand of cursed fate",faceoftreepos21)
doSummonCreature("hand of cursed fate",faceoftreepos22)
end
end
if surp == 3 then
if number <= 50 then
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("undead dragon",faceoftreepos31)
doSummonCreature("hand of cursed fate",faceoftreepos32)
else
doSendMagicEffect(topos,0)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -290, -510, CONST_ME_BIGPLANTS)
doSummonCreature("grim reaper",faceoftreepos31)
doSummonCreature("hand of cursed fate",faceoftreepos32)
end
end
else
doSendMagicEffect(topos,2)
setPlayerStorageValue(cid,20003,1)
end
else
doSendMagicEffect(topos,2)
end
return 1
end
return 0
end
Salve, e feche o arquivo. Ele está as configurações padões, não há necessidade de mudar.
Túmulo de UID 55100, que é usado para ir para sala de recompensas apos matar completamente a arvore e falar com o npc Oldrak.:
Agora crie um arquivo de nome DOQgravestone.lua dentro da pasta data/actions/scripts/quests, e adicione o conteúdo a ele, e configure onde se pede.:
function onUse(cid, item, fromPosition, itemEx, toPosition)
newnPosition = {x=32704, y=32397, z=8} ---Posição da sala das recompensas apos dar USE no túmulo.
if getPlayerStorageValue(cid,20004) == 1 then
doTeleportThing(cid,newnPosition)
doSendMagicEffect(newnPosition,10)
else
return 0
end
return 1
end
Actions dos baús da sala de recompensas:
Agora crie um arquivo de nome DOQChests.lua dentro da pasta data/actions/scripts/quests e adicione o seguinte conteúdo a ele:
Movements:
Partiremos agora para está parte.
Crie um arquivo de nome dotile.lua dentro da pasta data/movements/scripts e adicione o seguinte conteúdo a ele, e configure onde se pede.:
local tree = {x = 32716, y = 32345, z = 7, stackpos=1} ---Posição da árvore morta de ID 2709
function onStepOut(cid, item, pos)
local monsterFlower = "Moonflower"
if getPlayerLevel(cid) < 120 then
doMoveCreature(cid, NORTH)
doCreatureSay(cid, "You must be at least level 120 or higher.", TALKTYPE_ORANGE_1)
elseif getPlayerLevel(cid) >= 120 then
doMoveCreature(cid, SOUTH)
doCreateItem(2717, tree)
end
return TRUE
end
Agora crie um arquivo de nome removegreenhornstone.lua dentro da pasta data/movements/scripts e adicione o seguinte conteúdo a ele, e configure onde se pede.:
function onStepIn(cid, item, pos)
-- Start tree removal set
StartTreePos = {x=32716, y=32345, z=7, stackpos=1} --- Coodenada da árvore que bloqueia a entrada pra o Demon Oak, é obrigatoriamente que seja igual à coordenada do arquivo dotile.lua.
StartTreeChk = getThingfromPos(StartTreePos)
-- end of check
if isPlayer(cid) == TRUE then
doRemoveItem(StartTreeChk.uid)
end
return TRUE
end
Pronto, terminamos com as actions e os movements.
Agora devemos adiciona-los nos arquivos xml.
Abra o arquivo actions.xml dentro da pasta data/actions, e adicione o conteúdo a ele:
<!-- demon oak --><action uniqueid="12901" script="quests/DOQChests.lua" /> --- Demon legs
<action uniqueid="12902" script="quests/DOQChests.lua" /> --- Rainbow shield
<action uniqueid="12903" script="quests/DOQChests.lua" /> --- royal crossbow
<action uniqueid="12904" script="quests/DOQChests.lua" /> --- spellbook of dark mysteries
<action uniqueid="55100" script="quests/DOQgravestone.lua" />
<action itemid="8293" script="tools/Hallowed Axe.lua"/>
<!-- demon oak fim -->
Agora abra o arquivo movements.xml dentro da pasta data/movements, e adicione o conteúdo a ele:
<movevent event="StepIn" uniqueid="14449" script="removegreenhornstone.lua"/> --- Ação que remove a arvore morta apos pisar no teleport
<movevent event="StepOut" uniqueid="32193" script="dotile.lua" /> --- Ação que cria a arvore morta ao entrar na área da arvore demon oak
Pronto, terminamos.
Agora basta criar o npc Oldrak.
Este Monk trabalha em Plains of Havoc. Faz parte da Paradox Quest, que trocará o axe pelo Hallowed Axe. Veja:
Crie um arquivo de nome Oldrak.xml dentro da pasta data/npcs, e adicione isso a ele:
<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>
Agora crie um arquivo com o nome oldrak.lua, e adicione o conteúdo a ele:
-- Made by Coltain and AlissonLinneker, 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(not npcHandler:isFocused(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 and player_money >= 50000 then
npcHandler:say('Do you want to buy a Hallowed Axe from me?', cid)
talk_state = 1
else
npcHandler:say('You have to bring me an axe and 50000 gp first?', cid)
talk_state = 0
end
else
npcHandler:say('You need premium to buy this axe from me.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 1 then
talk_state = 0
if getPlayerItemCount(cid,2386) >= 1 and player_money >= 50000 then
if doPlayerTakeItem(cid,2386,1) == 0 and doPlayerRemoveMoney(cid,50000) == TRUE then
npcHandler:say('Here you are. You can now defeat the demon oak with this axe.', cid)
doPlayerAddItem(cid,8293,1)
talk_state = 0
else
npcHandler:say('The Hallowed Axe is too heavy for you. Make sure that you have enough capacity.', cid)
talk_state = 0
end
else
npcHandler:say('Please bring with you an axe and enough with money.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'demon oak') then
if getPlayerStorageValue(cid,20000) == 1 and getPlayerStorageValue(cid,20001) == 1 and getPlayerStorageValue(cid,20002) == 1 and getPlayerStorageValue(cid,20003) == 1 then
npcHandler:say('Did you defeat the demon oak?', cid)
talk_state = 2
else
npcHandler:say('Go defeat the demon oak.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 2 then
talk_state = 0
if getPlayerStorageValue(cid,20000) == 1 and getPlayerStorageValue(cid,20001) == 1 and getPlayerStorageValue(cid,20002) == 1 and getPlayerStorageValue(cid,20003) == 1 then
setPlayerStorageValue(cid,20004,1)
npcHandler:say('Good job!', cid)
end
------------------------------------------------ confirm no ------------------------------------------------
elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 1) then
npcHandler:say('Ok thanks.', cid)
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())
Pronto. Terminamos tudo.
Agora vamos configurar tudo isso rapidamente no mapa.
Veja a imagem:
Legenda da foto:
1º. = UID 32193 que é ativado ao passar em cima daquele SQM. Quando você passa em cima dele, ele bloqueia a passagem com a dead tree, sendo possivel retornar apenas pelo teleport
2º. = Onde tem esse UID 32193, é onde você pegara as coordenadas daquele lugar, e colocar no arquivos removegreenhornstone.lua e dotile.lua, sendo então obrigatório a coordenada em ambos arquivos.
3º. = Sendo o teleport, você coloca o UID 14449, e define a posição de saída desta área.
...
Continua...
Vou atualizar explicando como funciona o sistema inteiro e com vídeo CAM