Serginov
Onkonkoronkonk
Was bored and I can't figure out anything new + I don't like the other demon oak scripts that is somewhere here
Working on 0.4
When cutting the demon oak the script will spawn randomly one of the waves and yell one of the random texts in orange.
actions/actions.xml
actions/scripts/name_of_the_script.lua
Working on 0.4
When cutting the demon oak the script will spawn randomly one of the waves and yell one of the random texts in orange.
Code:
areaFromPosition is the top left cornor of the infested area.
areaToPosition is the bottom right cornor of the infested area.
blockingTree is the tree that blocks the path to the demon oak.
Code:
<action itemid="8293" event="script" value="name_of_the_script.lua"/>
<action uniqueid="55100" event="script" value="name_of_the_script.lua" />
Lua:
local config = {
HallowedAxe = 8293,
blockingTree = 2709,
blockingTreePos = {x = 32716, y = 32345, z = 7, stackpos = 1},
demonOakPos = {x = 32716, y = 32351, z = 7},
GravestoneUnique = 55100,
rewardRoomPos = {x = 32786, y = 32412, z = 8},
finishStorage = 35700, -- Storage given when you finish the quest to gain access to the reward room.
chance = 20, -- Chance to finish one part of the demon oak.
areaFromPos = {x = 32708, y = 32346, z = 7, stackpos = 253},
areaToPos = {x = 32724, y = 32355, z = 7, stackpos = 253},
onePerQuest = false,
allInsideGetQuest = true,
}
local demonOak = {
[8288] = {8288, 8292},
[8289] = {8289, 8293},
[8291] = {8291, 8294},
[8290] = {8290, 8295},
}
local storages = {8288, 8289, 8291, 8290}
local messages = { -- Messages the demon oak will yell when you hit him with the hallowed axe.
[1] = "Let me out and I will make you rich!",
[2] = "AARGH!",
[3] = "ARISE, MY MINIONS!",
[4] = "You can have my demon set if you help me get out of here!",
}
local waves = {
[1] = {"braindeath", "braindeath", "braindeath", "bonebeast"},
[2] = {"betrayed wraith", "betrayed wraith"},
[3] = {"lich", "lich", "lich"},
[4] = {"dark torturer", "blightwalker"},
[5] = {"banshee", "banshee", "banshee"},
[5] = {"grim reaper"},
[6] = {"giant spider", "giant spider"},
[7] = {"undead dragon", "hand of cursed fate"},
}
local mPos = {
[1] = {x = 32710, y = 32348, z = 7},
[2] = {x = 32710, y = 32354, z = 7},
[3] = {x = 32722, y = 32353, z = 7},
[4] = {x = 32722, y = 32348, z = 7},
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.uid == config.GravestoneUnique then
if getPlayerStorageValue(cid, config.finishStorage) > 0 then
doTeleportThing(cid, config.rewardRoomPos, true)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
end
end
local done = 0
local v = demonOak[itemEx.itemid]
local rf = math.random(1, 100)
local mobs = waves[math.random(1, #waves)]
local text = messages[math.random(1, #messages)]
local getTree = getThingfromPos(config.blockingTreePos)
if item.itemid == config.HallowedAxe then
if itemEx.itemid == config.blockingTree and getTree.uid then
if config.onePerQuest then
for _, pid in ipairs(getPlayersOnline()) do
if isInRange(getCreaturePosition(pid), config.areaFromPos, config.areaToPos) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You must wait until " .. getCreatureName(pid) .. " have finished the quest.")
doSendMagicEffect(toPosition, CONST_ME_POFF)
return false
end
end
end
if config.blockingTreePos.y > getPlayerPosition(cid).y then
doRemoveItem(getTree.uid, 1)
doCreatureSetNoMove(cid, 1)
doMoveCreature(cid, SOUTH)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -270, -310, CONST_ME_BIGPLANTS)
addEvent(blockingTree, 1000, cid)
else
doPlayerSendCancel(cid, "You cannot use this object.")
end
elseif v then
for _, storaag in ipairs(storages) do
if getPlayerStorageValue(cid, storaag) > 0 then
done = done + 1
end
end
if done >= #storages then
for _, pid in ipairs(getPlayersOnline()) do
if isInRange(getCreaturePosition(pid), config.areaFromPos, config.areaToPos) then
doTeleportThing(pid, {x = 32714, y = 32340, z = 7}, true)
doSendMagicEffect(getPlayerPosition(pid), CONST_ME_TELEPORT)
if config.allInsideGetQuest then
setPlayerStorageValue(pid, config.finishStorage, 1)
doPlayerSendTextMessage(pid, MESSAGE_INFO_DESCR, "You have slain the Demon oak! Now go get your reward at the gravestone south of this nasty place.")
else
setPlayerStorageValue(cid, config.finishStorage, 1)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have slain the Demon oak! Now go get your reward at the gravestone south of this nasty place.")
end
end
end
end
if getPlayerStorageValue(cid, v[1]) < 1 then
if math.random(1, 100) >= config.chance then
oldPos = getPlayerPosition(cid)
doTeleportThing(cid, config.demonOakPos, true)
doCreatureSay(cid, text, TALKTYPE_ORANGE_2)
doTeleportThing(cid, oldPos, true)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -270, -310, CONST_ME_BIGPLANTS)
for k,s in ipairs(mobs) do
poz = mPos[math.random(1, #mPos)]
doCreateMonster(s, getClosestFreeTile(cid, poz))
end
else
setPlayerStorageValue(cid, itemEx.itemid, 1)
doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -270, -310, CONST_ME_BIGPLANTS)
for k,s in ipairs(mobs) do
poz = mPos[math.random(1, #mPos)]
doCreateMonster(s, getClosestFreeTile(cid, poz))
end
end
else
doSendMagicEffect(toPosition, CONST_ME_POFF)
end
end
return true
end
end
function blockingTree(cid)
doMoveCreature(cid, SOUTH)
doCreatureSetNoMove(cid, 0)
doCreateItem(config.blockingTree, 1, config.blockingTreePos)
doSendMagicEffect(config.blockingTreePos, CONST_ME_BIGPLANTS)
end
Last edited: