159 lines
3.7 KiB
Lua
159 lines
3.7 KiB
Lua
|
|
|
|
lection_is_over = false
|
|
|
|
player_hold_book = false
|
|
player_hold_knife = false
|
|
teacher_arrived = false
|
|
|
|
night_time = false
|
|
|
|
function lection_hall_zone001_enter_callback()
|
|
--game_api.start_dialogue("")
|
|
--Start cutscene
|
|
if (lection_is_over == false) then
|
|
game_api.start_cutscene("test_cutscene_01")
|
|
end
|
|
end
|
|
|
|
game_api.set_trigger_zone_callbacks("lection_hall_zone001",
|
|
lection_hall_zone001_enter_callback,
|
|
nil
|
|
)
|
|
|
|
function knife_dialog_zone001_enter_callback()
|
|
print("knife_dialog_zone001_enter_callback--!")
|
|
if (player_hold_knife == false) then
|
|
if lection_is_over then
|
|
game_api.start_dialogue("knife_dialog001")
|
|
game_api.switch_navigation(0)
|
|
end
|
|
else
|
|
game_api.start_dialogue("knife_dialog_second001")
|
|
game_api.set_trigger_zone_enabled(1, false)
|
|
end
|
|
end
|
|
|
|
function knife_dialog_zone001_exit_callback()
|
|
print("knife_dialog_zone001_exit_callback--!")
|
|
game_api.switch_navigation(0)
|
|
end
|
|
|
|
game_api.set_trigger_zone_callbacks("knife_dialog_zone001",
|
|
knife_dialog_zone001_enter_callback,
|
|
knife_dialog_zone001_exit_callback
|
|
)
|
|
|
|
|
|
function on_knife_pickup()
|
|
game_api.pickup_item("knife")
|
|
game_api.deactivate_interactive_object("Knife001")
|
|
game_api.set_npc_enabled(1, false)
|
|
player_hold_knife = true
|
|
game_api.set_trigger_zone_enabled(2, true)
|
|
game_api.npc_walk_to(0, -4.57412, 0, 6.78495, on_teacher_arrived2)
|
|
end
|
|
|
|
function on_book_pickup()
|
|
if not player_hold_book then
|
|
game_api.pickup_item("book")
|
|
game_api.deactivate_interactive_object("Book001")
|
|
player_hold_book = true
|
|
else
|
|
game_api.remove_item("book")
|
|
game_api.activate_interactive_object("Book001")
|
|
player_hold_book = false
|
|
end
|
|
end
|
|
|
|
function on_bookshelf_clicked()
|
|
if not player_hold_book then
|
|
game_api.pickup_item("book")
|
|
game_api.deactivate_interactive_object("Book001")
|
|
player_hold_book = true
|
|
game_api.set_trigger_zone_enabled(3, true)
|
|
else
|
|
game_api.remove_item("book")
|
|
game_api.activate_interactive_object("Book001")
|
|
player_hold_book = false
|
|
game_api.set_trigger_zone_enabled(3, false)
|
|
end
|
|
end
|
|
|
|
|
|
|
|
function on_npc_interact(npc_index)
|
|
print("[Lua] NPC interaction! Index: " .. tostring(npc_index))
|
|
if npc_index == 1 then
|
|
game_api.start_dialogue("knife_dialog001")
|
|
end
|
|
if npc_index == 0 then
|
|
--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.set_trigger_zone_enabled(2, false)
|
|
end
|
|
|
|
function on_teacher_arrived()
|
|
teacher_arrived = true
|
|
print("Teacher arrived")
|
|
end
|
|
|
|
function on_teacher_arrived2()
|
|
print("Teacher arrived2")
|
|
end
|
|
|
|
function book_dialog_zone001_enter_callback()
|
|
if (night_time == false) then
|
|
game_api.start_dialogue("book_dialog001")
|
|
game_api.switch_navigation(0)
|
|
end
|
|
end
|
|
|
|
function book_dialog_zone001_exit_callback()
|
|
if (night_time == false) then
|
|
game_api.switch_navigation(0)
|
|
end
|
|
end
|
|
|
|
function on_computer_clicked()
|
|
if (night_time == false) then
|
|
if (player_hold_book) then
|
|
game_api.start_cutscene("test_cutscene_02")
|
|
else
|
|
game_api.start_dialogue("book_dialog002")
|
|
end
|
|
end
|
|
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)
|
|
end)
|
|
|
|
game_api.set_cutscene_callback("test_cutscene_02", function()
|
|
print("Cutscene 2 done!")
|
|
night_time = true
|
|
game_api.set_npc_enabled(0, false)
|
|
game_api.switch_navigation(0)
|
|
end)
|
|
|
|
game_api.set_trigger_zone_callbacks("teacher_dialog_zone001",
|
|
teacher_zone001_enter_callback,
|
|
nil
|
|
)
|
|
|
|
game_api.set_trigger_zone_callbacks("book_dialog_zone001",
|
|
book_dialog_zone001_enter_callback,
|
|
book_dialog_zone001_exit_callback
|
|
)
|
|
|
|
print("Lua script loaded successfully!") |