Hi,
I want the chest to stay activated when I hit the switch, even if it hasn't opened. So when I leave the map and return, the chest remains visible and the switch has already been activated.
I tried this, but without success.
The reference is the lesson 17 on YT.
here´s the code, first_map.lua
function map:on_started()
if bau_tunica:is_open() then --"BAU_TUNICA" IS THE CHEST
bau_tunica:set_enabled(true)
interruptor_a:set_activated(true) --"INTERRUPTOR_A" IS THE SWITCH
elseif interruptor_a:is_activated() then --this is my attempt
bau_tunica:set_enabled(true)
end
end
function fogo:on_interaction()
game:start_dialog("salvar_jogo-perguntar", function(resposta)
if resposta==1 then
game:save()
game:start_dialog("jogo_salvo")
end
end)
end
function interruptor_a:on_activated()
sol.audio.play_sound("cursor")
bau_tunica:set_enabled(true)
end