Hermes
dziwki kola gramy w lola
Some days ago Szakal had posted here Demon Oak Quest. Now his script is outdated and may cause problems, so I have decided to rewrite it to fit with the newest updates of The Forgotten Server.
Here you are:
data/actions/scripts/demonOakChests.lua:
data/actions/scripts/demonOakGravestone.lua:
data/actions/scripts/demonOak.lua:
And movements..
data/movements/scripts/demonOakTree.lua:
data/movements/scripts/demonOakRemoveTree.lua:
And now declaring time!
data/actions/actions.xml:
data/movements/movements.xml:
And actionids&uniqueids used in scripts:
NOTE. If you are using older versions of TFS than 0.3.4 or even other engine, you should declare scripts in movements and actions xml files in other way:
actions.xml:
movements.xml:
NOTE2. Script demonOak.lua IS NOT really optimized. But it will work like a charm.
Thanks,
Hermes
Here you are:
data/actions/scripts/demonOakChests.lua:
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(getPlayerStorageValue(cid, 50090) > 0) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.")
return TRUE
else
if(item.uid == 12901) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found demon legs.")
doPlayerAddItem(cid, 2495, 1)
elseif(item.uid == 12902) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found a rainbow shield.")
doPlayerAddItem(cid, 8905, 1)
elseif(item.uid == 12903) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found a royal crossbow.")
doPlayerAddItem(cid, 8851, 1)
elseif(item.uid == 12904) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found a spellbook of dark mysteries.")
doPlayerAddItem(cid, 8918, 1)
end
setPlayerStorageValue(cid, 50090, 1)
end
return TRUE
end
data/actions/scripts/demonOakGravestone.lua:
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local newPosition = {x=32718, y=32396, z=8}
if(item.itemid == 1406 and getPlayerStorageValue(cid, 8585) > 0) then
doTeleportThing(cid, newPosition, TRUE)
doSendMagicEffect(newPosition, CONST_ME_TELEPORT)
doSendMagicEffect(fromPosition, CONST_ME_POFF)
setPlayerStorageValue(cid, 8585, -1)
end
return TRUE
end
data/actions/scripts/demonOak.lua:
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local blockingTreePosition = {x=32720, y=32345, z=7, stackpos=1}
local firstMonsterSpawn = {x=32717, y=32347, z=7}
local secondMonsterSpawn = {x=32724, y=32348, z=7}
local thirdMonsterSpawn = {x=32716, y=32353, z=7}
local fourthMonsterSpawn = {x=32724, y=32353, z=7}
local blockingTree = getThingfromPos(blockingTreePosition).uid
local randomizer = math.random(1,6)
local firstQuestStatus = getPlayerStorageValue(cid, 8181)
local secondQuestStatus = getPlayerStorageValue(cid, 8282)
local thirdQuestStatus = getPlayerStorageValue(cid, 8383)
local fourthQuestStatus = getPlayerStorageValue(cid, 8484)
if(itemEx.itemid == 2709 and itemEx.actionid == 7787 and getPlayerLevel(cid) >= 120) then
doRemoveItem(blockingTree)
doTeleportThing(cid, toPosition, TRUE)
setPlayerStorageValue(cid, 8181, 1)
else
doSendMagicEffect(toPosition, CONST_ME_POFF)
return TRUE
end
if(itemEx.itemid == 2709 and itemEx.actionid == 7788) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Another player is already doing this quest.")
return TRUE
end
if(itemEx.itemid == 8289 and itemEx.actionid == 8181 and randomizer == 1 and firstQuestStatus == 1) then
doSummonCreature("Crypt Shambler", firstMonsterSpawn)
doSummonCreature("Crypt Shambler", secondMonsterSpawn)
doSummonCreature("Crypt Shambler", thirdMonsterSpawn)
doSummonCreature("Crypt Shambler", fourthMonsterSpawn)
elseif(itemEx.itemid == 8289 and itemEx.actionid == 8181 and randomizer == 2 and firstQuestStatus == 1) then
doSummonCreature("Bone Beast", firstMonsterSpawn)
doSummonCreature("Bone Beast", secondMonsterSpawn)
doSummonCreature("Bone Beast", thirdMonsterSpawn)
doSummonCreature("Bone Beast", fourthMonsterSpawn)
elseif(itemEx.itemid == 8289 and itemEx.actionid == 8181 and randomizer == 3 and firstQuestStatus == 1) then
doSummonCreature("Betrayed Wraith", firstMonsterSpawn)
doSummonCreature("Lost Soul", secondMonsterSpawn)
setPlayerStorageValue(cid, 8181, -1)
setPlayerStorageValue(cid, 8282, 1)
elseif(itemEx.itemid == 8289 and itemEx.actionid == 8181 and randomizer >= 4 and firstQuestStatus == 1) then
doSendMagicEffect(fromPosition, 45)
doCreatureAddHealth(cid, -300)
doSendAnimatedText(fromPosition, '300', TEXTCOLOR_LIGHTGREEN)
end
if(itemEx.itemid == 8289 and itemEx.actionid == 8181 and firstQuestStatus < 1) then
doSendMagicEffect(toPosition, CONST_ME_POFF)
return TRUE
end
if(itemEx.itemid == 8288 and itemEx.actionid == 8282 and randomizer == 1 and secondQuestStatus == 1) then
doSummonCreature("Crypt Shambler", firstMonsterSpawn)
doSummonCreature("Mummy", secondMonsterSpawn)
doSummonCreature("Mummy", thirdMonsterSpawn)
doSummonCreature("Crypt Shambler", fourthMonsterSpawn)
elseif(itemEx.itemid == 8288 and itemEx.actionid == 8282 and randomizer == 2 and secondQuestStatus == 1) then
doSummonCreature("Giant Spider", firstMonsterSpawn)
doSummonCreature("Giant Spider", fourthMonsterSpawn)
elseif(itemEx.itemid == 8288 and itemEx.actionid == 8282 and randomizer == 3 and secondQuestStatus == 1) then
doSummonCreature("Blightwalker", firstMonsterSpawn)
doSummonCreature("Lost Soul", secondMonsterSpawn)
setPlayerStorageValue(cid, 8282, -1)
setPlayerStorageValue(cid, 8383, 1)
elseif(itemEx.itemid == 8288 and itemEx.actionid == 8282 and randomizer >= 4 and secondQuestStatus == 1) then
doSendMagicEffect(fromPosition, 45)
doCreatureAddHealth(cid, -300)
doSendAnimatedText(fromPosition, '300', TEXTCOLOR_LIGHTGREEN)
end
if(itemEx.itemid == 8288 and itemEx.actionid == 8282 and secondQuestStatus < 1) then
doSendMagicEffect(toPosition, CONST_ME_POFF)
return TRUE
end
if(itemEx.itemid == 8290 and itemEx.actionid == 8383 and randomizer == 1 and thirdQuestStatus == 1) then
doSummonCreature("Crypt Shambler", firstMonsterSpawn)
doSummonCreature("Crypt Shambler", secondMonsterSpawn)
doSummonCreature("Crypt Shambler", thirdMonsterSpawn)
doSummonCreature("Crypt Shambler", fourthMonsterSpawn)
elseif(itemEx.itemid == 8290 and itemEx.actionid == 8383 and randomizer == 2 and thirdQuestStatus == 1) then
doSummonCreature("Lich", firstMonsterSpawn)
doSummonCreature("Lich", secondMonsterSpawn)
doSummonCreature("Lich", thirdMonsterSpawn)
doSummonCreature("Lich", fourthMonsterSpawn)
elseif(itemEx.itemid == 8290 and itemEx.actionid == 8383 and randomizer == 3 and thirdQuestStatus == 1) then
doSummonCreature("Plaguesmith", firstMonsterSpawn)
doSummonCreature("Plaguesmith", secondMonsterSpawn)
setPlayerStorageValue(cid, 8383, -1)
setPlayerStorageValue(cid, 8484, 1)
elseif(itemEx.itemid == 8290 and itemEx.actionid == 8383 and randomizer >= 4 and thirdQuestStatus == 1) then
doSendMagicEffect(fromPosition, 45)
doCreatureAddHealth(cid, -300)
doSendAnimatedText(fromPosition, '300', TEXTCOLOR_LIGHTGREEN)
end
if(itemEx.itemid == 8290 and itemEx.actionid == 8383 and thirdQuestStatus < 1) then
doSendMagicEffect(toPosition, CONST_ME_POFF)
return TRUE
end
if(itemEx.itemid == 8291 and itemEx.actionid == 8484 and randomizer == 1 and fourthQuestStatus == 1) then
doSummonCreature("Nightmare", firstMonsterSpawn)
doSummonCreature("Mummy", secondMonsterSpawn)
doSummonCreature("Mummy", thirdMonsterSpawn)
doSummonCreature("Nightmare", fourthMonsterSpawn)
elseif(itemEx.itemid == 8291 and itemEx.actionid == 8484 and randomizer == 2 and fourthQuestStatus == 1) then
doSummonCreature("Giant spider", firstMonsterSpawn)
doSummonCreature("Undead Dragon", secondMonsterSpawn)
doSummonCreature("Giant Spider", secondMonsterSpawn)
doSummonCreature("Giant Spider", thirdMonsterSpawn)
elseif(itemEx.itemid == 8291 and itemEx.actionid == 8484 and randomizer == 3 and fourthQuestStatus == 1) then
doSummonCreature("Demon", firstMonsterSpawn)
doSummonCreature("Juggernaut", secondMonsterSpawn)
setPlayerStorageValue(cid, 8484, -1)
setPlayerStorageValue(cid, 8585, 1)
elseif(itemEx.itemid == 8291 and itemEx.actionid == 8484 and randomizer >= 4 and fourthQuestStatus == 1) then
doSendMagicEffect(fromPosition, 45)
doCreatureAddHealth(cid, -300)
doSendAnimatedText(fromPosition, '300', TEXTCOLOR_LIGHTGREEN)
end
if(itemEx.itemid == 8291 and itemEx.actionid == 8484 and fourthQuestStatus < 1) then
doSendMagicEffect(toPosition, CONST_ME_POFF)
return TRUE
end
return TRUE
end
And movements..
data/movements/scripts/demonOakTree.lua:
Lua:
function onStepIn(cid, item, position, fromPosition)
local blockingTreePosition = {x=32720, y=32345, z=7}
local firstTree = doCreateItem(2709, 1, blockingTreePosition)
local secondTree = doCreateItem(2709, 1, blockingTreePosition)
if(item.itemid == 103) then
doSetItemActionId(firstTree, 7788)
doSetItemActionId(secondTree, 7787)
end
return TRUE
end
data/movements/scripts/demonOakRemoveTree.lua:
Lua:
function onStepIn(cid, item, pos)
local blockingTreePosition = {x=32720, y=32345, z=7, stackpos=2}
local getBlockingTree = getThingfromPos(blockingTreePosition)
if(isPlayer(cid) == TRUE) then
doRemoveItem(getBlockingTree.uid)
end
return TRUE
end
And now declaring time!
data/actions/actions.xml:
Code:
<action fromuid="12901" touid="12904" event="script" value="demonOakChests.lua" />
<action uniqueid="55100" event="script" value="demonOakGravestone.lua" />
<action itemid="8293" event="script" value="demonOak.lua"/>
data/movements/movements.xml:
Code:
<movevent type="StepIn" actionid="7789" event="script" value="demonOakTree.lua"/>
<movevent type="StepIn" uniqueid="14449" event="script" value="demonOakRemoveTree.lua"/>
And actionids&uniqueids used in scripts:
Code:
Left arm: 8181
Face: 8282
Right Arn: 8383
Crow: 8484
Tree blocking path: 7789
Gravestone: 55100
NOTE. If you are using older versions of TFS than 0.3.4 or even other engine, you should declare scripts in movements and actions xml files in other way:
actions.xml:
Code:
<action uniqueid="12901" script="demonOakChests.lua" />
<action uniqueid="12902" script="demonOakChests.lua" />
<action uniqueid="12903" script="demonOakChests.lua" />
<action uniqueid="12904" script="demonOakChests.lua" />
<action uniqueid="55100" script="demonOakGravestone.lua" />
<action itemid="8293" script="demonOak.lua"/>
Code:
<movevent event="StepIn" actionid="7789" script="demonOakTree.lua"/>
<movevent event="StepIn" uniqueid="14449" script="demonOakRemoveTree.lua"/>
NOTE2. Script demonOak.lua IS NOT really optimized. But it will work like a charm.
Thanks,
Hermes
Last edited: