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

TFS 1.X+ The Keeper script

ralke

(҂ ͠❛ ෴ ͡❛)ᕤ
Joined
Dec 17, 2011
Messages
1,470
Solutions
27
Reaction score
844
Location
Santiago - Chile
GitHub
ralke23
Twitch
ralke23
Hi! I'm trying to replicate wrath of the emperor quest, and I have passed this script to my server
But i'm getting this error. This happens when I use flask of plan poison (itemid 12320) in a tentacle with actionid 8026

unknown.png

This video should explain how it works:


What is wrong here? Thanks in advance!
Post automatically merged:

The same happens using revscritpsys

Lua:
local function revertKeeperstorage()
    Game.setStorageValue(PlayerStorageKeys.WrathoftheEmperor.Mission03, 0)
end

local wrathEmperorMiss3Keeper = Action()
function wrathEmperorMiss3Keeper.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if item.itemid == 12320 and target.actionid == 8026 then
        if Game.getStorageValue(PlayerStorageKeys.WrathoftheEmperor.Mission03) < 5 then
            Game.setStorageValue(PlayerStorageKeys.WrathoftheEmperor.Mission03, math.max(0, Game.getStorageValue(Storage.WrathoftheEmperor.Mission03)) + 1)
            player:say("The plant twines and twiggles even more than before, it almost looks as it would scream great pain.", TALKTYPE_MONSTER_SAY)
        elseif Game.getStorageValue(PlayerStorageKeys.WrathoftheEmperor.Mission03) == 5 then
            Game.setStorageValue(PlayerStorageKeys.WrathoftheEmperor.Mission03, 6)
            toPosition:sendMagicEffect(CONST_ME_YELLOW_RINGS)
            Game.createMonster('the keeper', {x = 1290, y = 984, z = 13})
            Position({x = 1290, y = 984, z = 13}):sendMagicEffect(CONST_ME_TELEPORT)
            addEvent(revertKeeperstorage, 60 * 1000)
        end
    elseif item.itemid == 12316 then
        if player:getStorageValue(PlayerStorageKeys.WrathoftheEmperor.Questline) == 7 then
            player:setStorageValue(PlayerStorageKeys.WrathoftheEmperor.Questline, 8)
            player:setStorageValue(PlayerStorageKeys.WrathoftheEmperor.Mission03, 2) --Questlog, Wrath of the Emperor "Mission 03: The Keeper"
            player:addItem(12323, 1)
        end
    end
    return true
end

wrathEmperorMiss3Keeper:id(12320,12316)
wrathEmperorMiss3Keeper:register()

And triggers this:
1656203718582.png
 
Last edited:
Solution
it's because the key doesn't exists in the globalStorage table...

you can add this between the line 7 and 8:

Lua:
if not Game.getStorageValue(PlayerStorageKeys.WrathoftheEmperor.Mission03) then
    revertKeeperstorage()
end

2nd.

Lua:
local function revertItem(position, itemId, transformId)
    local item = Tile(position):getItemById(itemId)
    if item then
        item:transform(transformId)
    end
end

function onStepIn(creature, item, position, fromPosition)
    if not creature:isMonster() then
        return true
    end

    if creature:getName():lower() ~= 'the keeper' then
        return true
    end

    doTargetCombat(0, creature, COMBAT_PHYSICALDAMAGE, -6000, -8000, CONST_ME_BIGPLANTS)
    item:transform(12335)...
line 8:
Lua:
if Game.getStorageValue(PlayerStorageKeys.WrathoftheEmperor.Mission03) < 5 then

is trying to compare nil with a number... ur problem is that you didn't define this variable:

Code:
PlayerStorageKeys.WrathoftheEmperor.Mission03
 
line 8:
Lua:
if Game.getStorageValue(PlayerStorageKeys.WrathoftheEmperor.Mission03) < 5 then

is trying to compare nil with a number... ur problem is that you didn't define this variable:

Code:
PlayerStorageKeys.WrathoftheEmperor.Mission03

I registered it on lib/core/storage.lua inside PlayerStorageKeys since the beginning
1656206597619.png

This means that the player doesn't have the storage or the script is not working properly?
Thanks for the answer!
Post automatically merged:

I also have a second error, with The Keeper's moveevent. When the monster steps into the poison fields , 12334, it shows the following error:
1656207082429.png

The .lua file is the following:
Lua:
local function revertItem(position, itemId, transformId)
    local item = Tile(position):getItemById(itemId)
    if item then
        item:transform(transformId)
    end
end

function onStepIn(creature, item, position, fromPosition)
    local monster = creature:isMonster()
    if not monster then
        return true
    end

    if monster:getName():lower() ~= 'the keeper' then
        return true
    end

    doTargetCombat(0, monster, COMBAT_PHYSICALDAMAGE, -6000, -8000, CONST_ME_BIGPLANTS)
    item:transform(12335)
    addEvent(revertItem, math.random(10, 30) * 1000, position, 12335, 12334)
    return true
end
 
Last edited:
it's because the key doesn't exists in the globalStorage table...

you can add this between the line 7 and 8:

Lua:
if not Game.getStorageValue(PlayerStorageKeys.WrathoftheEmperor.Mission03) then
    revertKeeperstorage()
end

2nd.

Lua:
local function revertItem(position, itemId, transformId)
    local item = Tile(position):getItemById(itemId)
    if item then
        item:transform(transformId)
    end
end

function onStepIn(creature, item, position, fromPosition)
    if not creature:isMonster() then
        return true
    end

    if creature:getName():lower() ~= 'the keeper' then
        return true
    end

    doTargetCombat(0, creature, COMBAT_PHYSICALDAMAGE, -6000, -8000, CONST_ME_BIGPLANTS)
    item:transform(12335)
    addEvent(revertItem, math.random(10, 30) * 1000, position, 12335, 12334)
    return true
end
 
Last edited:
Solution
it's because the key doesn't exists in the globalStorage table...

you can add this between the line 7 and 8:

Lua:
if not Game.getStorageValue(PlayerStorageKeys.WrathoftheEmperor.Mission03) then
    revertKeeperstorage()
end

2nd.

Lua:
local function revertItem(position, itemId, transformId)
    local item = Tile(position):getItemById(itemId)
    if item then
        item:transform(transformId)
    end
end

function onStepIn(creature, item, position, fromPosition)
    if not creature:isMonster() then
        return true
    end

    if creature:getName():lower() ~= 'the keeper' then
        return true
    end

    doTargetCombat(0, creature, COMBAT_PHYSICALDAMAGE, -6000, -8000, CONST_ME_BIGPLANTS)
    item:transform(12335)
    addEvent(revertItem, math.random(10, 30) * 1000, position, 12335, 12334)
    return true
end

Thanks you helped me a lot! Well at the end was my bad, forgot to change one of the storages. But I was only able to see it because of your help. Solved :)

By the way, what is wrong on attempt to index local 'monster' on the post I wrote before?
Post automatically merged:

Everything is perfect now @pepe thanks a lot!
1656208539553.png
 
Thanks you helped me a lot! Well at the end was my bad, forgot to change one of the storages. But I was only able to see it because of your help. Solved :)

By the way, what is wrong on attempt to index local 'monster' on the post I wrote before?

monster variable was a boolean value after calling creature:isMonster() and you were using it as it was a monster "object" (table)
 
Back
Top