Hello ! I have a strange problem with my code. I want to enable my custom entitiy "light" after a timer, it works but I have an error message in the consol... I really don't understand what this is about
Here's the code :
And here's the error message :
I know how to read error message but I don't understand why this happen only with my custom entity.. No probleme with the door:set_enabled(false)
Thank you
Here's the code :
Code Select
local map = ...
local game = map:get_game()
-- Explode the door and Kimos enter the room
local function animation()
sol.timer.start(4000, function()
map:create_explosion({
name = "ex",
layer = 2,
x = 160,
y = 208})
sol.audio.play_sound("explosion")
light_door:set_enabled(true)
door:set_enabled(false)
end)
end
-- Event called at initialization time, as soon as this map is loaded.
function map:on_started()
game:set_value("dark_room",true)
light_door:set_enabled(false)
game:set_hud_enabled(false)
game:set_pause_allowed(false)
hero:set_visible(false)
animation()
end
And here's the error message :
Code Select
Error: In on_enabled: scripts/multi_events.lua:41: attempt to call upvalue 'callback' (a boolean value)
stack traceback:
[C]: in function 'callback'
scripts/multi_events.lua:41: in function 'previous_callbacks'
scripts/multi_events.lua:41: in function <scripts/multi_events.lua:40>
[C]: in function 'set_enabled'
maps/cutscenes/intro_1.lua:14: in function <maps/cutscenes/intro_1.lua:7>
I know how to read error message but I don't understand why this happen only with my custom entity.. No probleme with the door:set_enabled(false)
Thank you