EDIT:
THIS IS USEFUL INFORMATION, shame I have no idea how to implement it because Lua is a brick wall to me.
Code:
--[[ USAGE GUIDE
Edit bosslist to have the object types of every boss you need to delay execution of. These bosses will be
frozen on load. To unfreeze, run a Linedef Executor - Call Lua Function (LD443) with "BOSSINIT" in the upper
texture and blank textures in middle and lower. The tag of this linedef is the index of the boss on the
bosstype table to init. Indices of the current list are given in comments, but if you alter the list, these
values may change.
]]
local bosslist = {
MT_EGGMOBILE2, -- 1
MT_EGGMOBILE3, -- 2
MT_EGGMOBILE4, -- 3
MT_BLACKEGGMAN, -- 4
MT_CYBRAKDEMON, -- 5
MT_METALSONIC_BATTLE -- 6
}
local idlebosses = {}
local function idlizeBoss(thingtypes)
if type(thingtypes) ~= "table" then
thingtypes = {thingtypes}
end
for mo in thinkers.iterate("mobj") do
for _,v in ipairs(thingtypes) do
if mo.type == v then
idlebosses[v] = mo
mo.flags = $1|MF_NOTHINK
end
end
end
end
local function unidleBoss(thingtypes)
if type(thingtypes) ~= "table" then
thingtypes = {thingtypes}
end
for _,v in ipairs(thingtypes) do
if idlebosses[v] then
idlebosses[v].flags = $1 & ~MF_NOTHINK
idlebosses[v] = nil
end
end
end
addHook("MapLoad", do
idlizeBoss(bosslist)
end)
addHook("LinedefExecute", function(line)
local tag = line.tag
if bosslist[tag] then
unidleBoss(bosslist[tag])
end
end, "BOSSINIT")
Last edited: