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

RoyalYeta

New Member
Joined
Sep 28, 2018
Messages
26
Reaction score
2
Hello, I have this error, say someone?

Lua Script Error: [GlobalEvent Interface]
data/globalevents/scripts/bosses/Tanjis.lua:eek:nTime
data/globalevents/scripts/bosses/Tanjis.lua:31: attempt to index local 'monster2' (a nil value)
stack traceback:
[C]: in function '__index'
data/globalevents/scripts/bosses/Tanjis.lua:31: in function <data/globalevents/scripts/bosses/Tanjis.lua:8>


Lua:
local BOSSoo = "Tanjis" -- boss name
local BOSS_POSoo = {x = 33647, y = 31242, z = 11} -- boss spawn coord
local roomoo = {fromx = 33632, tox = 33659, fromy = 31231, toy = 31256, z = 11} -- boss room
local BOSS_GLOBAL_STORAGEoo = 80511 -- dont change
local BOSS_GLOBAL_STORAGE_SUMMONoo = 25002 -- dont change
local TEMPO_RESPoo = 10 * 60 -- em segundos -- respawn time

function onTime()
--function onThink(interval, lastExecution)

local bossoo = 0
for x = roomoo.fromx, roomoo.tox do
for y = roomoo.fromy, roomoo.toy do
for z = roomoo.z, roomoo.z do

creatureoo = {x = x, y = y, z = z}
moboo = getTopCreature(creatureoo).uid

    if getCreatureName(moboo) == BOSSoo then
        bossoo = 1
    end
end
end
end

if bossoo == 1 then
end

if bossoo == 0 then
  local monster2 = Game.createMonster("Tanjis", Position(33647, 31242, 11))
monster2:setReward(true)
end

return true
end
 
the monster could not be created because either the position is invalid or there's something in the way on that tile that prevents the monster from spawning
 
If you are sure the position is valid, you can always force the summon:
Code:
Game.createMonster("Tanjis", Position(33647, 31242, 11), false, true)
 
Optimization for your TFS 1.3, if have errors only show me !
Lua:
local config = {
    monsterName = 'Tanjis',
    bossPosition = Position(33647, 31242, 11),
    centerPosition = Position(33632, 31231, 11),
    rangeX = 10,
    rangeY = 10
}

local function checkBoss(centerPosition, rangeX, rangeY, bossName)
    local spectators, spec = Game.getSpectators(centerPosition, false, false, rangeX, rangeX, rangeY, rangeY)
    for i = 1, #spectators do
        spec = spectators[i]
        if spec:isMonster() then
            if spec:getName() == bossName then
                return true
            end
        end
    end
    return false
end

function onTime()
    if checkBoss(config.centerPosition, config.rangeX, config.rangeY, config.monsterName) then
        print('The boss is in the room.')
        return false
    end

    local boss = Game.createMonster(config.monsterName, config.bossPosition, false, true)
    boss:setReward(true)
    return true
end
 
i have next error
Lua:
local BOSS_GLOBAL_STORAGE = 80510 -- to differentiate one from another boss
local TEMPO_SALA = 1 * 60 -- time to be kicked from the room (20 minutes)
local TEMPO_QUEST = 24 * 60 * 60 -- time to enter again on the boss room after killing one (24hours)
local STORAGE_TEMPO_ESPERAR = 22001 -- storage to count 24 hours
local BOSS = "Obujos" -- boss name
local room = {fromx = 33416, tox = 33446, fromy = 31254, toy = 31275, z = 11} -- area boss room
local PLAYER_OUT = {x = 33438, y = 31249, z = 11} -- where will be kicked
local UID_TELEPORT = 8001 -- uid of entrance teleport

function onKill(cid, target)
    if getCreatureName(target) == BOSS then
        setPlayerStorageValue(cid, STORAGE_TEMPO_ESPERAR, os.time() + TEMPO_QUEST)
        doSetItemActionId(UID_TELEPORT, 8001)
        if(getGlobalStorageValue(BOSS_GLOBAL_STORAGE + 1000) < 1) then
            setGlobalStorageValue(BOSS_GLOBAL_STORAGE + 1000, 1)
            addEvent(removePlayerJaul, TEMPO_SALA * 1000)
        end
    end
    return true
end

-- REMOVE O JOGADOR SE EXCEDER O TEMPO
function removePlayerJaul()

for x = room.fromx, room.tox do
for y = room.fromy, room.toy do
for z = room.z, room.z do

creature = {x = x, y = y, z = z}
mob = getTopCreature(creature).uid

if isPlayer(mob) then
    doTeleportThing(mob, PLAYER_OUT)
    doSendMagicEffect(PLAYER_OUT, CONST_ME_TELEPORT)
end
addEvent(storageObujosDelay, 1000)
end
end
end
return TRUE
end

-- VOLTA O STORAGE AO NORMAL
function storageObujosDelay()
    setGlobalStorageValue(BOSS_GLOBAL_STORAGE + 1000, -1)
    doSetItemActionId(UID_TELEPORT, 8000)
end
can I enjoy the scheme in the post above and it will be okay? :)
 
Back
Top