yeah ive got prints for when the map starts to tell me the values, it says 8 for example if i go in and out the map but back to 0 if the game is reloaded...the game is saved but the value of win isnt. I have no idea how to save it is the problem. the lines "game:save(win)" were added after i read this but still didnt save the value...but the print said it did.
Heres the full code, the part which needs win saving is seperated below aswell.
function fisherman:on_interaction()
hero:set_animation("stopped")
if size == nil then
size = 0
else
end
if fisherman_talk == nil then
fisherman_talk = 0
else
end
if win == nil then
win = 0
else
end
game:set_hud_enabled(false)
game:set_pause_allowed(false)
if game_is_active then print("game_is_active", game_is_active) ------------------ if the game is active
print(size)
game:start_dialog("fisherman.young.talk", function(answer)
if answer == 1 then -- weigh fish
if game:get_value("hylia_fish_young") then print("hylia_fish_young", hylia_fish_young)
if size == 0 then
game:start_dialog("fisherman.young.talk.weight.no_fish", function()
game:set_hud_enabled(true)
game:set_pause_allowed(true)
end)
elseif size > 0 and size < win then
game:start_dialog("fisherman.young.talk.weight.small", size, function()
game:set_hud_enabled(true)
game:set_pause_allowed(true)
end)
else
game:start_dialog("fisherman.young.talk.weight.woah", size, function()
if size > win then
game:set_hud_enabled(true)
game:set_pause_allowed(true)
win = size print(win, "=", scale)
game:save(win) print("save win", win)
local win = size print("local", win, "=", scale)
sol.timer.start(01, function()
size = 0
end)
else
game:set_hud_enabled(true)
game:set_pause_allowed(true)
end
end)
end
elseif size == 0 then print("size", size, "win", win)
game:start_dialog("fisherman.young.talk.weight.no_fish", function()
game:set_hud_enabled(true)
game:set_pause_allowed(true)
end)
elseif size > 0 and size < 6 then
game:start_dialog("fisherman.young.talk.weight.small", size, function()
game:set_hud_enabled(true)
game:set_pause_allowed(true)
end)
else
game:start_dialog("fisherman.young.talk.weight.woah", size, function()
win = size print(win, "=", scale)
game:save(win) print("save win", win)
local win = size print("local", win, "=", scale)
sol.timer.start(01, function()
sol.audio.play_sound("oot/fanfare/item")
hero:start_treasure("heart_piece", 1)
game:set_value("hylia_fish_young", true)
size = 0
game:set_hud_enabled(true)
game:set_pause_allowed(true)
end)
end)
end
else -- other
game:start_dialog("fisherman.young.talk.other", function(answer)
if answer == 1 then -- talk to fisherman
if fisherman_talk == 0 then print(fisherman_talk)
fisherman_talk = 1 print(fisherman_talk)
game:start_dialog("fisherman.young.talk.talk1", function()
game:set_hud_enabled(true)
game:set_pause_allowed(true)
end)
elseif fisherman_talk == 1 then
fisherman_talk = 2 print(fisherman_talk)
game:start_dialog("fisherman.young.talk.talk2", function()
game:set_hud_enabled(true)
game:set_pause_allowed(true)
end)
elseif fisherman_talk == 2 then
fisherman_talk = 0 print(fisherman_talk)
game:start_dialog("fisherman.young.talk.talk3", function()
game:set_hud_enabled(true)
game:set_pause_allowed(true)
end)
end
else -- exit fishing "game"
game:set_hud_enabled(true)
game:set_pause_allowed(true)
game_is_active = false
end
end)
end
end)
else print("game_is_active", game_is_active) ------------------ if the game is NOT active
game:start_dialog("fisherman.young.open", function(answer)
if answer == 1 then -- Yes would like to play
if game:get_money() < 20 then
game:start_dialog("_shop.not_enough_money", function()
game:set_hud_enabled(true)
game:set_pause_allowed(true)
end)
else
game:remove_money(20)
phase_1()
end
else -- No wouldn't like to play
game:start_dialog("fisherman.young.open.no", function()
game:set_hud_enabled(true)
game:set_pause_allowed(true)
end)
end
end)
end
end
more specifically this part, this is the "winning" function.
else
game:start_dialog("fisherman.young.talk.weight.woah", size, function()
win = size print(win, "=", size)
game:save(win) print("save win", win)
local win = size print("local", win, "=", size)
sol.timer.start(01, function()
sol.audio.play_sound("oot/fanfare/item")
hero:start_treasure("heart_piece", 1)
game:set_value("hylia_fish_young", true)
size = 0
game:set_hud_enabled(true)
game:set_pause_allowed(true)
end)
end)
end