Rewrite callbacks from scripts

This commit is contained in:
Vladislav Khorev 2026-07-10 13:24:23 +03:00
parent 2d3aa22521
commit 17d903fd52
3 changed files with 563 additions and 552 deletions

View File

@ -26,7 +26,6 @@ function on_npc_interact(npc_index)
game_api.start_dialogue("dialog_alik001") game_api.start_dialogue("dialog_alik001")
end]] end]]
game_api.start_dialogue("dialog_alik002") game_api.start_dialogue("dialog_alik002")
end end
end end
@ -106,15 +105,33 @@ function on_alik_door_click()
end end
end end
function callback_deactivate_cover_alik_room()
game_api.deactivate_interactive_object("Room_Cover_LivingRoom_W_S_2_001")
game_api.set_npc_enabled(0, true)
game_api.npc_rotate_to(0, 90)
end
function callback_deactivate_cover_bathroom()
game_api.deactivate_interactive_object("Room_Cover_Bath_W_N_2_001")
end
function callback_deactivate_cover_main_hall()
game_api.deactivate_interactive_object("Room_Cover_Main_Hall_And_Corridors_002")
end
function callback_deactivate_cover_utility_room_n()
game_api.deactivate_interactive_object("Room_Cover_Utility_W_N_3_001")
end
function callback_deactivate_cover_utility_room_s()
game_api.deactivate_interactive_object("Room_Cover_Utility_W_S_3_001")
end
function alik_door_open_callback() function alik_door_open_callback()
if (alik_door_opened == false) then if (alik_door_opened == false) then
alik_door_opened = true alik_door_opened = true
game_api.rotate_object("Door_Room_-1_-1_1_Leaf_001", -90, 0.5, nil) game_api.rotate_object("Door_Room_-1_-1_1_Leaf_001", -90, 0.5, nil)
game_api.fade_object("Room_Cover_LivingRoom_W_S_2_001", 0, 0.5, function() game_api.fade_object("Room_Cover_LivingRoom_W_S_2_001", 0, 0.5, callback_deactivate_cover_alik_room)
game_api.deactivate_interactive_object("Room_Cover_LivingRoom_W_S_2_001")
game_api.set_npc_enabled(0, true)
game_api.npc_rotate_to(0, 90)
end)
if (bathroom_door_opened) then if (bathroom_door_opened) then
game_api.switch_navigation(5) -- all open game_api.switch_navigation(5) -- all open
@ -147,9 +164,7 @@ function on_player_bathroom_click()
game_api.start_dialogue("door_bathroom_dialog001") game_api.start_dialogue("door_bathroom_dialog001")
game_api.rotate_object("Door_Bath_-1_1_1_Leaf_002", -90, 0.5, nil) game_api.rotate_object("Door_Bath_-1_1_1_Leaf_002", -90, 0.5, nil)
game_api.fade_object("Room_Cover_Bath_W_N_2_001", 0, 0.5, function() game_api.fade_object("Room_Cover_Bath_W_N_2_001", 0, 0.5, callback_deactivate_cover_bathroom)
game_api.deactivate_interactive_object("Room_Cover_Bath_W_N_2_001")
end)
if (player_door_opened) then if (player_door_opened) then
@ -175,18 +190,12 @@ function on_player_door_click()
game_api.player_stop() game_api.player_stop()
game_api.rotate_object("Door_Room_-1_1_1_Leaf_001", 90, 0.25, nil) game_api.rotate_object("Door_Room_-1_1_1_Leaf_001", 90, 0.25, nil)
game_api.fade_object("Room_Cover_Main_Hall_And_Corridors_002", 0, 0.5, function() game_api.fade_object("Room_Cover_Main_Hall_And_Corridors_002", 0, 0.5, callback_deactivate_cover_main_hall)
game_api.deactivate_interactive_object("Room_Cover_Main_Hall_And_Corridors_002")
end)
game_api.fade_object("Room_Cover_Utility_W_N_3_001", 0, 0.5, function() game_api.fade_object("Room_Cover_Utility_W_N_3_001", 0, 0.5, callback_deactivate_cover_utility_room_n)
game_api.deactivate_interactive_object("Room_Cover_Utility_W_N_3_001")
end)
game_api.fade_object("Room_Cover_Utility_W_S_3_001", 0, 0.5, function() game_api.fade_object("Room_Cover_Utility_W_S_3_001", 0, 0.5, callback_deactivate_cover_utility_room_s)
game_api.deactivate_interactive_object("Room_Cover_Utility_W_S_3_001")
end)
if (bathroom_door_opened) then if (bathroom_door_opened) then
game_api.switch_navigation(3) --a game_api.switch_navigation(3) --a
@ -195,19 +204,19 @@ function on_player_door_click()
end end
game_api.play_sound("audio/702171__foxfire__door-opening.ogg") game_api.play_sound("audio/702171__foxfire__door-opening.ogg")
end end
end end
end end
game_api.set_enter_night_callback( function callback_enter_night()
function()
game_api.start_dialogue("dialog_video001") game_api.start_dialogue("dialog_video001")
closeAlikDoor() closeAlikDoor()
end end
game_api.set_enter_night_callback(
callback_enter_night
) )
game_api.set_chat_callbacks( function callback_aiperi_chat()
function()
if (not game_api.is_night()) and (not game_api.is_dawn()) then if (not game_api.is_night()) and (not game_api.is_dawn()) then
local aiperi_chat_opened = game_api.getIntValue("aiperi_chat_opened") local aiperi_chat_opened = game_api.getIntValue("aiperi_chat_opened")
@ -231,21 +240,28 @@ game_api.set_chat_callbacks(
end end
end end
end end
end, end
function()
function callback_parents_chat()
local parents_chat_opened = game_api.getIntValue("parents_chat_opened") local parents_chat_opened = game_api.getIntValue("parents_chat_opened")
if parents_chat_opened == 0 then if parents_chat_opened == 0 then
game_api.setIntValue("parents_chat_opened", 1) game_api.setIntValue("parents_chat_opened", 1)
game_api.start_dialogue("dialog_chat_parents001") game_api.start_dialogue("dialog_chat_parents001")
end end
end, end
function()
function callback_news_chat()
local news_chat_opened = game_api.getIntValue("news_chat_opened") local news_chat_opened = game_api.getIntValue("news_chat_opened")
if news_chat_opened == 0 then if news_chat_opened == 0 then
game_api.setIntValue("news_chat_opened", 1) game_api.setIntValue("news_chat_opened", 1)
game_api.start_dialogue("dialog_chat_news001") game_api.start_dialogue("dialog_chat_news001")
end end
end end
game_api.set_chat_callbacks(
callback_aiperi_chat,
callback_parents_chat,
callback_news_chat
) )
function on_aiperi_dialog_over() function on_aiperi_dialog_over()
@ -288,9 +304,7 @@ function on_toilet_click()
game_api.start_dialogue("dialog_toilet001") game_api.start_dialogue("dialog_toilet001")
end end
function callback_enter_location()
game_api.set_location_callbacks(
function()
print("Enter location dorm") print("Enter location dorm")
local hp = game_api.getFloatValue("player_hp") local hp = game_api.getFloatValue("player_hp")
game_api.set_player_hp(hp) game_api.set_player_hp(hp)
@ -298,24 +312,31 @@ game_api.set_location_callbacks(
if (game_api.is_night()) then if (game_api.is_night()) then
closeAlikDoor() closeAlikDoor()
end end
end, end
function()
function callback_exit_location()
print("Exit location dorm") print("Exit location dorm")
local hp = game_api.get_player_hp() local hp = game_api.get_player_hp()
game_api.setFloatValue("player_hp", hp) game_api.setFloatValue("player_hp", hp)
end end
game_api.set_location_callbacks(
callback_enter_location,
callback_exit_location
) )
function callback_call_taxi()
game_api.set_teleport_active(0, true)
game_api.set_trigger_zone_enabled(0, false)
end
game_api.deactivate_interactive_object("Room_Cover_LivingRoom_W_N_2_001") game_api.deactivate_interactive_object("Room_Cover_LivingRoom_W_N_2_001")
game_api.rotate_object("Door_Utility_-1_1_2_Leaf_001", 90, 0.01, nil) game_api.rotate_object("Door_Utility_-1_1_2_Leaf_001", 90, 0.01, nil)
game_api.rotate_object("Door_Utility_-1_-1_2_Leaf_001", -90, 0.01, nil) game_api.rotate_object("Door_Utility_-1_-1_2_Leaf_001", -90, 0.01, nil)
game_api.set_call_taxi_callback( game_api.set_call_taxi_callback(
function() callback_call_taxi
game_api.set_teleport_active(0, true)
game_api.set_trigger_zone_enabled(0, false)
end
) )

View File

@ -1,15 +1,14 @@
print("Lua script loaded successfully!") print("Lua script loaded successfully!")
function callback_enter_location()
end
function callback_exit_location()
end
game_api.set_location_callbacks( game_api.set_location_callbacks(
function() callback_enter_location,
-- player just arrived here callback_exit_location
if game_api.is_darklands() then
-- arrived while in darklands mode
end
end,
function()
-- player is about to leave
end
) )
function darklands_exit001_enter_callback() function darklands_exit001_enter_callback()
@ -42,38 +41,40 @@ function dialog_contaier002_get_coursework()
game_api.quest_set_objective_completed("ghost_coursework", "ghost_coursework_find") game_api.quest_set_objective_completed("ghost_coursework", "ghost_coursework_find")
end end
game_api.set_enter_night_callback( function callback_enter_night()
function()
game_api.start_dialogue("dialog_video001") game_api.start_dialogue("dialog_video001")
end end
game_api.set_enter_night_callback(
callback_enter_night
) )
function on_darklands_over()
game_api.set_player_hp(10)
end
game_api.set_darklands_callbacks( function callback_exit_darklands()
nil,
function()
game_api.start_cutscene("darklands_exit001") game_api.start_cutscene("darklands_exit001")
print("Setting to day 1----") print("Setting to day 1----")
game_api.setIntValue("day", 1) game_api.setIntValue("day", 1)
game_api.set_dawn() game_api.set_dawn()
game_api.setIntValue("morning_player_can_leave", 1) game_api.setIntValue("morning_player_can_leave", 1)
end end
game_api.set_darklands_callbacks(
nil,
callback_exit_darklands
) )
game_api.set_enter_night_callback( function callback_enter_night()
function()
game_api.deactivate_interactive_object("car001") game_api.deactivate_interactive_object("car001")
game_api.deactivate_interactive_object("car001wheels") game_api.deactivate_interactive_object("car001wheels")
game_api.switch_navigation(1) game_api.switch_navigation(1)
end end
game_api.set_enter_night_callback(
callback_enter_night
) )
game_api.set_location_callbacks( function callback_enter_location()
function()
print("Enter location uni exterior") print("Enter location uni exterior")
local hp = game_api.getFloatValue("player_hp") local hp = game_api.getFloatValue("player_hp")
game_api.set_player_hp(hp) game_api.set_player_hp(hp)
@ -87,12 +88,17 @@ game_api.set_location_callbacks(
game_api.activate_interactive_object("car001wheels") game_api.activate_interactive_object("car001wheels")
game_api.switch_navigation(0) game_api.switch_navigation(0)
end end
end, end
function()
function callback_exit_location()
print("Exit location uni exterior") print("Exit location uni exterior")
local hp = game_api.get_player_hp() local hp = game_api.get_player_hp()
game_api.setFloatValue("player_hp", hp) game_api.setFloatValue("player_hp", hp)
end end
game_api.set_location_callbacks(
callback_enter_location,
callback_exit_location
) )
game_api.set_trigger_zone_callbacks("darklands_exit001", game_api.set_trigger_zone_callbacks("darklands_exit001",
@ -123,11 +129,13 @@ function taxi_zone001_enter_callback()
game_api.set_trigger_zone_enabled(0, false) game_api.set_trigger_zone_enabled(0, false)
end end
game_api.set_call_taxi_callback( function callback_call_taxi()
function()
game_api.set_teleport_active(0, true) game_api.set_teleport_active(0, true)
game_api.set_trigger_zone_enabled(0, false) game_api.set_trigger_zone_enabled(0, false)
end end
game_api.set_call_taxi_callback(
callback_call_taxi
) )
@ -136,8 +144,7 @@ game_api.set_trigger_zone_callbacks("taxi_zone001",
nil nil
) )
game_api.set_chat_callbacks( function callback_aiperi_chat()
function()
if (not game_api.is_night()) and (not game_api.is_dawn()) then if (not game_api.is_night()) and (not game_api.is_dawn()) then
local aiperi_chat_opened = game_api.getIntValue("aiperi_chat_opened") local aiperi_chat_opened = game_api.getIntValue("aiperi_chat_opened")
@ -161,19 +168,26 @@ game_api.set_chat_callbacks(
end end
end end
end end
end, end
function()
function callback_parents_chat()
local parents_chat_opened = game_api.getIntValue("parents_chat_opened") local parents_chat_opened = game_api.getIntValue("parents_chat_opened")
if parents_chat_opened == 0 then if parents_chat_opened == 0 then
game_api.setIntValue("parents_chat_opened", 1) game_api.setIntValue("parents_chat_opened", 1)
game_api.start_dialogue("dialog_chat_parents001") game_api.start_dialogue("dialog_chat_parents001")
end end
end, end
function()
function callback_news_chat()
local news_chat_opened = game_api.getIntValue("news_chat_opened") local news_chat_opened = game_api.getIntValue("news_chat_opened")
if news_chat_opened == 0 then if news_chat_opened == 0 then
game_api.setIntValue("news_chat_opened", 1) game_api.setIntValue("news_chat_opened", 1)
game_api.start_dialogue("dialog_chat_news001") game_api.start_dialogue("dialog_chat_news001")
end end
end end
game_api.set_chat_callbacks(
callback_aiperi_chat,
callback_parents_chat,
callback_news_chat
) )

View File

@ -216,7 +216,6 @@ function on_cake_clicked()
game_api.start_dialogue("cake_dialog001") game_api.start_dialogue("cake_dialog001")
end end
function on_npc_interact(npc_index) function on_npc_interact(npc_index)
local player_ghost_aware = game_api.getIntValue("ghost_aware") local player_ghost_aware = game_api.getIntValue("ghost_aware")
local player_hold_key = game_api.getIntValue("player_hold_key") local player_hold_key = game_api.getIntValue("player_hold_key")
@ -235,7 +234,6 @@ function on_npc_interact(npc_index)
end end
end end
if npc_index == 0 then if npc_index == 0 then
if (day == 0) then if (day == 0) then
if (teacher_told_about_book) then if (teacher_told_about_book) then
game_api.start_dialogue("teacher_dialog006") game_api.start_dialogue("teacher_dialog006")
@ -334,6 +332,26 @@ function on_library_door_click()
print("Library door step 5") print("Library door step 5")
end end
function callback_deactivate_cover_s3()
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
end
function callback_deactivate_cover_n3()
game_api.deactivate_interactive_object("Room_Cover_North_3_001")
end
function callback_deactivate_cover_corridor()
game_api.deactivate_interactive_object("Room_Cover_Corridor_001")
end
function callback_deactivate_cover_main_hall()
game_api.deactivate_interactive_object("Room_Cover_Main_Hall_001")
end
--Room_Cover_North_3_001
--Room_Cover_Main_Hall_001
function on_teachers_door_click() function on_teachers_door_click()
print("on_teachers_door_click---") print("on_teachers_door_click---")
@ -348,9 +366,7 @@ function on_teachers_door_click()
if (not teacher_door_opened) then if (not teacher_door_opened) then
teacher_door_opened = true teacher_door_opened = true
game_api.rotate_object("Room_S_2_Leaf001", 90, 0.5, nil) game_api.rotate_object("Room_S_2_Leaf001", 90, 0.5, nil)
game_api.fade_object("Room_Cover_South_3_001", 0, 0.5, function() game_api.fade_object("Room_Cover_South_3_001", 0, 0.5, callback_deactivate_cover_s3)
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
end)
game_api.switch_navigation(3) game_api.switch_navigation(3)
game_api.play_sound("audio/702171__foxfire__door-opening.ogg") game_api.play_sound("audio/702171__foxfire__door-opening.ogg")
end end
@ -368,9 +384,7 @@ function on_teachers_door_click()
if (morning_can_open_door_index == 3) then if (morning_can_open_door_index == 3) then
morning_did_open_door_index = 3 morning_did_open_door_index = 3
game_api.rotate_object("Room_S_2_Leaf001", 90, 0.5, nil) game_api.rotate_object("Room_S_2_Leaf001", 90, 0.5, nil)
game_api.fade_object("Room_Cover_Corridor_001", 0, 0.5, function() game_api.fade_object("Room_Cover_Corridor_001", 0, 0.5, callback_deactivate_cover_corridor)
game_api.deactivate_interactive_object("Room_Cover_Corridor_001")
end)
game_api.switch_navigation(10) game_api.switch_navigation(10)
game_api.play_sound("audio/702171__foxfire__door-opening.ogg") game_api.play_sound("audio/702171__foxfire__door-opening.ogg")
else else
@ -378,54 +392,42 @@ function on_teachers_door_click()
--s1 + s3 --s1 + s3
game_api.rotate_object("Room_S_2_Leaf001", 90, 0.5, nil) game_api.rotate_object("Room_S_2_Leaf001", 90, 0.5, nil)
game_api.fade_object("Room_Cover_South_3_001", 0, 0.5, function() game_api.fade_object("Room_Cover_South_3_001", 0, 0.5, callback_deactivate_cover_s3)
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
end)
game_api.switch_navigation(11) game_api.switch_navigation(11)
game_api.play_sound("audio/702171__foxfire__door-opening.ogg") game_api.play_sound("audio/702171__foxfire__door-opening.ogg")
elseif (morning_did_open_door_index == 2) then elseif (morning_did_open_door_index == 2) then
--s2 + s3 --s2 + s3
game_api.rotate_object("Room_S_2_Leaf001", 90, 0.5, nil) game_api.rotate_object("Room_S_2_Leaf001", 90, 0.5, nil)
game_api.fade_object("Room_Cover_South_3_001", 0, 0.5, function() game_api.fade_object("Room_Cover_South_3_001", 0, 0.5, callback_deactivate_cover_s3)
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
end)
game_api.switch_navigation(15) game_api.switch_navigation(15)
game_api.play_sound("audio/702171__foxfire__door-opening.ogg") game_api.play_sound("audio/702171__foxfire__door-opening.ogg")
elseif (morning_did_open_door_index == 5) then elseif (morning_did_open_door_index == 5) then
--n3 + s3 --n3 + s3
game_api.rotate_object("Room_S_2_Leaf001", 90, 0.5, nil) game_api.rotate_object("Room_S_2_Leaf001", 90, 0.5, nil)
game_api.fade_object("Room_Cover_South_3_001", 0, 0.5, function() game_api.fade_object("Room_Cover_South_3_001", 0, 0.5, callback_deactivate_cover_s3)
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
end)
game_api.switch_navigation(13) game_api.switch_navigation(13)
game_api.play_sound("audio/702171__foxfire__door-opening.ogg") game_api.play_sound("audio/702171__foxfire__door-opening.ogg")
elseif (morning_did_open_door_index == 4) then elseif (morning_did_open_door_index == 4) then
--n2 + s3 --n2 + s3
game_api.rotate_object("Room_S_2_Leaf001", 90, 0.5, nil) game_api.rotate_object("Room_S_2_Leaf001", 90, 0.5, nil)
game_api.fade_object("Room_Cover_South_3_001", 0, 0.5, function() game_api.fade_object("Room_Cover_South_3_001", 0, 0.5, callback_deactivate_cover_s3)
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
end)
game_api.switch_navigation(14) game_api.switch_navigation(14)
game_api.play_sound("audio/702171__foxfire__door-opening.ogg") game_api.play_sound("audio/702171__foxfire__door-opening.ogg")
elseif (morning_did_open_door_index == 6) then elseif (morning_did_open_door_index == 6) then
--hall + s3 --hall + s3
game_api.rotate_object("Room_S_2_Leaf001", 90, 0.5, nil) game_api.rotate_object("Room_S_2_Leaf001", 90, 0.5, nil)
game_api.fade_object("Room_Cover_South_3_001", 0, 0.5, function() game_api.fade_object("Room_Cover_South_3_001", 0, 0.5, callback_deactivate_cover_s3)
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
end)
game_api.switch_navigation(12) game_api.switch_navigation(12)
game_api.play_sound("audio/702171__foxfire__door-opening.ogg") game_api.play_sound("audio/702171__foxfire__door-opening.ogg")
else else
--Player was in corridor, but tries to open the teacher's door --Player was in corridor, but tries to open the teacher's door
--s3 only --s3 only
game_api.rotate_object("Room_S_2_Leaf001", 90, 0.5, nil) game_api.rotate_object("Room_S_2_Leaf001", 90, 0.5, nil)
game_api.fade_object("Room_Cover_South_3_001", 0, 0.5, function() game_api.fade_object("Room_Cover_South_3_001", 0, 0.5, callback_deactivate_cover_s3)
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
end)
game_api.switch_navigation(10) game_api.switch_navigation(10)
game_api.play_sound("audio/702171__foxfire__door-opening.ogg") game_api.play_sound("audio/702171__foxfire__door-opening.ogg")
end end
@ -438,14 +440,10 @@ function on_teachers_door_click()
if (morning_can_open_door_index == 3) then if (morning_can_open_door_index == 3) then
morning_did_open_door_index = 3 morning_did_open_door_index = 3
game_api.rotate_object("Room_S_2_Leaf001", 90, 0.5, nil) game_api.rotate_object("Room_S_2_Leaf001", 90, 0.5, nil)
game_api.fade_object("Room_Cover_Corridor_001", 0, 0.5, function() game_api.fade_object("Room_Cover_Corridor_001", 0, 0.5, callback_deactivate_cover_corridor)
game_api.deactivate_interactive_object("Room_Cover_Corridor_001")
end)
else else
game_api.rotate_object("Room_S_2_Leaf001", 90, 0.5, nil) game_api.rotate_object("Room_S_2_Leaf001", 90, 0.5, nil)
game_api.fade_object("Room_Cover_South_3_001", 0, 0.5, function() game_api.fade_object("Room_Cover_South_3_001", 0, 0.5, callback_deactivate_cover_s3)
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
end)
end end
game_api.switch_navigation(10) game_api.switch_navigation(10)
@ -471,9 +469,7 @@ function on_hall_door_click()
hall_door_opened = true hall_door_opened = true
game_api.switch_navigation(1) game_api.switch_navigation(1)
game_api.rotate_object("Hall_Leaf001", 90, 0.5, nil) game_api.rotate_object("Hall_Leaf001", 90, 0.5, nil)
game_api.fade_object("Room_Cover_Main_Hall_001", 0, 0.5, function() game_api.fade_object("Room_Cover_Main_Hall_001", 0, 0.5, callback_deactivate_cover_main_hall)
game_api.deactivate_interactive_object("Room_Cover_Main_Hall_001")
end)
game_api.set_npc_enabled(0, true) game_api.set_npc_enabled(0, true)
game_api.set_npc_enabled(6, true) game_api.set_npc_enabled(6, true)
game_api.npc_rotate_to(6, 180) game_api.npc_rotate_to(6, 180)
@ -650,9 +646,7 @@ end
function on_teacher_arrived_intermediate() function on_teacher_arrived_intermediate()
game_api.rotate_object("Room_N_2_Leaf001", -90, 0.5, nil) game_api.rotate_object("Room_N_2_Leaf001", -90, 0.5, nil)
game_api.fade_object("Room_Cover_North_3_001", 0, 0.5, function() game_api.fade_object("Room_Cover_North_3_001", 0, 0.5, callback_deactivate_cover_n3)
game_api.deactivate_interactive_object("Room_Cover_North_3_001")
end)
game_api.switch_navigation(2) game_api.switch_navigation(2)
game_api.npc_walk_to(0, 4.94194, 0, 6.64111, on_teacher_arrived) game_api.npc_walk_to(0, 4.94194, 0, 6.64111, on_teacher_arrived)
teacher_arrived = true teacher_arrived = true
@ -665,7 +659,7 @@ function on_lection_cutscene_fadein_callback()
game_api.player_set_rotation(180) game_api.player_set_rotation(180)
end end
game_api.set_cutscene_callback("lection_cutscene001", function() function callback_on_lection_cutscene_over()
print("Cutscene done!") print("Cutscene done!")
game_api.setIntValue("lection_is_over", 1) game_api.setIntValue("lection_is_over", 1)
@ -679,7 +673,9 @@ game_api.set_cutscene_callback("lection_cutscene001", function()
if (aiperi_knife_aware == 0) then if (aiperi_knife_aware == 0) then
game_api.set_chat_unread(0, true, CONST_MSG_WHERE) game_api.set_chat_unread(0, true, CONST_MSG_WHERE)
end end
end) end
game_api.set_cutscene_callback("lection_cutscene001", callback_on_lection_cutscene_over)
function on_note_pickup() function on_note_pickup()
@ -714,8 +710,7 @@ end
first_time_darklands = true first_time_darklands = true
game_api.set_darklands_callbacks( function callback_enter_darklands()
function()
if (first_time_darklands) then if (first_time_darklands) then
game_api.start_dialogue("ghost_dialog001") game_api.start_dialogue("ghost_dialog001")
first_time_darklands = false first_time_darklands = false
@ -748,8 +743,9 @@ game_api.set_darklands_callbacks(
end end
game_api.switch_navigation(5) game_api.switch_navigation(5)
end, end
function()
function callback_exit_darklands()
game_api.start_cutscene("darklands_exit001") game_api.start_cutscene("darklands_exit001")
game_api.set_npc_enabled(0, false) game_api.set_npc_enabled(0, false)
game_api.set_npc_enabled(1, false) game_api.set_npc_enabled(1, false)
@ -781,7 +777,6 @@ game_api.set_darklands_callbacks(
game_api.deactivate_interactive_object("Room_Cover_Main_Hall_001") game_api.deactivate_interactive_object("Room_Cover_Main_Hall_001")
morning_can_open_door_index = 6 morning_can_open_door_index = 6
elseif (pz <= 8.2) and (pz > 7.8) then elseif (pz <= 8.2) and (pz > 7.8) then
--Corridor near the hall --Corridor near the hall
if (teacher_door_opened) then if (teacher_door_opened) then
@ -789,7 +784,6 @@ game_api.set_darklands_callbacks(
end end
morning_can_open_door_index = 0 morning_can_open_door_index = 0
game_api.player_set_position(px, 0, 7.7) game_api.player_set_position(px, 0, 7.7)
elseif (pz <= 7.8) and (pz > 0) and (px >= 1.5 + 0.1) then elseif (pz <= 7.8) and (pz > 0) and (px >= 1.5 + 0.1) then
game_api.activate_interactive_object("Room_Cover_Corridor_001") game_api.activate_interactive_object("Room_Cover_Corridor_001")
game_api.deactivate_interactive_object("Room_Cover_North_3_001") game_api.deactivate_interactive_object("Room_Cover_North_3_001")
@ -847,7 +841,10 @@ game_api.set_darklands_callbacks(
end end
end end
end end
)
game_api.set_darklands_callbacks(
callback_enter_darklands,
callback_exit_darklands)
game_api.set_trigger_zone_callbacks("teacher_dialog_zone001", game_api.set_trigger_zone_callbacks("teacher_dialog_zone001",
@ -880,7 +877,6 @@ function setDay0setup()
game_api.activate_interactive_object("car001") game_api.activate_interactive_object("car001")
game_api.activate_interactive_object("car001wheels") game_api.activate_interactive_object("car001wheels")
end end
function setDay1setup() function setDay1setup()
@ -1108,8 +1104,7 @@ function setDay1NightSetup()
end end
end end
game_api.set_enter_night_callback( function callback_enter_night()
function()
game_api.start_dialogue("dialog_video001") game_api.start_dialogue("dialog_video001")
setDay1NightSetup() setDay1NightSetup()
game_api.switch_navigation(16) game_api.switch_navigation(16)
@ -1121,7 +1116,6 @@ game_api.set_enter_night_callback(
--Corridor near the hall --Corridor near the hall
game_api.player_set_position(px, 0, 7.7) game_api.player_set_position(px, 0, 7.7)
elseif (pz <= 7.8) and (px >= -1.6) and (px <= 1.6) then elseif (pz <= 7.8) and (px >= -1.6) and (px <= 1.6) then
--Player in doors, he should stick to the corridor --Player in doors, he should stick to the corridor
if (px >= 1.4) and (px < 1.6) then if (px >= 1.4) and (px < 1.6) then
game_api.player_set_position(1.3, 0, pz) game_api.player_set_position(1.3, 0, pz)
@ -1132,13 +1126,11 @@ game_api.set_enter_night_callback(
end end
end end
--------------- ---------------
end end
)
game_api.set_chat_callbacks( game_api.set_enter_night_callback(callback_enter_night)
function()
function callback_aiperi_chat()
local player_hold_key = game_api.getIntValue("player_hold_key") local player_hold_key = game_api.getIntValue("player_hold_key")
if (game_api.is_night()) then if (game_api.is_night()) then
@ -1165,7 +1157,6 @@ game_api.set_chat_callbacks(
game_api.setIntValue("aiperi_talked_after_knife", 1) game_api.setIntValue("aiperi_talked_after_knife", 1)
game_api.setIntValue("aiperi_chat_opened", 1) game_api.setIntValue("aiperi_chat_opened", 1)
else else
local aiperi_chat_opened = game_api.getIntValue("aiperi_chat_opened") local aiperi_chat_opened = game_api.getIntValue("aiperi_chat_opened")
local aiperi_knife_aware = game_api.getIntValue("aiperi_knife_aware") local aiperi_knife_aware = game_api.getIntValue("aiperi_knife_aware")
local aiperi_talked_after_knife = game_api.getIntValue("aiperi_talked_after_knife") local aiperi_talked_after_knife = game_api.getIntValue("aiperi_talked_after_knife")
@ -1193,25 +1184,34 @@ game_api.set_chat_callbacks(
end end
end end
end end
end end
end, end
function()
function callback_parents_chat()
local parents_chat_opened = game_api.getIntValue("parents_chat_opened") local parents_chat_opened = game_api.getIntValue("parents_chat_opened")
if parents_chat_opened == 0 then if parents_chat_opened == 0 then
game_api.setIntValue("parents_chat_opened", 1) game_api.setIntValue("parents_chat_opened", 1)
game_api.start_dialogue("dialog_chat_parents001") game_api.start_dialogue("dialog_chat_parents001")
end end
end, end
function()
function callback_news_chat()
local news_chat_opened = game_api.getIntValue("news_chat_opened") local news_chat_opened = game_api.getIntValue("news_chat_opened")
if news_chat_opened == 0 then if news_chat_opened == 0 then
game_api.setIntValue("news_chat_opened", 1) game_api.setIntValue("news_chat_opened", 1)
game_api.start_dialogue("dialog_chat_news001") game_api.start_dialogue("dialog_chat_news001")
end end
end end
game_api.set_chat_callbacks(
callback_aiperi_chat,
callback_parents_chat,
callback_news_chat
) )
function callback_aiperi_dialog_morning()
game_api.start_dialogue("dialog_aiperi_morning001")
end
function on_aiperi_opens_door() function on_aiperi_opens_door()
print("on_aiperi_opens_door") print("on_aiperi_opens_door")
@ -1222,14 +1222,10 @@ function on_aiperi_opens_door()
game_api.start_dialogue("door_unlock_dialog001") game_api.start_dialogue("door_unlock_dialog001")
game_api.rotate_object("Hall_Leaf001", 90, 0.5, nil) game_api.rotate_object("Hall_Leaf001", 90, 0.5, nil)
game_api.fade_object("Room_Cover_Corridor_001", 0, 0.5, function() game_api.fade_object("Room_Cover_Corridor_001", 0, 0.5, callback_deactivate_cover_corridor)
game_api.deactivate_interactive_object("Room_Cover_Corridor_001")
end)
if (teacher_door_opened) then if (teacher_door_opened) then
game_api.fade_object("Room_Cover_South_3_001", 0, 0.5, function() game_api.fade_object("Room_Cover_South_3_001", 0, 0.5, callback_deactivate_cover_s3)
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
end)
game_api.switch_navigation(12) game_api.switch_navigation(12)
else else
game_api.switch_navigation(6) game_api.switch_navigation(6)
@ -1238,9 +1234,7 @@ function on_aiperi_opens_door()
--Aiperi incoming --Aiperi incoming
game_api.npc_set_position(1, 0, 0, 6.5) game_api.npc_set_position(1, 0, 0, 6.5)
game_api.set_npc_enabled(1, true) game_api.set_npc_enabled(1, true)
game_api.npc_walk_to(1, 0.0, 0, 9.1, function() game_api.npc_walk_to(1, 0.0, 0, 9.1, callback_aiperi_dialog_morning)
game_api.start_dialogue("dialog_aiperi_morning001")
end)
game_api.player_walk_to(0.0, 0.0, 10.0, nil) game_api.player_walk_to(0.0, 0.0, 10.0, nil)
game_api.play_sound("audio/702171__foxfire__door-opening.ogg") game_api.play_sound("audio/702171__foxfire__door-opening.ogg")
@ -1250,14 +1244,10 @@ function on_aiperi_opens_door()
morning_did_open_door_index = 5 morning_did_open_door_index = 5
game_api.start_dialogue("door_unlock_dialog001") game_api.start_dialogue("door_unlock_dialog001")
game_api.rotate_object("Room_N_2_Leaf001", -90, 0.5, nil) game_api.rotate_object("Room_N_2_Leaf001", -90, 0.5, nil)
game_api.fade_object("Room_Cover_Corridor_001", 0, 0.5, function() game_api.fade_object("Room_Cover_Corridor_001", 0, 0.5, callback_deactivate_cover_corridor)
game_api.deactivate_interactive_object("Room_Cover_Corridor_001")
end)
if (teacher_door_opened) then if (teacher_door_opened) then
game_api.fade_object("Room_Cover_South_3_001", 0, 0.5, function() game_api.fade_object("Room_Cover_South_3_001", 0, 0.5, callback_deactivate_cover_s3)
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
end)
game_api.switch_navigation(13) game_api.switch_navigation(13)
else else
game_api.switch_navigation(7) game_api.switch_navigation(7)
@ -1266,9 +1256,7 @@ function on_aiperi_opens_door()
--Aiperi incoming --Aiperi incoming
game_api.npc_set_position(1, 0.0, 0, 6.43818) game_api.npc_set_position(1, 0.0, 0, 6.43818)
game_api.set_npc_enabled(1, true) game_api.set_npc_enabled(1, true)
game_api.npc_walk_to(1, 2.34349, 0, 6.31229, function() game_api.npc_walk_to(1, 2.34349, 0, 6.31229, callback_aiperi_dialog_morning)
game_api.start_dialogue("dialog_aiperi_morning001")
end)
game_api.player_walk_to(3.52174, 0, 6.28993, nil) game_api.player_walk_to(3.52174, 0, 6.28993, nil)
game_api.play_sound("audio/702171__foxfire__door-opening.ogg") game_api.play_sound("audio/702171__foxfire__door-opening.ogg")
@ -1279,13 +1267,9 @@ function on_aiperi_opens_door()
game_api.start_dialogue("door_unlock_dialog001") game_api.start_dialogue("door_unlock_dialog001")
game_api.rotate_object("Room_N_1_Leaf001", -90, 0.5, nil) game_api.rotate_object("Room_N_1_Leaf001", -90, 0.5, nil)
game_api.fade_object("Room_Cover_Corridor_001", 0, 0.5, function() game_api.fade_object("Room_Cover_Corridor_001", 0, 0.5, callback_deactivate_cover_corridor)
game_api.deactivate_interactive_object("Room_Cover_Corridor_001")
end)
if (teacher_door_opened) then if (teacher_door_opened) then
game_api.fade_object("Room_Cover_South_3_001", 0, 0.5, function() game_api.fade_object("Room_Cover_South_3_001", 0, 0.5, callback_deactivate_cover_s3)
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
end)
game_api.switch_navigation(14) game_api.switch_navigation(14)
else else
game_api.switch_navigation(0) game_api.switch_navigation(0)
@ -1294,9 +1278,7 @@ function on_aiperi_opens_door()
--Aiperi incoming --Aiperi incoming
game_api.npc_set_position(1, 0, 0, -1.7911) game_api.npc_set_position(1, 0, 0, -1.7911)
game_api.set_npc_enabled(1, true) game_api.set_npc_enabled(1, true)
game_api.npc_walk_to(1, 2.11898, 0, -1.7074, function() game_api.npc_walk_to(1, 2.11898, 0, -1.7074, callback_aiperi_dialog_morning)
game_api.start_dialogue("dialog_aiperi_morning001")
end)
game_api.player_walk_to(3.36055, 0, -2.0345, nil) game_api.player_walk_to(3.36055, 0, -2.0345, nil)
game_api.play_sound("audio/702171__foxfire__door-opening.ogg") game_api.play_sound("audio/702171__foxfire__door-opening.ogg")
@ -1307,14 +1289,10 @@ function on_aiperi_opens_door()
game_api.start_dialogue("door_unlock_dialog001") game_api.start_dialogue("door_unlock_dialog001")
game_api.rotate_object("Room_S_1_Leaf001", 90, 0.5, nil) game_api.rotate_object("Room_S_1_Leaf001", 90, 0.5, nil)
game_api.fade_object("Room_Cover_Corridor_001", 0, 0.5, function() game_api.fade_object("Room_Cover_Corridor_001", 0, 0.5, callback_deactivate_cover_corridor)
game_api.deactivate_interactive_object("Room_Cover_Corridor_001")
end)
if (teacher_door_opened) then if (teacher_door_opened) then
game_api.fade_object("Room_Cover_South_3_001", 0, 0.5, function() game_api.fade_object("Room_Cover_South_3_001", 0, 0.5, callback_deactivate_cover_s3)
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
end)
game_api.switch_navigation(15) game_api.switch_navigation(15)
else else
game_api.switch_navigation(9) game_api.switch_navigation(9)
@ -1322,9 +1300,7 @@ function on_aiperi_opens_door()
--Aiperi incoming --Aiperi incoming
game_api.npc_set_position(1, 0, 0, -1.7911) game_api.npc_set_position(1, 0, 0, -1.7911)
game_api.set_npc_enabled(1, true) game_api.set_npc_enabled(1, true)
game_api.npc_walk_to(1, -2.454, 0, -1.61871, function() game_api.npc_walk_to(1, -2.454, 0, -1.61871, callback_aiperi_dialog_morning)
game_api.start_dialogue("dialog_aiperi_morning001")
end)
game_api.player_walk_to(-3.63363, 0, -1.50727, nil) game_api.player_walk_to(-3.63363, 0, -1.50727, nil)
game_api.play_sound("audio/702171__foxfire__door-opening.ogg") game_api.play_sound("audio/702171__foxfire__door-opening.ogg")
@ -1335,13 +1311,9 @@ function on_aiperi_opens_door()
game_api.start_dialogue("door_unlock_dialog001") game_api.start_dialogue("door_unlock_dialog001")
game_api.rotate_object("Room_S_0_Leaf001", 90, 0.5, nil) game_api.rotate_object("Room_S_0_Leaf001", 90, 0.5, nil)
game_api.fade_object("Room_Cover_Corridor_001", 0, 0.5, function() game_api.fade_object("Room_Cover_Corridor_001", 0, 0.5, callback_deactivate_cover_corridor)
game_api.deactivate_interactive_object("Room_Cover_Corridor_001")
end)
if (teacher_door_opened) then if (teacher_door_opened) then
game_api.fade_object("Room_Cover_South_3_001", 0, 0.5, function() game_api.fade_object("Room_Cover_South_3_001", 0, 0.5, callback_deactivate_cover_s3)
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
end)
game_api.switch_navigation(11) game_api.switch_navigation(11)
else else
game_api.switch_navigation(8) game_api.switch_navigation(8)
@ -1350,9 +1322,7 @@ function on_aiperi_opens_door()
--Aiperi incoming --Aiperi incoming
game_api.npc_set_position(1, 0, 0, -9.77948) game_api.npc_set_position(1, 0, 0, -9.77948)
game_api.set_npc_enabled(1, true) game_api.set_npc_enabled(1, true)
game_api.npc_walk_to(1, -2.53977, 0, -9.77852, function() game_api.npc_walk_to(1, -2.53977, 0, -9.77852, callback_aiperi_dialog_morning)
game_api.start_dialogue("dialog_aiperi_morning001")
end)
game_api.player_walk_to(-3.64494, 0, -9.66711, nil) game_api.player_walk_to(-3.64494, 0, -9.66711, nil)
game_api.play_sound("audio/702171__foxfire__door-opening.ogg") game_api.play_sound("audio/702171__foxfire__door-opening.ogg")
@ -1364,8 +1334,7 @@ function on_aiperi_morning_dialog_finished()
game_api.npc_walk_to(1, 0.98998, 0, -7.525, nil) game_api.npc_walk_to(1, 0.98998, 0, -7.525, nil)
end end
game_api.set_location_callbacks( function callback_enter_location()
function()
print("Enter location uni interior-") print("Enter location uni interior-")
--player_left_darklands = false --player_left_darklands = false
local hp = game_api.getFloatValue("player_hp") local hp = game_api.getFloatValue("player_hp")
@ -1419,8 +1388,9 @@ game_api.set_location_callbacks(
print("setDay1MorningSetup entered-") print("setDay1MorningSetup entered-")
setDay1MorningSetup() setDay1MorningSetup()
end end
end, end
function()
function callback_exit_location()
print("Exit location uni interior") print("Exit location uni interior")
--player_left_darklands = false --player_left_darklands = false
local hp = game_api.get_player_hp() local hp = game_api.get_player_hp()
@ -1451,6 +1421,10 @@ game_api.set_location_callbacks(
was_state_when_player_left = 4 was_state_when_player_left = 4
end end
end end
game_api.set_location_callbacks(
callback_enter_location,
callback_exit_location
) )
@ -1472,10 +1446,12 @@ function debugAllOpen()
game_api.rotate_object("Room_N_2_Leaf001", -90, 0.5, nil) game_api.rotate_object("Room_N_2_Leaf001", -90, 0.5, nil)
end end
game_api.set_cutscene_callback("game_complete_cutscene001", function() function callback_game_complete_cutscene()
print("---Cutscene done!") print("---Cutscene done!")
game_api.return_to_main_menu() game_api.return_to_main_menu()
end) end
game_api.set_cutscene_callback("game_complete_cutscene001", callback_game_complete_cutscene)