• 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+ Zlak task (Lizard Magistratus)

ralke

(҂ ͠❛ ෴ ͡❛)ᕤ
Joined
Dec 17, 2011
Messages
1,515
Solutions
27
Reaction score
868
Location
Santiago - Chile
GitHub
ralke23
Twitch
ralke23
Hi! I'm having troubles trying to make Zlak mission 06 from Wrath of the Emperor. It tells you to get 4 Lizard Magistratus kills and then report it. The thing is, that the creaturescript i'm using for that is not working, because I already get the correct storage from Zlak to start the hunt (PlayerStorageKeys.WrathoftheEmperor.Mission06), but the counter on the questlog doesn't count +1 when I kill a magistratus.

This is the creaturescript, it is already registered on login.lua

Lua:
local events = {
    'WotELizardMagistratus',
    'WotEBosses',
    'WotEKeeper',
    'WotELizardNoble',
    'WotEZalamon'
}

Lua:
player:registerEvent("WotELizardNoble")
    player:registerEvent("WotEKeeper")
    player:registerEvent("WotEBosses")
    player:registerEvent("WotEZalamon")

Lua:
function onKill(creature, target)
    local targetMonster = target:getMonster()
    if not targetMonster then
        return true
    end

    if targetMonster:getName():lower() ~= 'lizard magistratus' then
        return true
    end

    local player = creature:getPlayer()
    if player:getStorageValue(PlayerStorageKeys.WrathoftheEmperor.Mission06) >= 0 and player:getStorageValue(PlayerStorageKeys.WrathoftheEmperor.Mission06) < 4 then
        player:setStorageValue(PlayerStorageKeys.WrathoftheEmperor.Mission06, math.max(1, storage) + 1)
    end

    return true
end

Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

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

local function creatureSayCallback(cid, type, msg)
    if not npcHandler:isFocused(cid) then
        return false
    end
    local player = Player(cid)
    if msgcontains(msg, "mission") then
        if player:getStorageValue(PlayerStorageKeys.WrathoftheEmperor.Questline) == 22 then
            npcHandler:say({
                "Ze rumour mill iz quite fazt. Ezpecially when zomeone unuzual az you enterz ze zity. Zoon zey will learn zat you have no reazon to be here and our raze will be buzted. ...",
                "Zo we have to ztrike fazt and quickly. You will have to eliminate zome high ranking key officialz. I zink killing four of zem should be enough. ...",
                "Ziz will dizrupt ze order in ze zity zignificantly zinze zo much dependz on bureaucracy and ze chain of command. Only chaoz and dizorganization will enable me to help you with ze next ztep in ze plan."
            }, cid)
            player:setStorageValue(PlayerStorageKeys.WrathoftheEmperor.Questline, 23)
            player:setStorageValue(PlayerStorageKeys.WrathoftheEmperor.Mission05, 3) --Questlog, Wrath of the Emperor "Mission 05: New in Town"
            player:setStorageValue(PlayerStorageKeys.WrathoftheEmperor.Mission06, 0) --Questlog, Wrath of the Emperor "Mission 06: The Office Job"
            npcHandler.topic[cid] = 0
        elseif player:getStorageValue(PlayerStorageKeys.WrathoftheEmperor.Questline) == 23 and player:getStorageValue(PlayerStorageKeys.WrathoftheEmperor.Mission06) == 4 then
            npcHandler:say({
                "Chaoz and panic are already zpreading. Your barbaric brutality iz frightening effectively. I could acquire a key zat we need to get you into ze palaze itzelf. But zere are ztill too many guardz and elite zquadz even for you to fight. ...",
                "I need you to enter ze zity and zlay at leazt zix noblez. Ze otherz will feel zreatened and call guardz to zemzelvez, and ze dragon kingz will accuze each ozer to be rezponzible for zlaying zeir pet noblez. ...",
                "Zat should enable uz to give you at leazt a chanze to attack ze palaze."
            }, cid)
            player:setStorageValue(PlayerStorageKeys.WrathoftheEmperor.Questline, 24)
            player:setStorageValue(PlayerStorageKeys.WrathoftheEmperor.Mission07, 0) --Questlog, Wrath of the Emperor "Mission 07: A Noble Cause"
            npcHandler.topic[cid] = 0
        elseif player:getStorageValue(PlayerStorageKeys.WrathoftheEmperor.Questline) == 24 and player:getStorageValue(PlayerStorageKeys.WrathoftheEmperor.Mission07) == 6 then
            if npcHandler.topic[cid] ~= 1 then
                npcHandler:say({
                    "Word of your deedz iz already zpreading like a wildfire. Zalamon'z plan to unleash zome murderouz beaztz in ze zity workz almozt too well. You are already becoming zome kind of legend with which motherz frighten zeir unruly hatchlingz. ...",
                    "Your next {mizzion} will be a ztrike into ze heart of ze empire."
                }, cid)
                npcHandler.topic[cid] = 1
            else
                npcHandler:say({
                    "Your eagernezz for killing and bloodshed iz frightening, but your next mizzion will zuit your tazte. Wiz ze zity in chaoz and defenzez diverted, ze ztage iz zet for our final ztrike. ...",
                    "A large number of rebelz have arrived undercover in ze zity. Zey will attack ze palaze and zome loyal palaze guardz will let zem in. ...",
                    "Meanwhile, you will take ze old ezcape tunnel zat leadz from ze abandoned bazement in ze norz of ze miniztry to a lift zat endz zomewhere in ze palaze. ...",
                    "When everyzing workz according to ze plan, you will meet Zalamon zomewhere in the underground part of ze palaze."
                }, cid)
                player:setStorageValue(PlayerStorageKeys.WrathoftheEmperor.Mission08, 1) --Questlog, Wrath of the Emperor "Mission 08: Uninvited Guests"
                player:setStorageValue(PlayerStorageKeys.WrathoftheEmperor.Questline, 25)
                npcHandler.topic[cid] = 0
            end
        end
    end
    return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

I believe there's a problem on how the function is built, since I checked kills.lua from Killing in the Name of, and Pythius the Rotten quest, they start with
Lua:
function onKill(player, target)
    if target:isPlayer() or target:getMaster() then
        return true
    end

I'm not good at lua at all, there's no errors in console when killing a Magistratus, so I call you guys for possible answers or paths to make this start working. There's not much left to finish the whole quest, this is actually the mission 06. It will appear as mission 5 on questlog because I completely removed the original mission 2.

1656289577116.png
So please, help! Thanks in advance :)
Post automatically merged:

Triggered this error after some changes
1656301447955.png

Lua:
function onKill(creature, target)
    local targetMonster = target:getMonster()
    if not targetMonster then
        return true
    end

    if targetMonster:getName():lower() ~= 'lizard magistratus' then
        return true
    end

    local player = creature:getPlayer() 
    if player:getStorageValue(PlayerStorageKeys.WrathoftheEmperor.Mission06) >= 0 and player:getStorageValue(PlayerStorageKeys.WrathoftheEmperor.Mission06) < 4 then
        player:setStorageValue(PlayerStorageKeys.WrathoftheEmperor.Mission06, math.max(1, storage) + 1)
    end

    return true
end
Post automatically merged:

Solved, this worked well
Lua:
function onKill(creature, target)
    local targetMonster = target:getMonster()
    if not targetMonster then
        return true
    end

    if targetMonster:getName():lower() ~= 'lizard magistratus' then
        return true
    end

    local player = creature:getPlayer() 
    if player:getStorageValue(PlayerStorageKeys.WrathoftheEmperor.Mission06) >= 0 and player:getStorageValue(PlayerStorageKeys.WrathoftheEmperor.Mission06) < 4 then
        player:setStorageValue(PlayerStorageKeys.WrathoftheEmperor.Mission06, math.max(1, player:getStorageValue(PlayerStorageKeys.WrathoftheEmperor.Mission06)) + 1)
    end

    return true
end
 
Last edited:
Back
Top