• 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+ Force monster spawn on occupied tile

peteralto

Member
Joined
Nov 1, 2020
Messages
95
Solutions
1
Reaction score
19
If there is something occupying the tile, the script does not create the monster forcibly and the script stop working. Is there anything that can be done to force the spawn?
Lua:
local bossInfo = {
    name = "Demon",
    position = Position(31546, 30324, 9)
}

local function createBoss()
    local boss = Game.createMonster(bossInfo.name, bossInfo.position)
    if not boss then
        error(string.format("Error while spawning %s.", bossInfo.name))
    end
end

I already tried to change this:
Lua:
local boss = Game.createMonster(bossInfo.name, bossInfo.position)
to this:
Lua:
local boss = Game.createMonster(bossInfo.name, bossInfo.position, true, true)
but the error still occurs.

TFS 1.3 Downgrade
 
You need to check src/luascript.cpp and search for the "createMonster" method in the game class. Make sure it has extended and force as parameter options. Like it does here: (https://github.com/otland/forgottenserver/blob/master/src/luascript.cpp#L5004)

If the options do exist, try and pass force only (You may have to dive deeper into g_game.placeCreature to see what takes priority):
Lua:
local boss = Game.createMonster(bossInfo.name, bossInfo.position, false, true)
(Obviously double check the position too, just incase xD)

If the options exist in the sources, and the position is good, then it seems to be a source issue.
 
Last edited:
Back
Top