Working on doors and scripting

This commit is contained in:
Vladislav Khorev committed 2026-05-14 21:28:41 +03:00
1 parent 774397f690
commit 0f2b2e55af
11 files changed
+322 -9

No files matched your search

+33 -3
View File
@@ -1,10 +1,13 @@
hall_door_opened = false
teacher_door_opened = false
lection_is_over = false
player_hold_book = false
player_hold_knife = false
teacher_arrived = false
teacher_told_about_book = false
night_time = false
@@ -55,6 +58,7 @@ game_api.npc_walk_to(0, -4.57412, 0, 6.78495, on_teacher_arrived2)
end
function on_book_pickup()
if (teacher_told_about_book) then
if not player_hold_book then
game_api.pickup_item("book")
game_api.deactivate_interactive_object("Book001")
@@ -64,6 +68,7 @@ function on_book_pickup()
game_api.activate_interactive_object("Book001")
player_hold_book = false
end
end
end
function on_bookshelf_clicked()
@@ -88,34 +93,52 @@ function on_npc_interact(npc_index)
game_api.start_dialogue("knife_dialog001")
end
if npc_index == 0 then
--game_api.start_dialogue("teacher_dialog001")
game_api.start_dialogue("teacher_dialog001")
--game_api.set_trigger_zone_enabled(2, false)
end
end
function teacher_zone001_enter_callback()
game_api.start_dialogue("teacher_dialog001")
game_api.start_dialogue("teacher_dialog002")
game_api.set_trigger_zone_enabled(2, false)
teacher_told_about_book = true
end
function on_locked_door_click()
game_api.start_dialogue("door_dialog001")
-- Example: uncomment and replace "DoorName" to animate a door open over 1.5 seconds
-- game_api.rotate_object("DoorName", 90, 1.5, function()
-- print("Door finished opening!")
-- end)
end
function on_library_door_click()
if (night_time) then
game_api.start_dialogue("door_night_dialog001")
else
if (not lection_is_over) then
game_api.start_dialogue("door_dialog001")
end
end
end
function on_teachers_door_click()
if (not lection_is_over) then
game_api.start_dialogue("door_dialog001")
else
if (not teacher_door_opened) then
teacher_door_opened = true
game_api.rotate_object("Room_S_2_Leaf001", 90, 0.5, nil)
end
end
end
function on_hall_door_click()
if (not hall_door_opened) then
hall_door_opened = true
game_api.rotate_object("Hall_Leaf001", 90, 0.5, nil)
end
end
@@ -151,13 +174,19 @@ function on_computer_clicked()
end
end
function on_teacher_arrived_intermediate()
game_api.rotate_object("Room_N_2_Leaf001", -90, 0.5, nil)
game_api.npc_walk_to(0, 3.19574, 0, 6.45595, on_teacher_arrived)
end
game_api.set_cutscene_callback("test_cutscene_01", function()
print("Cutscene done!")
lection_is_over = true
if (player_hold_knife == false) then
game_api.set_npc_enabled(1, true)
end
game_api.npc_walk_to(0, 3.19574, 0, 6.45595, on_teacher_arrived)
game_api.npc_walk_to(0, 0.916388, 0, 6.32083, on_teacher_arrived_intermediate)
end)
game_api.set_cutscene_callback("test_cutscene_02", function()
@@ -165,6 +194,7 @@ game_api.set_cutscene_callback("test_cutscene_02", function()
night_time = true
game_api.set_npc_enabled(0, false)
game_api.switch_navigation(0)
game_api.rotate_object("Room_N_2_Leaf001", 90, 0.01, nil)
end)
game_api.set_trigger_zone_callbacks("teacher_dialog_zone001",