• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua Need help with Demon Oak script

therrax

Member
Joined
Jul 12, 2012
Messages
262
Solutions
1
Reaction score
11
Hi.
info: TFS 1.0
When I use hallowed axe on dead three, nothing happens.. my scripts..
I add uid to three 32193. My hallowed axe: 8293 My three; 2709
Whats wrong? :/
ACTIONS
demonOakGravestone.lua:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
        local newPosition = {x=359, y=824, z=8}
        if(item.itemid == 8059 and getPlayerStorageValue(cid, 35700) > 0) then
                doTeleportThing(cid, newPosition, TRUE)
                doSendMagicEffect(newPosition, CONST_ME_TELEPORT)
                doSendMagicEffect(fromPosition, CONST_ME_POFF)
                setPlayerStorageValue(cid, 35700, -1)
        end
        return TRUE
end
demonOak.lua:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)

local onePerQuest = "yes"
local level = 120
local positions =
{
        kick = { x = 352, y = 809, z = 7 },
        summon =
        {
                {x=350, y=821, z=7},
                {x=351, y=824, z=7},
                {x=354, y=818, z=7},
                {x=358, y=824, z=7}
        }
}

local summons =
{
        [1] = {"Demon", "Grim Reaper", "Elder Beholder", "Demon Skeleton"},
        [2] = {"Dark Torturer", "Banshee", "Betrayed Wraith", "Blightwalker"},
        [3] = {"Bonebeast", "Braindeath", "Diabolic Imp", "Giant Spider"},
        [4] = {"Hand of Cursed Fate", "Lich", "Undead Dragon", "Vampire"},
        [5] = {"braindeath", "Demon", "Bonebeast", "Diabolic Imp"},
        [6] = {"Demon Skeleton", "Banshee", "Elder Beholder", "Bonebeast"},
        [7] = {"Dark Torturer", "Undead Dragon", "Demon", "Demon"},
        [8] = {"Elder Beholder", "Betrayed Wraith", "Demon Skeleton", "Giant Spider"},
        [9] = {"Demon", "Banshee", "Blightwalker", "Demon Skeleton"},
        [10] = {"Grim Reaper", "Demon", "Diabolic Imp", "Braindeath"},
        [11] = {"Banshee", "Grim Reaper", "Hand of Cursed fate", "Demon"}
}

local areaPosition =
{
        {x=344, y=815, z=7, stackpos = 255},
        {x=361, y=827, z=7, stackpos = 255}
}

local demonOak = {8288, 8289, 8290, 8291}

local storages =
{
        done = 35700,
        cutTree = 36901
}


       if isInArray(demonOak, itemEx.itemid) then

                local get = getPlayerStorageValue(cid, itemEx.itemid)
                if get == -1 then
                        get = 1
                end

                if(getPlayerStorageValue(cid, 8288) == 12 and getPlayerStorageValue(cid, 8289) == 12 and getPlayerStorageValue(cid, 8290) == 12 and getPlayerStorageValue(cid, 8291) == 12) then
                        doTeleportThing(cid, positions.kick)
                        setGlobalStorageValue(cid,35734,-1)
                        setPlayerStorageValue(cid, storages.done, 1)
                        setPlayerStorageValue(cid, storages.done, 1)
                        return TRUE
                end

                if getPlayerStorageValue(cid, itemEx.itemid) > 11 then
                        doSendMagicEffect(toPosition, CONST_ME_POFF)
                        return TRUE
                end

                if(math.random(100) <= 10) then
                        setPlayerStorageValue(cid, itemEx.uid, 12)
                        return TRUE
                end


                if summons[get] then
                for i = 1, #summons[get] do
                        doSummonCreature(summons[get][i], positions.summon[i])
                end
                        doSendMagicEffect(toPosition, CONST_ME_DRAWBLOOD)
                        setPlayerStorageValue(cid, itemEx.itemid, get + 1)
                        if math.random(100) >= 50 then
                        doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -270, -310, CONST_ME_BIGPLANTS)
                        end
                end
        return FALSE
        end
end
demonOakChests.lua:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)

        if item.uid == 12901 then
                queststatus = getPlayerStorageValue(cid, 12900)
                if queststatus < 1 then
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found a Demon Legs.")
                        doPlayerAddItem(cid, 2495, 1)
                        setPlayerStorageValue(cid, 12900, 1)
                else
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.")
                end
        elseif item.uid == 12902 then
                queststatus = getPlayerStorageValue(cid, 12900)
                if queststatus < 1 then
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found a Rainbow Shield.")
                        doPlayerAddItem(cid, 8905, 1)
                        setPlayerStorageValue(cid, 12900, 1)
                else
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.")
                end
        elseif item.uid == 12904 then
                queststatus = getPlayerStorageValue(cid, 12900)
                if queststatus < 1 then
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found a Spellbook of Ancient Arcana.")
                        doPlayerAddItem(cid, 16112, 1)
                        setPlayerStorageValue(cid, 12900, 1)
                else
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.")
                end
        elseif item.uid == 12903 then
                queststatus = getPlayerStorageValue(cid, 12900)
                if queststatus < 1 then
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found a Thorn Spitter.")
                        doPlayerAddItem(cid, 16111, 1)
                        setPlayerStorageValue(cid, 12900, 1)
                else
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.")
                end
        end
                return TRUE
end
CREATURESCRIPTS
demonOakDeath:
Code:
function onDeath(cid, corpse)
      
if getPlayerStorageValue(cid, 36901) > 0 and getPlayerStorageValue(cid, 35700) < 1 then
              
setPlayerStorageValue(cid, 36901, 0)
      
        else
        if isPlayer(cid) and getGlobalStorageValue(cid,35734,1) then
                setGlobalStorageValue(cid,35734,-1)
        end
   end
return TRUE

end
demonOakLogout:
Code:
function onLogout(cid)

      
if getPlayerStorageValue(cid, 36901) > 0 and getPlayerStorageValue(cid, 35700) < 1 then
              
setPlayerStorageValue(cid, 36901, 0)
              
        else
        if isPlayer(cid) and getGlobalStorageValue(cid,35734,1) then
                setGlobalStorageValue(cid,35734,-1)
        end
   end
return TRUE

end
in LOGIN.LUA:
Code:
    player:registerEvent("demonOakLogout")
    player:registerEvent("demonOakDeath")
MOVEMENTS
demonOakArea:

Code:
function onStepIn(cid, item, position, fromPosition)

    if isPlayer(cid) == TRUE and math.random(1, 24) == 1 then
        doTargetCombatHealth(0, cid, COMBAT_EARTHDAMAGE, -270, -310, CONST_ME_BIGPLANTS)
    end
    return TRUE
end
demonOakThree:
Code:
function onStepOut(cid, item, position, fromPosition)
    if item.uid == 32193 then
        doTransformItem(item.uid, 2709)
    end
    return TRUE
end

actions.xml
Code:
    <action itemid="8293" script="demonOak.lua"/>

    <action fromuid="12901" touid ="12904" script="demonOakChests.lua"/>
    <action uniqueid="55100" script="demonOakGravestone.lua" />
    <action uniqueid="36901" script="hallowedaxe.lua" />
creturescripts.xml
Code:
    <event type="logout" name="demonOakLogout" script="demonOakLogout.lua"/>

  <event type="death" name="demonOakDeath" script="demonOakDeath.lua"/>
movements.xml
Code:
    <movevent event="StepOut" uniqueid="32193" script="demonOakTree.lua" />
    <movevent event="StepIn" itemid="8292" script="demonOakArea.lua" />
 
demonoak.jpg


I add "print" under main script and after I used hallowed axe on it, i got this
"[GM] Therrax has logged in.
Test: script is loading"
but nothing happens :/
so It works but hallowed axe dont cut three :/
 
Last edited by a moderator:
Add print under the function to all scripts that don't do anything, then look which one does not give the message in your console.
You can add the scriptname in the print so you know which ones are loading and which aren't.
Code:
print("Test: script hallowedaxe is loading")
 
Back
Top