• 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 Boss Transform

adrenyslopez

Member
Joined
Dec 22, 2015
Messages
201
Reaction score
15
everyone, I have a problem with this scripts, I am using it on a creature and it works 100% and I made another one only that with another creature and it does not work
i used otbr tfs 1.3

This is working
Lua:
local bossForms = {
    ['snake god essence'] = {
        text = 'IT\'S NOT THAT EASY MORTALS! FEEL THE POWER OF THE GOD!',
        newForm = 'snake thing'
    },
    ['snake thing'] = {
        text = 'NOOO! NOW YOU HERETICS WILL FACE MY GODLY WRATH!',
        newForm = 'lizard abomination'
    },
    ['lizard abomination'] = {
        text = 'YOU ... WILL ... PAY WITH ETERNITY ... OF AGONY!',
        newForm = 'mutated zalamon'
    }
}

local zalamonKill = CreatureEvent("ZalamonKill")
function zalamonKill.onKill(player, target)
    local targetMonster = target:getMonster()
    if not targetMonster then
        return true
    end

    if targetMonster:getName():lower() == 'mutated zalamon' then
        Game.setStorageValue(Storage.WrathoftheEmperor.Mission11, -1)
        return true
    end

    local name = targetMonster:getName():lower()
    local bossConfig = bossForms[name]
    if not bossConfig then
        return true
    end

    local found = false
    for k, v in ipairs(Game.getSpectators(targetMonster:getPosition())) do
        if v:getName():lower() == bossConfig.newForm then
            found = true
            break
        end
    end

    if not found then
        Game.createMonster(bossConfig.newForm, targetMonster:getPosition(), false, true)
        player:say(bossConfig.text, TALKTYPE_MONSTER_SAY)
    end
    return true
end

zalamonKill:register()


And this one doesn't work
Code:
local bossForms = {
    ['feroxa'] = {
        text = 'Transform!',
        newForms = 'feroxa weak'
    },
    ['feroxa weak'] = {
        text = 'Transform!',
        newForms = 'feroxa human'
    },
    ['feroxa human'] = {
        text = 'Transform!',
        newForms = 'feroxa wolf'
    },
    ['feroxa wolf'] = {
        text = 'Transform!',
        newForms = 'Feroxa Ultimate'
    }
}

local feroxaKill = CreatureEvent("FeroxaKill")
function feroxaKill.onKill(player, target)
    local targetMonster = target:getMonster()
    if not targetMonster then
        return true
    end

    local name = targetMonster:getName():lower()
    local bossConfig = bossForms[name]
    if not bossConfig then
        return true
    end

    local found = false
    for k, v in ipairs(Game.getSpectators(targetMonster:getPosition())) do
        if v:getName():lower() == bossConfig.newForms then
            found = true
            break
        end
    end

    if not found then
        Game.createMonster(bossConfig.newForms, targetMonster:getPosition(), false, true)
        player:say(bossConfig.text, TALKTYPE_MONSTER_SAY)
    end
    return true
end

feroxaKill:register()
 
Did you registered second script in login.lua/loginevents?
In login_events.lua yes (line 102)

Lua:
local loginEvents = CreatureEvent("LoginEvents")
function loginEvents.onLogin(player)

    local events = {
        --Monster
        "LowerRoshamuul",
        --Others
        "AdvanceSave",
        "BestiaryOnKill",
        "BossParticipation",
        "DropLoot",
        "PlayerDeath",
        "PreyLootBonusKill",
        "RookgaardAdvance",
        "FamiliarLogin",
        "AdvanceFamiliar",
        --Quests
        --Adventurers Guild Quest
        "Thegreatdragonhuntkill",
        --Bigfoot Burden Quest
        "BossesWarzone",
        "ParasiteWarzone",
        "VersperothKill",
        "WigglerKill",
        --Cults Of Tibia Quest
        "BossesCults",
        "MinotaurTask",
        "VortexCarlin",
        "LeidenHeal",
        "GlowingRubbishAmulet",
        "DestroyedPillar",
        "HealthPillar",
        "YalahariHealth",
        --Dangerous Depths Quest
        "LostExileKill",
        "SnailSlimeKill",
        "TheBaronFromBelowKill",
        --Dawnport Quest
        "MorrisMinotaurKill",
        "MorrisGoblinKill",
        "MorrisTrollKill",
        --Elemental Spheres Quest
        "OverlordKill",
        --Ferumbras Ascendant Quest
        "AscendantBossesKill",
        "TheShattererKill",
        --Firewalker Boots
        "PythiusTheRottenKill",
        --Forgotten Knowledge Quest
        "BossesForgottenKill",
        "AstralPower",
        "EnergyPrismDeath",
        "ReplicaServant",
        --Hero Of Rathleton
        "RathletonBossKill",
        --Secret Service
        "BlackKnightKill",
        --Service Of Yalahar
        "DiseasedTrio",
        "Azerus",
        "QuaraLeaders",
        --Inquisition
        "InquisitionBossKill",
        "UngreezKill",
        --Killing In The Name Of
        "KillingInTheNameOfKill",
        "KillingInTheNameOfMinotaurKill",
        --Kilmaresh
        "BragrumolKill",
        "MozradekKill",
        "XogixathKill",
        "FafnarKill",
        --Liquid Black
        "DeeplingBosses",
        "killJaul",
        "killObujos",
        "killTanjis",
        --Raging Mage Worldchange
        "EnergizedRagingMageKill",
        "RagingMageKill",
        "YielothaxKill",
        --Spike Tasks
        "LowerSpikeKill",
        "UpperSpikeKill",
        "MiddleSpikeKill",
        --Svargrond Arena
        "SvargrondArenaKill",
        --The First Dragon
        "KillDragon",
        "SomewhatBeatableDeath",
        --The New Frontier
        "ShardOfCorruptionKill",
        "TireczKill",
        --Thieves Guild
        "NomadKill",
        --Wrath of the Emperor
        "LizardMagistratusKill",
        "LizardNobleKill",
        "KeeperKill",
        "BossesKill",
        "ZalamonKill",
        "FeroxaKill",
        -- The Rookie Guard
        "VascalirRatKills",
        -- Grave Danger
        "TheDukeHealFireDamage",
        -- Feaster Of Souls
        "feasterBossKill"
    }

    for i = 1, #events do
        player:registerEvent(events[i])
    end
    return true
end
loginEvents:register()

But in login.lua I don't know how to add it

Code:
local function onMovementRemoveProtection(cid, oldPos, time)
    local player = Player(cid)
    if not player then
        return true
    end

    local playerPos = player:getPosition()
    if (playerPos.x ~= oldPos.x or playerPos.y ~= oldPos.y or playerPos.z ~= oldPos.z) or player:getTarget() then
        player:setStorageValue(Storage.combatProtectionStorage, 0)
        return true
    end

    addEvent(onMovementRemoveProtection, 1000, cid, oldPos, time - 1)
end

local function protectionZoneCheck(playerName)
    doRemoveCreature(playerName)
    return true
end

local playerLogin = CreatureEvent("PlayerLogin")

function playerLogin.onLogin(player)
    local items = {
        {0, 0},
        {0, 0}
    }
    if player:getLastLoginSaved() == 0 then
        player:sendOutfitWindow()
        local backpack = player:addItem(0)
        if backpack then
            for i = 1, #items do
                backpack:addItem(items[i][1], items[i][2])
            end
        end
        player:addItem(0, 0, true, 0, CONST_SLOT_AMMO)
    else
        player:sendTextMessage(MESSAGE_STATUS, "Welcome to " .. SERVER_NAME .. "!")
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, " Welcome to our server, thank you for choosing us.")
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Remember that when playing with client 12 you get a bonus of 30% more experience.")
        player:sendTextMessage(MESSAGE_LOGIN, string.format("Your last visit in ".. SERVER_NAME ..": %s.", os.date("%d. %b %Y %X", player:getLastLoginSaved())))
    end

    local playerId = player:getId()

    -- kick other players from account
    if configManager.getBoolean(configKeys.ONE_PLAYER_ON_ACCOUNT) then
        local resultId = db.storeQuery("SELECT players.name FROM `players` INNER JOIN `players_online` WHERE players_online.player_id=players.id and players_online.player_id!=" .. player:getGuid() .. " and players.account_id=" .. player:getAccountId())
        if resultId ~= false then
            repeat
                if player:getAccountType() <= ACCOUNT_TYPE_GOD and player:getGroup():getId() < GROUP_TYPE_GOD then
                    local name = result.getDataString(resultId, "name")
                    if getCreatureCondition(Player(name), CONDITION_INFIGHT) == false then
                        Player(name):remove()
                    else
                        addEvent(protectionZoneCheck, 2000, player:getName())
                        doPlayerPopupFYI(player, "You cant login now.")
                    end
                end
            until not result.next(resultId)
                result.free(resultId)
        end
    end
    -- End kick other players from account
    if isPremium(player) then
        player:setStorageValue(Storage.PremiumAccount, 1)
    end

    -- Recruiter system
    local resultId = db.storeQuery('SELECT `recruiter` from `accounts` where `id`='..getAccountNumberByPlayerName(getPlayerName(player)))
    local recruiterStatus = result.getNumber(resultId, 'recruiter')
    local sex = player:getSex()
    if recruiterStatus >= 1 then
        if sex == 1 then
            local outfit = player:hasOutfit(746)
            if outfit == false then
                player:addOutfit(746)
            end
        else
            local outfit = player:hasOutfit(745)
            if outfit == false then
                player:addOutfit(745)
            end
        end
    end
    if recruiterStatus >= 3 then
        if sex == 1 then
            local outfit = player:hasOutfit(746,1)
            if outfit == false then
                player:addOutfitAddon(746,1)
            end
        else
            local outfit = player:hasOutfit(745,1)
            if outfit == false then
                player:addOutfit(745,1)
            end
        end
    end
    if recruiterStatus >= 10 then
        if sex == 1 then
            local outfit = player:hasOutfit(746,2)
            if outfit == false then
                player:addOutfitAddon(746,2)
            end
        else
            local outfit = player:hasOutfit(745,2)
            if outfit == false then
                player:addOutfit(745,2)
            end
        end
    end
    -- End recruiter system

    DailyReward.init(playerId)

    player:loadSpecialStorage()

    if player:getGroup():getId() >= GROUP_TYPE_GAMEMASTER then
        player:setGhostMode(true)
    end

    -- Boosted creature
    player:sendTextMessage(MESSAGE_BOOSTED_CREATURE, "Today's boosted creature: " .. Game.getBoostedCreature() .. " \
    Boosted creatures yield more experience points, carry more loot than usual and respawn at a faster rate.")

    -- Stamina
    nextUseStaminaTime[playerId] = 1

    -- EXP Stamina
    nextUseXpStamina[playerId] = 1

    -- Prey Small Window
    for slot = CONST_PREY_SLOT_FIRST, CONST_PREY_SLOT_THIRD do
        player:sendPreyData(slot)
    end

    -- New prey
    nextPreyTime[playerId] = {
        [CONST_PREY_SLOT_FIRST] = 1,
        [CONST_PREY_SLOT_SECOND] = 1,
        [CONST_PREY_SLOT_THIRD] = 1
    }

    if (player:getAccountType() == ACCOUNT_TYPE_TUTOR) then
    local msg = [[:: Tutor Rules
        1 *> 3 Warnings you lose the job.
        2 *> Without parallel conversations with players in Help, if the player starts offending, you simply mute it.
        3 *> Be educated with the players in Help and especially in the Private, try to help as much as possible.
        4 *> Always be on time, if you do not have a justification you will be removed from the staff.
        5 *> Help is only allowed to ask questions related to tibia.
        6 *> It is not allowed to divulge time up or to help in quest.
        7 *> You are not allowed to sell items in the Help.
        8 *> If the player encounters a bug, ask to go to the website to send a ticket and explain in detail.
        9 *> Always keep the Tutors Chat open. (required).
        10 *> You have finished your schedule, you have no tutor online, you communicate with some CM in-game
        or ts and stay in the help until someone logs in, if you can.
        11 *> Always keep a good Portuguese in the Help, we want tutors who support, not that they speak a satanic ritual.
        12 *> If you see a tutor doing something that violates the rules, take a print and send it to your superiors. "
        - Commands -
        Mute Player: /mute nick, 90 (90 seconds)
        Unmute Player: /unmute nick.
        - Commands -]]
        player:popupFYI(msg)
    end

    if table.contains({TOWNS_LIST.DAWNPORT, TOWNS_LIST.DAWNPORT_TUTORIAL}, player:getTown():getId())then
        player:openChannel(3) -- World chat
    else
        player:openChannel(3) -- World chat
        player:openChannel(5) -- Advertsing main
    end

    -- Rewards
    local rewards = #player:getRewardList()
    if(rewards > 0) then
        player:sendTextMessage(MESSAGE_LOGIN, string.format("You have %d %s in your reward chest.",
        rewards, rewards > 1 and "rewards" or "reward"))
    end

    -- Update player id
    local stats = player:inBossFight()
    if stats then
        stats.playerId = player:getId()
    end

    if player:getStorageValue(Storage.combatProtectionStorage) < 1 then
        player:setStorageValue(Storage.combatProtectionStorage, 1)
        onMovementRemoveProtection(playerId, player:getPosition(), 10)
    end
   
    -- Set Client XP Gain Rate
    local baseExp = 100
    if Game.getStorageValue(GlobalStorage.XpDisplayMode) > 0 then
        baseExp = getRateFromTable(experienceStages, player:getLevel(), configManager.getNumber(configKeys.RATE_EXP))
    end

    local staminaMinutes = player:getStamina()
    local doubleExp = true --Can change to true if you have double exp on the server
    local staminaBonus = (staminaMinutes > 2340) and 150 or ((staminaMinutes < 840) and 50 or 100)
    if doubleExp then
        baseExp = baseExp * 2
    end
    player:setStaminaXpBoost(staminaBonus)
    player:setBaseXpGain(baseExp)

    if player:getStorageValue(Storage.isTraining) == 1 then --Reset exercise weapon storage
        player:setStorageValue(Storage.isTraining,0)
    end
    return true
end
playerLogin:register()
 
You don't need to add that in login.lua just login_events my bad.
Do you have it registered as creaturescript as
Lua:
<event type="kill" name="FeroxaKill" script="YourScriptName.lua"/>
 
Back
Top