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

Inquisition bosses (sometimes work, sometimes don't)

ralke

(҂ ͠❛ ෴ ͡❛)ᕤ
Joined
Dec 17, 2011
Messages
1,521
Solutions
27
Reaction score
870
Location
Santiago - Chile
GitHub
ralke23
Twitch
ralke23
hi there! for anyone who's hosting a real map server, o something similar. Anyone had faced some issues at inquisition quest? I have been using the one at orts datapack, that I think should be the most recent one? orts2/data/scripts/quests/missions/the_inquisition.lua at main · EPuncker/orts2 (https://github.com/EPuncker/orts2/blob/main/data/scripts/quests/missions/the_inquisition.lua#L37) it is based on this post from otland. My issue is that sometimes, when you kill an inquisition boss such as Ushuriel, it doesn't trigger the portal and sends you to "Escaping back to the Retreat". Happened with Latrivan/Golgordan too. The weirdest thing is that sometimes it DOES work. Players kill the boss and the portal appears. What could be working wrong here? Thanks in advance!

Revscriptsys version:

The script I use (guess it's the same without revscriptsys).
Lua:
local bosses = {
    ['ushuriel'] = 200,
    ['zugurosh'] = 201,
    ['madaret'] = 202,
    ['latrivan'] = 203,
    ['golgordan'] = 203,
    ['annihilon'] = 204,
    ['gorak infernal'] = 205
}

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

    local targetName = targetMonster:getName():lower()
    local bossStorage = bosses[targetName]
    if not bossStorage then
        return true
    end

    local newValue = 2
    if targetName == 'latrivan' or targetName == 'golgordan' then
        if Game.getStorageValue(bossStorage) == nil then
            Game.setStorageValue(bossStorage, 0)
        end
        newValue = math.max(0, Game.getStorageValue(bossStorage)) + 1
    end
    Game.setStorageValue(bossStorage, newValue)

    if newValue == 2 then
        player:say('Ahora tienes 3 minutos para salir de esta habitacion a traves del teletransportador. Te llevara a la siguiente habitacion.', TALKTYPE_MONSTER_SAY)
        addEvent(Game.setStorageValue, 3 * 60 * 1000, bossStorage, 0)
    end
    return true
end

Lua:
local teleports = {
    [2150] = {text = 'Entrando en la sala de Ushuriel.', newPos = Position(971, 1201, 12), storage = 0, alwaysSetStorage = true}, -- to ushuriel ward
    [2151] = {text = 'Entrando en las Cuevas de Cristal.', bossStorage = 200, newPos = Position(1076, 1194, 14), storage = 1}, -- from ushuriel ward
    [2152] = {text = 'Escapando de vuelta al Refugio.', newPos = Position(948, 1227, 14)}, -- from crystal caves
    [2153] = {text = 'Entrando en las Cuevas de Cristal.', newPos = Position(1076, 1194, 14), storage = 1}, -- to crystal caves
    [2154] = {text = 'Entrando en las Cuevas Hundidas.', newPos = Position(952, 1206, 11)}, -- to sunken caves
    [2155] = {text = 'Entrando al Laberinto de Espejos de la Locura.', newPos = Position(1072, 1184, 11)}, -- from sunken caves
    [2156] = {text = 'Entrando en la sala de Zugurosh.', newPos = Position(1106, 1191, 11)}, -- to zugurosh ward
    [2157] = {text = 'Entrando en los Pasillos Sangrientos.', bossStorage = 201, newPos = Position(1071, 1136, 14), storage = 2}, -- from zugurosh ward
    [2158] = {text = 'Escapando de vuelta al Refugio.', newPos = Position(948, 1227, 14)}, -- from blood halls
    [2159] = {text = 'Entrando en los Pasillos Sangrientos.', newPos = Position(1071, 1136, 14), storage = 2}, -- to blood halls
    [2160] = {text = 'Entrando en la Fundicion.', newPos = Position(1053, 1111, 11)}, -- to foundry
    [2161] = {text = 'Entrando en la sala de Madareth.', newPos = Position(1091, 1131, 11)}, -- to madareth ward
    [2162] = {text = 'Entrando en los Tanques.', bossStorage = 202, newPos = Position(867, 1205, 12), storage = 3}, -- from madareth ward
    [2163] = {text = 'Escapando de vuelta al Refugio.', newPos = Position(948, 1227, 14)}, -- from vats
    [2164] = {text = 'Entrando en los Tanques.', newPos = Position(867, 1205, 12), storage = 3}, -- to vats
    [2165] = {text = 'Entrando al Campo de Batalla.', newPos = Position(861, 1188, 11)}, -- to battlefield
    [2166] = {text = 'Entrando en los Tanques.', newPos = Position(947, 1181, 12)}, -- from battlefield
    [2167] = {text = 'Entrando en la Forja de Demonios.', newPos = Position(927, 1231, 11)}, -- to brothers ward
    [2168] = {text = 'Entrando en el Arcanum.', bossStorage = 203, newPos = Position(859, 1236, 12), storage = 4}, -- from demon forge
    [2169] = {text = 'Escapando de vuelta al Refugio.', newPos = Position(948, 1227, 14)}, -- from arcanum
    [2170] = {text = 'Entrando en el Arcanum.', newPos = Position(859, 1236, 12), storage = 4}, -- to arcanum
    [2171] = {text = 'Entrando en los Pozos de Almas.', newPos = Position(876, 1148, 13)}, -- to soul wells
    [2172] = {text = 'Entrando en el Arcanum.', newPos = Position(1007, 1242, 12)}, -- from soul wells
    [2173] = {text = 'Entrando en la sala de Annihilon.', newPos = Position(946, 1208, 13)}, -- to annihilon ward
    [2174] = {text = 'Entrando en la Colmena.', bossStorage = 204, newPos = Position(1150, 1153, 15), storage = 5}, -- from annihilon ward
    [2175] = {text = 'Escapando de vuelta al Refugio.', newPos = Position(948, 1227, 14)}, -- from hive
    [2176] = {text = 'Entrando en la Colmena.', newPos = Position(1150, 1153, 15), storage = 5}, -- to hive
    [2177] = {text = 'Entrando en la sala de Hellgorak.', newPos = Position(1106, 1135, 14)}, -- to hellgorak ward
    [2178] = {text = 'Entrando en el Nexo Sombrío. Abandonen toda esperanza.', bossStorage = 205, newPos = Position(1148, 1135, 12), storage = 6}, -- from hellgorak ward
    [2179] = {text = 'Escapando de vuelta al Refugio.', newPos = Position(948, 1227, 14)}, -- from nexo sombrio
    [2180] = {text = 'Entrando en los Pasillos Sangrientos.', newPos = Position(1056, 1112, 12)} -- from foundry to blood halls
}

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

    local teleport = teleports[item.uid]
    if teleport.alwaysSetStorage and player:getStorageValue(PlayerStorageKeys.TheInquisition.EnterTeleport) < teleport.storage then
        player:setStorageValue(PlayerStorageKeys.TheInquisition.EnterTeleport, teleport.storage)
    end

    if teleport.bossStorage then
        if Game.getStorageValue(teleport.bossStorage) == 2 then
            if player:getStorageValue(PlayerStorageKeys.TheInquisition.EnterTeleport) < teleport.storage then
                player:setStorageValue(PlayerStorageKeys.TheInquisition.EnterTeleport, teleport.storage)
            end
        else
            player:teleportTo(Position(948, 1227, 14))
            player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
            player:say('Escapando de vuelta al Refugio.', TALKTYPE_MONSTER_SAY)
            return true
        end
    elseif teleport.storage and player:getStorageValue(PlayerStorageKeys.TheInquisition.EnterTeleport) < teleport.storage then
        player:teleportTo(fromPosition)
        player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
        player:say('No tienes suficiente energía para entrar en este portal.', TALKTYPE_MONSTER_SAY)
        return true
    end

    player:teleportTo(teleport.newPos)
    player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
    player:say(teleport.text, TALKTYPE_MONSTER_SAY)
    return true
end

If any piece of code is missing, please let me know. I hope you guys can help me identify where is the issue! Regards :)
 
This system is a mess.

Lua:
if targetName == 'latrivan' or targetName == 'golgordan' then
        if Game.getStorageValue(bossStorage) == nil then
            Game.setStorageValue(bossStorage, 0)
        end
        newValue = math.max(0, Game.getStorageValue(bossStorage)) + 1
    end
Why are these two bosses different to the rest? Are they meant to be?
Their boss storage is only being set to 1, while all the others are being set to 2 (anything but 2 will send you back to the refuge)....

This part:
Lua:
local newValue = 2
if targetName == 'latrivan' or targetName == 'golgordan' then
    if Game.getStorageValue(bossStorage) == nil then
        Game.setStorageValue(bossStorage, 0)
    end
    newValue = math.max(0, Game.getStorageValue(bossStorage)) + 1
end
Game.setStorageValue(bossStorage, newValue)
can be rewritten to:
Lua:
Game.setStorageValue(bossStorage, 2)
and see what happens xD
 
Last edited:
This system is a mess.

Lua:
if targetName == 'latrivan' or targetName == 'golgordan' then
        if Game.getStorageValue(bossStorage) == nil then
            Game.setStorageValue(bossStorage, 0)
        end
        newValue = math.max(0, Game.getStorageValue(bossStorage)) + 1
    end
Why are these two bosses different to the rest? Are they meant to be?
Their boss storage is only being set to 1, while all the others are being set to 2 (anything but 2 will send you back to the refuge)....

This part:
Lua:
local newValue = 2
if targetName == 'latrivan' or targetName == 'golgordan' then
    if Game.getStorageValue(bossStorage) == nil then
        Game.setStorageValue(bossStorage, 0)
    end
    newValue = math.max(0, Game.getStorageValue(bossStorage)) + 1
end
Game.setStorageValue(bossStorage, newValue)
can be rewritten to:
Lua:
Game.setStorageValue(bossStorage, 2)
and see what happens xD
So many thanks! Golgordan and Latrivan are "brothers", they spawn in the same room. So I think, that killing them both is a requierement to "spawn" the teleport that makes you move to the next room. Replacing those lines will make it work as intended? Or that checks if one of those two was killed and then spawns the teleport?

I also wonder why Ushuriel's didn't work the first time. It has something coded badly that provoked that or code doesn't have any glitch that could trigger that? Any prints that could work as verification to get ensure that everything works fine? If you can let me know I will appreciate it so I can properly test it and send you the results ^^
 
So many thanks! Golgordan and Latrivan are "brothers", they spawn in the same room. So I think, that killing them both is a requierement to "spawn" the teleport that makes you move to the next room. Replacing those lines will make it work as intended? Or that checks if one of those two was killed and then spawns the teleport?

I also wonder why Ushuriel's didn't work the first time. It has something coded badly that provoked that or code doesn't have any glitch that could trigger that? Any prints that could work as verification to get ensure that everything works fine? If you can let me know I will appreciate it so I can properly test it and send you the results ^^
Replacing that line just simplifies the script instead of having a local variable for the storage value. Just doesnt make sense is all, doesnt change the functionality of the script at all. Seems like the reason it works the first time and not the second is because of:

Lua:
if Game.getStorageValue(bossStorage) == nil then
        Game.setStorageValue(bossStorage, 0)
    end
newValue = math.max(0, Game.getStorageValue(bossStorage)) + 1

As you can see, it checks if the storage is nil, then sets the storage to 0; then also sets the storage again to the newvalue but uses the math.max for some reason when I believe it wants to add from 0 until they reach 2 to unlock the addEvent part of the script?
Now I could be completely wrong, but here's what I'd do to make it work (without knowing the rest of how it should work)

Lua:
if targetName == 'latrivan' or targetName == 'golgordan' then
    if Game.getStorageValue(bossStorage) == nil then
        Game.setStorageValue(bossStorage, 0)
    end
    newValue = Game.getStorageValue(bossStorage) + 1
    Game.setStorageValue(bossStorage, newValue)
end

What happens now is if you kill the boss and your storage is -1, you will become storage 0. Then the script will begin adding value to that storage based on how many times youve killed it. So first time, Value = 1, second time value = 1 + 1 (2), third time = 2 + 1 (3).
Not sure if this will break functionality as it seems the value of 2 unlocks something but luckily it resets the storage to 0 already so it should function fine/be repeatable.
 
Last edited:
Replacing that line just simplifies the script instead of having a local variable for the storage value. Just doesnt make sense is all, doesnt change the functionality of the script at all. Seems like the reason it works the first time and not the second is because of:

Lua:
if Game.getStorageValue(bossStorage) == nil then
        Game.setStorageValue(bossStorage, 0)
    end
newValue = math.max(0, Game.getStorageValue(bossStorage)) + 1

As you can see, it checks if the storage is nil, then sets the storage to 0; then also sets the storage again to the newvalue but uses the math.max for some reason when I believe it wants to add from 0 until they reach 2 to unlock the addEvent part of the script?
Now I could be completely wrong, but here's what I'd do to make it work (without knowing the rest of how it should work)

Lua:
if targetName == 'latrivan' or targetName == 'golgordan' then
    if Game.getStorageValue(bossStorage) == nil then
        Game.setStorageValue(bossStorage, 0)
    end
    newValue = Game.getStorageValue(bossStorage) + 1
    Game.setStorageValue(bossStorage, newValue)
end

What happens now is if you kill the boss and your storage is -1, you will become storage 0. Then the script will begin adding value to that storage based on how many times youve killed it. So first time, Value = 1, second time value = 1 + 1 (2), third time = 2 + 1 (3).
Not sure if this will break functionality as it seems the value of 2 unlocks something but luckily it resets the storage to 0 already so it should function fine/be repeatable.
Aha, them 2 bosses are in the same room, now I understand why it was written(...poorly...) like that!

@ralke seems like you have some solutions here, let me know if they don't work and I'll help you out further.
 
Last edited:
I tested it here, and it seems to be working. I killed the boss 'Ushuriel,' and it unlocked, allowing access without any issues. Later, I tried 'Latrivan,' and it also granted access. The important thing is for you to test it to see if it's really working or not :), but actually, I just grabbed it and made the RevScripts that I like more, hahaha!

Lua:
local config = {
    bosses = {
        ['ushuriel'] = 200,
        ['zugurosh'] = 201,
        ['madaret'] = 202,
        ['latrivan'] = 203,
        ['golgordan'] = 203,
        ['annihilon'] = 204,
        ['gorak infernal'] = 205
    },
    teleports = {
        [2150] = {text = 'Entrando en la sala de Ushuriel.', newPos = Position(971, 1201, 12), storage = 0, alwaysSetStorage = true}, -- to ushuriel ward
        [2151] = {text = 'Entrando en las Cuevas de Cristal.', bossStorage = 200, newPos = Position(1076, 1194, 14), storage = 1}, -- from ushuriel ward
        [2152] = {text = 'Escapando de vuelta al Refugio.', newPos = Position(948, 1227, 14)}, -- from crystal caves
        [2153] = {text = 'Entrando en las Cuevas de Cristal.', newPos = Position(1076, 1194, 14), storage = 1}, -- to crystal caves
        [2154] = {text = 'Entrando en las Cuevas Hundidas.', newPos = Position(952, 1206, 11)}, -- to sunken caves
        [2155] = {text = 'Entrando al Laberinto de Espejos de la Locura.', newPos = Position(1072, 1184, 11)}, -- from sunken caves
        [2156] = {text = 'Entrando en la sala de Zugurosh.', newPos = Position(1106, 1191, 11)}, -- to zugurosh ward
        [2157] = {text = 'Entrando en los Pasillos Sangrientos.', bossStorage = 201, newPos = Position(1071, 1136, 14), storage = 2}, -- from zugurosh ward
        [2158] = {text = 'Escapando de vuelta al Refugio.', newPos = Position(948, 1227, 14)}, -- from blood halls
        [2159] = {text = 'Entrando en los Pasillos Sangrientos.', newPos = Position(1071, 1136, 14), storage = 2}, -- to blood halls
        [2160] = {text = 'Entrando en la Fundicion.', newPos = Position(1053, 1111, 11)}, -- to foundry
        [2161] = {text = 'Entrando en la sala de Madareth.', newPos = Position(1091, 1131, 11)}, -- to madareth ward
        [2162] = {text = 'Entrando en los Tanques.', bossStorage = 202, newPos = Position(867, 1205, 12), storage = 3}, -- from madareth ward
        [2163] = {text = 'Escapando de vuelta al Refugio.', newPos = Position(948, 1227, 14)}, -- from vats
        [2164] = {text = 'Entrando en los Tanques.', newPos = Position(867, 1205, 12), storage = 3}, -- to vats
        [2165] = {text = 'Entrando al Campo de Batalla.', newPos = Position(861, 1188, 11)}, -- to battlefield
        [2166] = {text = 'Entrando en los Tanques.', newPos = Position(947, 1181, 12)}, -- from battlefield
        [2167] = {text = 'Entrando en la Forja de Demonios.', newPos = Position(927, 1231, 11)}, -- to brothers ward
        [2168] = {text = 'Entrando en el Arcanum.', bossStorage = 203, newPos = Position(859, 1236, 12), storage = 4}, -- from demon forge
        [2169] = {text = 'Escapando de vuelta al Refugio.', newPos = Position(948, 1227, 14)}, -- from arcanum
        [2170] = {text = 'Entrando en el Arcanum.', newPos = Position(859, 1236, 12), storage = 4}, -- to arcanum
        [2171] = {text = 'Entrando en los Pozos de Almas.', newPos = Position(876, 1148, 13)}, -- to soul wells
        [2172] = {text = 'Entrando en el Arcanum.', newPos = Position(1007, 1242, 12)}, -- from soul wells
        [2173] = {text = 'Entrando en la sala de Annihilon.', newPos = Position(946, 1208, 13)}, -- to annihilon ward
        [2174] = {text = 'Entrando en la Colmena.', bossStorage = 204, newPos = Position(1150, 1153, 15), storage = 5}, -- from annihilon ward
        [2175] = {text = 'Escapando de vuelta al Refugio.', newPos = Position(948, 1227, 14)}, -- from hive
        [2176] = {text = 'Entrando en la Colmena.', newPos = Position(1150, 1153, 15), storage = 5}, -- to hive
        [2177] = {text = 'Entrando en la sala de Hellgorak.', newPos = Position(1106, 1135, 14)}, -- to hellgorak ward
        [2178] = {text = 'Entrando en el Nexo Sombrío. Abandonen toda esperanza.', bossStorage = 205, newPos = Position(1148, 1135, 12), storage = 6}, -- from hellgorak ward
        [2179] = {text = 'Escapando de vuelta al Refugio.', newPos = Position(948, 1227, 14)}, -- from nexo sombrio
        [2180] = {text = 'Entrando en los Pasillos Sangrientos.', newPos = Position(1056, 1112, 12)} -- from foundry to blood halls
    }
}

local creatureevent = CreatureEvent("BossEvent")

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

    local targetName = targetMonster:getName():lower()
    local bossStorage = config.bosses[targetName]
    if not bossStorage then
        return true
    end

    Game.setStorageValue(bossStorage, 2)

    if targetName == 'latrivan' or targetName == 'golgordan' then
        creature:say('Ahora tienes 3 minutos para salir de esta habitacion a traves del teletransportador. Te llevara a la siguiente habitacion.', TALKTYPE_MONSTER_SAY)
        addEvent(Game.setStorageValue, 3 * 60 * 1000, bossStorage, 0)
    end
    return true
end

creatureevent:register()


local creatureevent2 = CreatureEvent("register login")

function creatureevent2.onLogin(player)
    player:registerEvent("BossEvent")
    return true
end

creatureevent2:register()


local teleportMain = MoveEvent()

function teleportMain.onStepIn(creature, item, position, fromPosition)
    local player = creature:getPlayer()
    if not player then
        return true
    end

    local teleport = config.teleports[item.uid]
    if not teleport then
        return true
    end

    if teleport.alwaysSetStorage and player:getStorageValue(PlayerStorageKeys.TheInquisition.EnterTeleport) < teleport.storage then
        player:setStorageValue(PlayerStorageKeys.TheInquisition.EnterTeleport, teleport.storage)
    end

    if teleport.bossStorage then
        if Game.getStorageValue(teleport.bossStorage) == 2 then
            if player:getStorageValue(PlayerStorageKeys.TheInquisition.EnterTeleport) < teleport.storage then
                player:setStorageValue(PlayerStorageKeys.TheInquisition.EnterTeleport, teleport.storage)
            end
        else
            player:teleportTo(Position(948, 1227, 14))
            player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
            player:say('Escapando de vuelta al Refugio.', TALKTYPE_MONSTER_SAY)
            return true
        end
    elseif teleport.storage and player:getStorageValue(PlayerStorageKeys.TheInquisition.EnterTeleport) < teleport.storage then
        player:teleportTo(fromPosition)
        player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
        player:say('No tienes suficiente energía para entrar en este portal.', TALKTYPE_MONSTER_SAY)
        return true
    end

    player:teleportTo(teleport.newPos)
    player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
    player:say(teleport.text, TALKTYPE_MONSTER_SAY)
    return true
end

teleportMain:type("stepin")

for index, value in pairs(config.teleports) do
    teleportMain:uid(index)
end

teleportMain:register()
 
In resume. This:
Lua:
    local newValue = 2
    if targetName == 'latrivan' or targetName == 'golgordan' then
        if Game.getStorageValue(bossStorage) == nil then
            Game.setStorageValue(bossStorage, 0)
        end
        newValue = math.max(0, Game.getStorageValue(bossStorage)) + 1
    end
    Game.setStorageValue(bossStorage, newValue)

    if newValue == 2 then
        player:say('Ahora tienes 3 minutos para salir de esta habitacion a traves del teletransportador. Te llevara a la siguiente habitacion.', TALKTYPE_MONSTER_SAY)
        addEvent(Game.setStorageValue, 3 * 60 * 1000, bossStorage, 0)
    end

For this?
Lua:
    Game.setStorageValue(bossStorage, 2)

    if targetName == 'latrivan' or targetName == 'golgordan' then
        creature:say('Ahora tienes 3 minutos para salir de esta habitacion a traves del teletransportador. Te llevara a la siguiente habitacion.', TALKTYPE_MONSTER_SAY)
        addEvent(Game.setStorageValue, 3 * 60 * 1000, bossStorage, 0)
    end

Thanks everyone for the help! Regards :)

@Mateus Robeerto Sorry for bothering with this but there could be a chance that you can test it in different enviroments? such as, killing it with more than one character, triggering the other storages by going to Retreat, etc? I have also tested it before stage by stage and saw everything worked just fine. But on live enviroment I don't know if there was a factor that stopped the script from working properly (such as damage tracking, or if onKill function was applied wrongly, idk). Shouldn't be any trouble since it applies a global storage to onKill event (instead of onDeath) even if the trigger is a single player (because of onKill event nature).
 
Last edited:
It can be yes, if you don't want RevScripts... just separate; so go ahead and do it, it should work already.

Tested ^^ It does change the storage (because I was teleported to the next room after killing the bosses) but it stills trigger this to console. Also checked that it doesn't revert the globalstorage. Made me question if the system should also check for monster spawn so it gets more accurate?, so by the time that the monster dies, the new portal is opened, but if is not (monster is alive) then you go back to retreat:
1710871856794.png

Lua:
local bosses = {
    ['ushuriel'] = 200,
    ['zugurosh'] = 201,
    ['madaret'] = 202,
    ['latrivan'] = 203,
    ['golgordan'] = 203,
    ['annihilon'] = 204,
    ['gorak infernal'] = 205
}

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

    local targetName = targetMonster:getName():lower()
    local bossStorage = bosses[targetName]
    if not bossStorage then
        return true
    end

    Game.setStorageValue(bossStorage, 2)

    if targetName == 'latrivan' or targetName == 'golgordan' then
        creature:say('Ahora tienes 3 minutos para salir de esta habitacion a traves del teletransportador. Te llevara a la siguiente habitacion.', TALKTYPE_MONSTER_SAY)
        addEvent(Game.setStorageValue, 3 * 60 * 1000, bossStorage, 0)
    end
    return true
end
 
Last edited:
Tested ^^ It does change the storage (because I was teleported to the next room after killing the bosses) but it stills trigger this to console. Also checked that it doesn't revert the globalstorage. Made me question if the system should also check for monster spawn so it gets more accurate?, so by the time that the monster dies, the new portal is opened, but if is not (monster is alive) then you go back to retreat:
View attachment 83096

Lua:
local bosses = {
    ['ushuriel'] = 200,
    ['zugurosh'] = 201,
    ['madaret'] = 202,
    ['latrivan'] = 203,
    ['golgordan'] = 203,
    ['annihilon'] = 204,
    ['gorak infernal'] = 205
}

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

    local targetName = targetMonster:getName():lower()
    local bossStorage = bosses[targetName]
    if not bossStorage then
        return true
    end

    Game.setStorageValue(bossStorage, 2)

    if targetName == 'latrivan' or targetName == 'golgordan' then
        creature:say('Ahora tienes 3 minutos para salir de esta habitacion a traves del teletransportador. Te llevara a la siguiente habitacion.', TALKTYPE_MONSTER_SAY)
        addEvent(Game.setStorageValue, 3 * 60 * 1000, bossStorage, 0)
    end
    return true
end
Just change it to target:say
Although... I assume the creature will still "say" things even though it's dead, but if it doesn't work, change it to player:say instead
(tbh, it all depends on where you want to see the text... Above the corpse? Above the killer?
 
Last edited:
change to

Is it correct to use 'creature' because the monster will speak with a 'voice' when killed, and the speaker understands?
The server sends the creature userdata to the LuaInterface, so you can call it whatever you like
For example, look at the following code:
Lua:
--all three functions do the same thing
function onKill(creature, target)
    target:say(creature:getName() ... "killed me :(")
    return true
end

function onKill(param1, param2)
    param2:say(param1:getName() ... "killed me :(")
    return true
end

function onKill(murderer, victim)
    victim:say(murderer:getName() ... "killed me :(")
    return true
end

Also keep in mind that for onKill, both creature and target are both Creature() userdata.
Lua:
LuaScriptInterface::pushUserdata<Creature>(L, creature);
LuaScriptInterface::setCreatureMetatable(L, -1, creature);
LuaScriptInterface::pushUserdata<Creature>(L, target);
LuaScriptInterface::setCreatureMetatable(L, -1, target);

And in terms of userdata, both Player() and Monster() extend the Creature() class, which means that any method from the Creature() class can be called on Player() and Monster() via inheritance, but a method from either Player() or Monster() to the other will throw an error.
 
Last edited:
Back
Top