1316 lines
41 KiB
Lua
1316 lines
41 KiB
Lua
hall_door_opened = false
|
|
teacher_door_opened = false
|
|
--lection_is_over = false
|
|
|
|
player_hold_book = false
|
|
player_hold_knife = false
|
|
player_hold_key = false
|
|
teacher_arrived = false
|
|
teacher_told_about_book = false
|
|
|
|
--player_left_darklands = false
|
|
|
|
--was_darklands = false
|
|
|
|
|
|
--[[
|
|
0 - day0
|
|
1 - darklands
|
|
2 - morning
|
|
3 - night
|
|
4 - day
|
|
|
|
]]
|
|
was_state_when_player_left = 0
|
|
was_day_when_player_left = 0
|
|
|
|
morning_can_open_door_index = 0
|
|
morning_did_open_door_index = 0
|
|
|
|
ghost_gone = false
|
|
|
|
function dialog_aiperi_give_key()
|
|
if (player_hold_key == false) then
|
|
game_api.pickup_item("teacher_room_key")
|
|
game_api.quest_unlock("aiperi_knife")
|
|
game_api.quest_set_objective_completed("aiperi_knife", "aiperi_knife_keys")
|
|
player_hold_key = true
|
|
|
|
print("dialog_aiperi_give_key, player_hold_key set to")
|
|
print(player_hold_key)
|
|
|
|
local aiperi_chat_opened = game_api.getIntValue("aiperi_chat_opened")
|
|
|
|
if (aiperi_chat_opened == 0) then
|
|
game_api.set_chat_unread(0, false, "(пусто)")
|
|
end
|
|
end
|
|
end
|
|
|
|
function lection_hall_zone001_enter_callback()
|
|
--game_api.start_dialogue("")
|
|
--Start cutscene
|
|
local lection_is_over = game_api.getIntValue("lection_is_over")
|
|
|
|
|
|
if (lection_is_over == 0) then
|
|
game_api.player_stop()
|
|
game_api.start_cutscene("lection_cutscene001")
|
|
game_api.quest_set_objective_completed("study_beginning", "study_beginning_lecture")
|
|
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--!")
|
|
local day = game_api.getIntValue("day")
|
|
|
|
if (day == 0) then
|
|
if (player_hold_knife == false) then
|
|
local lection_is_over = game_api.getIntValue("lection_is_over")
|
|
if lection_is_over == 1 then
|
|
if (player_hold_key) then
|
|
game_api.start_dialogue("knife_dialog002")
|
|
else
|
|
game_api.start_dialogue("knife_dialog001")
|
|
end
|
|
game_api.switch_navigation(4)
|
|
end
|
|
else
|
|
if (game_api.is_night() == false) then
|
|
local aiperi_talked_after_knife = game_api.getIntValue("aiperi_talked_after_knife")
|
|
if (aiperi_talked_after_knife == 0) then
|
|
game_api.start_dialogue("knife_dialog_second001")
|
|
end
|
|
game_api.set_trigger_zone_enabled(1, false)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
function knife_dialog_zone001_exit_callback()
|
|
local day = game_api.getIntValue("day")
|
|
|
|
if (day == 0) then
|
|
print("knife_dialog_zone001_exit_callback--!")
|
|
local lection_is_over = game_api.getIntValue("lection_is_over")
|
|
if (lection_is_over == 1) then
|
|
if (teacher_door_opened) then
|
|
game_api.switch_navigation(3)
|
|
else
|
|
game_api.switch_navigation(2)
|
|
end
|
|
end
|
|
end
|
|
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)
|
|
game_api.quest_set_objective_completed("aiperi_knife", "aiperi_knife_take")
|
|
end
|
|
|
|
function on_book_pickup()
|
|
print("on_book_pickup")
|
|
local day = game_api.getIntValue("day")
|
|
if (teacher_told_about_book) then
|
|
print("on_book_pickup step1")
|
|
if not player_hold_book then
|
|
if (game_api.is_night()) or (day >= 1) then
|
|
game_api.start_dialogue("book_dialog006")
|
|
else
|
|
game_api.pickup_item("book")
|
|
game_api.deactivate_interactive_object("Book001")
|
|
player_hold_book = true
|
|
game_api.quest_set_objective_completed("study_project", "study_project_book")
|
|
game_api.start_dialogue("book_dialog003")
|
|
--game_api.set_trigger_zone_enabled(3, true)
|
|
end
|
|
else
|
|
game_api.remove_item("book")
|
|
game_api.activate_interactive_object("Book001")
|
|
player_hold_book = false
|
|
game_api.start_dialogue("book_dialog004")
|
|
--game_api.set_trigger_zone_enabled(3, false)
|
|
end
|
|
else
|
|
print("on_book_pickup step2")
|
|
game_api.start_dialogue("book_dialog005")
|
|
end
|
|
end
|
|
|
|
function on_bookshelf_clicked()
|
|
on_book_pickup()
|
|
end
|
|
|
|
function on_npc_interact(npc_index)
|
|
local player_ghost_aware = game_api.getIntValue("ghost_aware")
|
|
print("[Lua] NPC interaction! Index: " .. tostring(npc_index))
|
|
if npc_index == 1 then
|
|
local day = game_api.getIntValue("day")
|
|
|
|
if (game_api.is_dawn()) or (day > 0) then
|
|
game_api.start_dialogue("dialog_aiperi_morning001")
|
|
else
|
|
if (player_hold_key) then
|
|
game_api.start_dialogue("knife_dialog002")
|
|
else
|
|
game_api.start_dialogue("knife_dialog001")
|
|
end
|
|
end
|
|
end
|
|
if npc_index == 0 then
|
|
if (player_ghost_aware == 1) then
|
|
--game_api.setIntValue("player_has_coursework", 1)
|
|
local player_has_coursework = game_api.getIntValue("player_has_coursework")
|
|
local player_has_report_card = game_api.getIntValue("player_has_report_card")
|
|
local report_card_signed = game_api.getIntValue("report_card_signed")
|
|
|
|
if (report_card_signed == 1) then
|
|
game_api.start_dialogue("teacher_dialog002")
|
|
elseif (player_has_coursework == 1 and player_has_report_card == 1) then
|
|
game_api.start_dialogue("teacher_dialog005")
|
|
game_api.remove_item("coursework")
|
|
game_api.setIntValue("report_card_signed", 1)
|
|
elseif (player_has_coursework == 1) then
|
|
game_api.start_dialogue("teacher_dialog004")
|
|
else
|
|
game_api.start_dialogue("teacher_dialog003")
|
|
end
|
|
else
|
|
game_api.start_dialogue("teacher_dialog001")
|
|
end
|
|
end
|
|
if npc_index == 2 then
|
|
local report_card_signed = game_api.getIntValue("report_card_signed")
|
|
if (report_card_signed == 1) then
|
|
game_api.start_dialogue("dialog_with_ghost003")
|
|
else
|
|
game_api.start_dialogue("dialog_with_ghost001")
|
|
end
|
|
end
|
|
if npc_index == 6 then
|
|
game_api.start_dialogue("dialog_female_student002")
|
|
end
|
|
end
|
|
|
|
function on_quest_over()
|
|
ghost_gone = true
|
|
game_api.set_npc_enabled(2, false)
|
|
game_api.set_npc_enabled(3, false)
|
|
game_api.set_npc_enabled(4, false)
|
|
game_api.set_npc_enabled(5, false)
|
|
game_api.quest_set_objective_completed("ghost_release", "ghost_release_show")
|
|
|
|
game_api.start_cutscene("game_complete_cutscene001")
|
|
end
|
|
|
|
function on_darklands_over()
|
|
game_api.set_player_hp(10)
|
|
game_api.resetPlayerAfterDeath()
|
|
end
|
|
|
|
function teacher_zone001_enter_callback()
|
|
game_api.start_dialogue("teacher_dialog002")
|
|
game_api.set_trigger_zone_enabled(2, false)
|
|
teacher_told_about_book = true
|
|
game_api.player_stop()
|
|
end
|
|
|
|
function on_library_door_click()
|
|
print("on_library_door_click---")
|
|
local day = game_api.getIntValue("day")
|
|
local lection_is_over = game_api.getIntValue("lection_is_over")
|
|
|
|
if (day == 0) then
|
|
if game_api.is_dawn() then
|
|
game_api.start_dialogue("door_dialog001")
|
|
elseif game_api.is_night() then
|
|
game_api.start_dialogue("door_night_dialog001")
|
|
else
|
|
if (lection_is_over == 0) then
|
|
game_api.start_dialogue("door_dialog001")
|
|
end
|
|
end
|
|
else
|
|
print("Library door step 1")
|
|
|
|
if (game_api.is_night()) then
|
|
print("Library door step 2")
|
|
print("morning_did_open_door_index")
|
|
print(morning_did_open_door_index)
|
|
print("game_api.is_dawn()")
|
|
print(game_api.is_dawn())
|
|
if (not game_api.is_dawn() or not (morning_did_open_door_index == 5)) then
|
|
print("Library door step 3")
|
|
game_api.start_dialogue("door_dialog001")
|
|
end
|
|
print("Library door step 4")
|
|
end
|
|
print("Library door step5")
|
|
end
|
|
print("Library door step 5")
|
|
end
|
|
|
|
function on_teachers_door_click()
|
|
print("on_teachers_door_click---")
|
|
|
|
|
|
local day = game_api.getIntValue("day")
|
|
print("day is")
|
|
print(day)
|
|
|
|
if (day == 0) and not game_api.is_dawn() then
|
|
if (player_hold_key) then
|
|
if (not teacher_door_opened) then
|
|
teacher_door_opened = true
|
|
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.deactivate_interactive_object("Room_Cover_South_3_001")
|
|
end)
|
|
game_api.switch_navigation(3)
|
|
end
|
|
else
|
|
game_api.start_dialogue("door_teacher_dialog001")
|
|
end
|
|
else
|
|
if (game_api.is_dawn()) then
|
|
print("morning_can_open_door_index is")
|
|
print(morning_can_open_door_index)
|
|
|
|
if (teacher_door_opened == false) then
|
|
teacher_door_opened = true
|
|
if (morning_can_open_door_index == 3) then
|
|
morning_did_open_door_index = 3
|
|
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.deactivate_interactive_object("Room_Cover_Corridor_001")
|
|
end)
|
|
game_api.switch_navigation(10)
|
|
else
|
|
if (morning_did_open_door_index == 1) then
|
|
--s1 + s3
|
|
|
|
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.deactivate_interactive_object("Room_Cover_South_3_001")
|
|
end)
|
|
game_api.switch_navigation(11)
|
|
elseif (morning_did_open_door_index == 2) then
|
|
--s2 + s3
|
|
|
|
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.deactivate_interactive_object("Room_Cover_South_3_001")
|
|
end)
|
|
game_api.switch_navigation(15)
|
|
elseif (morning_did_open_door_index == 5) then
|
|
--n3 + s3
|
|
|
|
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.deactivate_interactive_object("Room_Cover_South_3_001")
|
|
end)
|
|
game_api.switch_navigation(13)
|
|
elseif (morning_did_open_door_index == 4) then
|
|
--n2 + s3
|
|
|
|
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.deactivate_interactive_object("Room_Cover_South_3_001")
|
|
end)
|
|
game_api.switch_navigation(14)
|
|
elseif (morning_did_open_door_index == 6) then
|
|
--hall + s3
|
|
|
|
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.deactivate_interactive_object("Room_Cover_South_3_001")
|
|
end)
|
|
game_api.switch_navigation(12)
|
|
else
|
|
--Player was in corridor, but tries to open the teacher's door
|
|
--s3 only
|
|
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.deactivate_interactive_object("Room_Cover_South_3_001")
|
|
end)
|
|
game_api.switch_navigation(10)
|
|
end
|
|
end
|
|
end
|
|
elseif (game_api.is_night()) then
|
|
if (teacher_door_opened == false) then
|
|
teacher_door_opened = true
|
|
|
|
if (morning_can_open_door_index == 3) then
|
|
morning_did_open_door_index = 3
|
|
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.deactivate_interactive_object("Room_Cover_Corridor_001")
|
|
end)
|
|
else
|
|
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.deactivate_interactive_object("Room_Cover_South_3_001")
|
|
end)
|
|
end
|
|
|
|
game_api.switch_navigation(10)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
function on_hall_door_click()
|
|
print("on_hall_door_click---")
|
|
|
|
local day = game_api.getIntValue("day")
|
|
|
|
if (day == 0) and not game_api.is_dawn() then
|
|
if (not hall_door_opened) then
|
|
hall_door_opened = true
|
|
game_api.switch_navigation(1)
|
|
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.deactivate_interactive_object("Room_Cover_Main_Hall_001")
|
|
end)
|
|
game_api.set_npc_enabled(0, true)
|
|
game_api.set_npc_enabled(6, true)
|
|
end
|
|
else
|
|
if (game_api.is_night()) then
|
|
if not (morning_did_open_door_index == 6) then
|
|
game_api.start_dialogue("door_dialog001")
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
function on_s1_door_click()
|
|
--if (player_left_darklands) then
|
|
if (game_api.is_night()) then
|
|
if not (morning_did_open_door_index == 1) then
|
|
game_api.start_dialogue("door_dialog001")
|
|
end
|
|
else
|
|
game_api.start_dialogue("door_dialog001")
|
|
end
|
|
end
|
|
|
|
function on_s2_door_click()
|
|
--if (player_left_darklands) then
|
|
|
|
if (game_api.is_night()) then
|
|
if not (morning_did_open_door_index == 2) then
|
|
game_api.start_dialogue("door_dialog001")
|
|
end
|
|
else
|
|
game_api.start_dialogue("door_dialog001")
|
|
end
|
|
end
|
|
|
|
function on_n2_door_click()
|
|
print("morning_can_open_door_index")
|
|
print(morning_can_open_door_index)
|
|
print("morning_did_open_door_index")
|
|
print(morning_did_open_door_index)
|
|
|
|
if (game_api.is_night()) then
|
|
if not (morning_did_open_door_index == 4) then
|
|
game_api.start_dialogue("door_dialog001")
|
|
end
|
|
end
|
|
end
|
|
|
|
function on_teacher_arrived()
|
|
print("Teacher arrived")
|
|
game_api.npc_rotate_to(0, 180)
|
|
end
|
|
|
|
function on_student_arrived()
|
|
print("Student arrived")
|
|
game_api.npc_rotate_to(6, 270)
|
|
end
|
|
|
|
function on_teacher_arrived2()
|
|
print("Teacher arrived2")
|
|
game_api.npc_rotate_to(0, 0)
|
|
end
|
|
|
|
function book_dialog_zone001_enter_callback()
|
|
print("book_dialog_zone001_enter_callback step 1")
|
|
if (game_api.is_darklands()) then
|
|
print("book_dialog_zone001_enter_callback step 2")
|
|
game_api.start_dialogue("ghost_dialog002")
|
|
game_api.set_trigger_zone_enabled(3, false)
|
|
game_api.advance_darklands_hud()
|
|
else
|
|
print("book_dialog_zone001_enter_callback step 3")
|
|
if (player_hold_book) and (game_api.is_night() == false) then
|
|
print("book_dialog_zone001_enter_callback step 4")
|
|
game_api.start_dialogue("book_dialog001")
|
|
game_api.switch_navigation(0)
|
|
game_api.player_stop()
|
|
end
|
|
end
|
|
end
|
|
|
|
function book_dialog_zone001_exit_callback()
|
|
print("book_dialog_zone001_exit_callback step 1")
|
|
if (player_hold_book) and (game_api.is_night() == false) then
|
|
game_api.switch_navigation(3)
|
|
end
|
|
end
|
|
|
|
function on_computer_clicked()
|
|
print("on_computer_clicked--")
|
|
local day = game_api.getIntValue("day")
|
|
|
|
if game_api.is_darklands() then
|
|
game_api.start_dialogue("computer_dialog004")
|
|
elseif (day >= 1) or game_api.is_dawn() then
|
|
print("on_computer_clicked--1")
|
|
game_api.start_dialogue("computer_dialog003")
|
|
else
|
|
if teacher_told_about_book then
|
|
print("on_computer_clicked--2")
|
|
if (game_api.is_night() == false) then
|
|
print("on_computer_clicked--3")
|
|
if (player_hold_book) then
|
|
print("on_computer_clicked--4")
|
|
game_api.quest_set_objective_completed("study_project", "study_project_write")
|
|
game_api.start_cutscene("computer_cutscene001")
|
|
else
|
|
print("on_computer_clicked--5")
|
|
game_api.start_dialogue("book_dialog002")
|
|
end
|
|
else
|
|
print("on_computer_clicked--6")
|
|
game_api.start_dialogue("computer_dialog002")
|
|
end
|
|
else
|
|
print("on_computer_clicked--7")
|
|
game_api.start_dialogue("computer_dialog001")
|
|
end
|
|
end
|
|
end
|
|
|
|
function on_sleep_cutscene()
|
|
print("Cutscene 2 done!")
|
|
|
|
game_api.set_night()
|
|
--game_api.set_trigger_zone_enabled(1, false)
|
|
game_api.set_npc_enabled(0, false)
|
|
game_api.set_npc_enabled(6, false)
|
|
game_api.switch_navigation(16)
|
|
game_api.set_object_rotation("Room_N_2_Leaf001", 0)
|
|
game_api.set_object_rotation("Hall_Leaf001", 0)
|
|
game_api.set_object_rotation("Room_S_2_Leaf001", 0)
|
|
|
|
game_api.activate_interactive_object("Room_Cover_Corridor_001")
|
|
game_api.activate_interactive_object("Room_Cover_Main_Hall_001")
|
|
game_api.activate_interactive_object("Room_Cover_North_2_001")
|
|
game_api.activate_interactive_object("Room_Cover_South_1_001")
|
|
game_api.activate_interactive_object("Room_Cover_South_2_001")
|
|
game_api.activate_interactive_object("Room_Cover_South_3_001")
|
|
game_api.set_object_alpha("Room_Cover_Corridor_001", 1)
|
|
game_api.set_object_alpha("Room_Cover_South_3_001", 1)
|
|
game_api.set_object_alpha("Room_Cover_Main_Hall_001", 1)
|
|
game_api.activate_interactive_object("Note001")
|
|
teacher_door_opened = false
|
|
end
|
|
|
|
function on_teacher_arrived_intermediate()
|
|
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.deactivate_interactive_object("Room_Cover_North_3_001")
|
|
end)
|
|
game_api.switch_navigation(2)
|
|
game_api.npc_walk_to(0, 4.94194, 0, 6.64111, on_teacher_arrived)
|
|
teacher_arrived = true
|
|
end
|
|
|
|
function on_lection_cutscene_fadein_callback()
|
|
print("Lection cutscene in progress!")
|
|
game_api.player_set_position(-2.41002, 0, 10.375)
|
|
game_api.player_set_rotation(180)
|
|
end
|
|
|
|
game_api.set_cutscene_callback("lection_cutscene001", function()
|
|
print("Cutscene done!")
|
|
game_api.setIntValue("lection_is_over", 1)
|
|
|
|
game_api.set_npc_enabled(1, true)
|
|
game_api.npc_walk_to(0, 0.758123, 0, 6.50063, on_teacher_arrived_intermediate)
|
|
game_api.npc_walk_to(6, 5.28998, 0, -5.525, on_student_arrived)
|
|
|
|
local aiperi_knife_aware = game_api.getIntValue("aiperi_knife_aware")
|
|
|
|
if (aiperi_knife_aware == 0) then
|
|
game_api.set_chat_unread(0, true, "Бекзат, ты где? Я жду...")
|
|
end
|
|
end)
|
|
|
|
|
|
function on_note_pickup()
|
|
game_api.start_dialogue("note_dialog001")
|
|
game_api.pickup_item("note_spell")
|
|
game_api.deactivate_interactive_object("Note001")
|
|
end
|
|
|
|
function on_report_card_pickup()
|
|
local player_ghost_aware = game_api.getIntValue("ghost_aware")
|
|
if player_ghost_aware == 1 then
|
|
local player_has_report_card = game_api.getIntValue("player_has_report_card")
|
|
--local report_card_signed = game_api.getIntValue("report_card_signed")
|
|
|
|
if (player_has_report_card == 1) then
|
|
game_api.start_dialogue("dialog_report_card003") -- Еще рано возвращать зачетку обратно в шкаф
|
|
else
|
|
game_api.start_dialogue("dialog_report_card002") -- Я пожалуй возьму зачетку
|
|
game_api.pickup_item("report_card")
|
|
game_api.deactivate_interactive_object("ReportCard001")
|
|
game_api.setIntValue("player_has_report_card", 1)
|
|
game_api.quest_set_objective_completed("ghost_release", "ghost_release_reportcard")
|
|
end
|
|
else
|
|
game_api.start_dialogue("dialog_report_card001")
|
|
end
|
|
end
|
|
|
|
function on_bookshelf_teacher_clicked()
|
|
on_report_card_pickup()
|
|
end
|
|
|
|
first_time_darklands = true
|
|
|
|
game_api.set_darklands_callbacks(
|
|
function()
|
|
if (first_time_darklands) then
|
|
game_api.start_dialogue("ghost_dialog001")
|
|
first_time_darklands = false
|
|
end
|
|
|
|
game_api.set_trigger_zone_enabled(1, false)
|
|
|
|
game_api.set_npc_enabled(0, false)
|
|
game_api.set_npc_enabled(1, false)
|
|
game_api.set_npc_enabled(6, false)
|
|
|
|
if (ghost_gone) then
|
|
game_api.set_npc_enabled(2, false)
|
|
game_api.set_npc_enabled(3, false)
|
|
game_api.set_npc_enabled(4, false)
|
|
game_api.set_npc_enabled(5, false)
|
|
else
|
|
game_api.set_npc_enabled(2, true)
|
|
game_api.set_npc_enabled(3, true)
|
|
game_api.set_npc_enabled(4, true)
|
|
game_api.set_npc_enabled(5, true)
|
|
|
|
game_api.npc_set_hp(3, 35)
|
|
game_api.npc_set_hp(4, 35)
|
|
game_api.npc_set_hp(5, 35)
|
|
|
|
game_api.npc_set_position(3, 0, 0, -6.4)
|
|
game_api.npc_set_position(4, -5.0, 0, 12)
|
|
game_api.npc_set_position(5, 5.0, 0, 12)
|
|
end
|
|
|
|
game_api.switch_navigation(5)
|
|
end,
|
|
function()
|
|
game_api.start_cutscene("darklands_exit001")
|
|
game_api.set_npc_enabled(0, false)
|
|
game_api.set_npc_enabled(1, false)
|
|
game_api.set_npc_enabled(2, false)
|
|
game_api.set_npc_enabled(3, false)
|
|
game_api.set_npc_enabled(4, false)
|
|
game_api.set_npc_enabled(5, false)
|
|
game_api.set_npc_enabled(6, false)
|
|
|
|
--game_api.setIntValue("need_sleep", 1)
|
|
--player_left_darklands = true
|
|
morning_did_open_door_index = 0
|
|
setDay1MorningSetup()
|
|
game_api.set_dawn()
|
|
|
|
|
|
local px = game_api.get_player_x()
|
|
local pz = game_api.get_player_z()
|
|
|
|
print("darklands exit px = ")
|
|
print(px)
|
|
|
|
print("darklands exit pz = ")
|
|
print(pz)
|
|
|
|
|
|
if (pz > 8.0) then
|
|
game_api.activate_interactive_object("Room_Cover_Corridor_001")
|
|
game_api.deactivate_interactive_object("Room_Cover_Main_Hall_001")
|
|
morning_can_open_door_index = 6
|
|
elseif (pz <= 8.0) and (pz > 0) and (px >= 1.5 + 0.1) then
|
|
game_api.activate_interactive_object("Room_Cover_Corridor_001")
|
|
game_api.deactivate_interactive_object("Room_Cover_North_3_001")
|
|
morning_can_open_door_index = 5
|
|
elseif (pz <= 8.0) and (pz > 0) and (px <= -1.5 - 0.1) then
|
|
if (teacher_door_opened) then
|
|
game_api.deactivate_interactive_object("Room_Cover_Corridor_001")
|
|
else
|
|
game_api.activate_interactive_object("Room_Cover_Corridor_001")
|
|
end
|
|
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
|
|
morning_can_open_door_index = 3
|
|
elseif (pz <= 0.0) and (pz > -8) and (px >= 1.5 + 0.1) then
|
|
game_api.activate_interactive_object("Room_Cover_Corridor_001")
|
|
game_api.deactivate_interactive_object("Room_Cover_North_2_001")
|
|
morning_can_open_door_index = 4
|
|
elseif (pz <= 0.0) and (pz > -8) and (px <= -1.5 - 0.1) then
|
|
game_api.activate_interactive_object("Room_Cover_Corridor_001")
|
|
game_api.deactivate_interactive_object("Room_Cover_South_2_001")
|
|
morning_can_open_door_index = 2
|
|
elseif (pz <= -8.0) and (px <= -1.5-0.1) then
|
|
game_api.activate_interactive_object("Room_Cover_Corridor_001")
|
|
game_api.deactivate_interactive_object("Room_Cover_South_1_001")
|
|
morning_can_open_door_index = 1
|
|
else
|
|
--All set before
|
|
if (teacher_door_opened) then
|
|
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
|
|
end
|
|
morning_can_open_door_index = 0
|
|
if (px >=1.4) and (px < 1.6) then
|
|
-- stick to 1.4
|
|
print("Edge case with px = ")
|
|
print (px)
|
|
game_api.player_set_position(1.35, 0, pz)
|
|
end
|
|
|
|
if (px <=-1.4) and (px > -1.6) then
|
|
-- stick to -1.48
|
|
print("Edge case2 with px = ")
|
|
print (px)
|
|
game_api.player_set_position(-1.35, 0, pz)
|
|
end
|
|
end
|
|
|
|
|
|
if (morning_can_open_door_index == 0) or (morning_can_open_door_index == 3) then
|
|
game_api.setIntValue("morning_player_can_leave", 1)
|
|
game_api.setIntValue("morning_aiperi_save_again", 0)
|
|
else
|
|
game_api.setIntValue("morning_player_can_leave", 0)
|
|
local morning_aiperi_talked = game_api.getIntValue("morning_aiperi_talked")
|
|
if (morning_aiperi_talked == 1) then
|
|
game_api.setIntValue("morning_aiperi_save_again", 1)
|
|
end
|
|
end
|
|
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
|
|
)
|
|
|
|
function setDay0setup()
|
|
game_api.deactivate_interactive_object("Room_Cover_Corridor_001")
|
|
game_api.deactivate_interactive_object("Room_Cover_North_2_001")
|
|
|
|
|
|
game_api.rotate_object("Room_N_1_Leaf001", -90, 0.01, nil)
|
|
--game_api.set_object_rotation("Room_N_1_Leaf001", -90)
|
|
|
|
game_api.deactivate_interactive_object("Note001")
|
|
|
|
game_api.set_npc_enabled(0, false)
|
|
game_api.set_npc_enabled(1, false)
|
|
game_api.set_npc_enabled(2, false)
|
|
game_api.set_npc_enabled(3, false)
|
|
game_api.set_npc_enabled(4, false)
|
|
game_api.set_npc_enabled(5, false)
|
|
game_api.set_npc_enabled(6, false)
|
|
|
|
end
|
|
|
|
function setDay1setup()
|
|
print("Enter setDay1setup")
|
|
game_api.set_object_alpha("Room_Cover_North_2_001", 1)
|
|
game_api.set_object_alpha("Room_Cover_North_3_001", 1)
|
|
game_api.set_object_alpha("Room_Cover_South_1_001", 1)
|
|
game_api.set_object_alpha("Room_Cover_South_2_001", 1)
|
|
game_api.set_object_alpha("Room_Cover_South_3_001", 1)
|
|
game_api.set_object_alpha("Room_Cover_Corridor_001", 1)
|
|
game_api.set_object_alpha("Room_Cover_Main_Hall_001", 1)
|
|
|
|
game_api.deactivate_interactive_object("Room_Cover_Corridor_001")
|
|
game_api.deactivate_interactive_object("Room_Cover_Main_Hall_001")
|
|
game_api.deactivate_interactive_object("Room_Cover_North_2_001")
|
|
game_api.deactivate_interactive_object("Room_Cover_North_3_001")
|
|
game_api.activate_interactive_object("Room_Cover_South_1_001")
|
|
game_api.activate_interactive_object("Room_Cover_South_2_001")
|
|
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
|
|
|
|
game_api.set_object_rotation("Room_N_0_Leaf001", 0)
|
|
game_api.set_object_rotation("Room_N_1_Leaf001", -90)
|
|
game_api.set_object_rotation("Room_N_2_Leaf001", -90)
|
|
game_api.set_object_rotation("Room_S_0_Leaf001", 0)
|
|
game_api.set_object_rotation("Room_S_1_Leaf001", 0)
|
|
game_api.set_object_rotation("Room_S_2_Leaf001", 90)
|
|
game_api.set_object_rotation("Hall_Leaf001", 90)
|
|
|
|
game_api.set_npc_enabled(0, true)
|
|
game_api.set_npc_enabled(1, true)
|
|
game_api.set_npc_enabled(2, false)
|
|
game_api.set_npc_enabled(3, false)
|
|
game_api.set_npc_enabled(4, false)
|
|
game_api.set_npc_enabled(5, false)
|
|
game_api.set_npc_enabled(6, true)
|
|
|
|
game_api.npc_set_position(1, 0.98998, 0, -7.525)
|
|
end
|
|
|
|
function setDay1MorningSetup()
|
|
game_api.activate_interactive_object("Room_Cover_North_2_001")
|
|
game_api.activate_interactive_object("Room_Cover_North_3_001")
|
|
|
|
game_api.activate_interactive_object("Room_Cover_South_1_001")
|
|
game_api.activate_interactive_object("Room_Cover_South_2_001")
|
|
|
|
game_api.activate_interactive_object("Room_Cover_South_3_001")
|
|
|
|
game_api.deactivate_interactive_object("Room_Cover_Corridor_001")
|
|
game_api.activate_interactive_object("Room_Cover_Main_Hall_001")
|
|
|
|
game_api.set_object_rotation("Room_N_0_Leaf001", 0)
|
|
game_api.set_object_rotation("Room_N_1_Leaf001", 0)
|
|
game_api.set_object_rotation("Room_N_2_Leaf001", 0)
|
|
game_api.set_object_rotation("Room_S_0_Leaf001", 0)
|
|
game_api.set_object_rotation("Room_S_1_Leaf001", 0)
|
|
if (teacher_door_opened) then
|
|
game_api.set_object_rotation("Room_S_2_Leaf001", 90)
|
|
else
|
|
game_api.set_object_rotation("Room_S_2_Leaf001", 0)
|
|
end
|
|
game_api.set_object_rotation("Hall_Leaf001", 0)
|
|
|
|
game_api.set_object_alpha("Room_Cover_North_2_001", 1)
|
|
game_api.set_object_alpha("Room_Cover_North_3_001", 1)
|
|
game_api.set_object_alpha("Room_Cover_South_1_001", 1)
|
|
game_api.set_object_alpha("Room_Cover_South_2_001", 1)
|
|
game_api.set_object_alpha("Room_Cover_South_3_001", 1)
|
|
game_api.set_object_alpha("Room_Cover_Corridor_001", 1)
|
|
game_api.set_object_alpha("Room_Cover_Main_Hall_001", 1)
|
|
|
|
-- TODO: Make check for teacher_door_opened false or true
|
|
|
|
game_api.set_npc_enabled(0, false)
|
|
game_api.set_npc_enabled(1, false)
|
|
game_api.set_npc_enabled(2, false)
|
|
game_api.set_npc_enabled(3, false)
|
|
game_api.set_npc_enabled(4, false)
|
|
game_api.set_npc_enabled(5, false)
|
|
game_api.set_npc_enabled(6, false)
|
|
|
|
game_api.npc_set_position(1, 0.98998, 0, -7.525)
|
|
|
|
if morning_did_open_door_index == 1 then
|
|
game_api.deactivate_interactive_object("Room_Cover_South_1_001")
|
|
game_api.set_object_rotation("Room_S_0_Leaf001", 90)
|
|
if (teacher_door_opened) then
|
|
game_api.switch_navigation(11)
|
|
else
|
|
game_api.switch_navigation(8)
|
|
end
|
|
elseif morning_did_open_door_index == 2 then
|
|
game_api.deactivate_interactive_object("Room_Cover_South_2_001")
|
|
game_api.set_object_rotation("Room_S_1_Leaf001", 90)
|
|
if (teacher_door_opened) then
|
|
game_api.switch_navigation(15)
|
|
else
|
|
game_api.switch_navigation(9)
|
|
end
|
|
elseif morning_did_open_door_index == 3 then
|
|
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
|
|
game_api.set_object_rotation("Room_S_2_Leaf001", 90)
|
|
|
|
game_api.switch_navigation(10)
|
|
elseif morning_did_open_door_index == 4 then
|
|
game_api.deactivate_interactive_object("Room_Cover_North_2_001")
|
|
game_api.set_object_rotation("Room_N_1_Leaf001", -90)
|
|
if (teacher_door_opened) then
|
|
game_api.switch_navigation(14)
|
|
else
|
|
game_api.switch_navigation(0)
|
|
end
|
|
elseif morning_did_open_door_index == 5 then
|
|
game_api.deactivate_interactive_object("Room_Cover_North_3_001")
|
|
game_api.set_object_rotation("Room_N_2_Leaf001", -90)
|
|
if (teacher_door_opened) then
|
|
game_api.switch_navigation(13)
|
|
else
|
|
game_api.switch_navigation(7)
|
|
end
|
|
elseif morning_did_open_door_index == 6 then
|
|
game_api.deactivate_interactive_object("Room_Cover_Main_Hall_001")
|
|
game_api.set_object_rotation("Hall_Leaf001", 90)
|
|
if (teacher_door_opened) then
|
|
game_api.switch_navigation(12)
|
|
else
|
|
game_api.switch_navigation(6)
|
|
end
|
|
else
|
|
if (teacher_door_opened) then
|
|
game_api.switch_navigation(10)
|
|
else
|
|
game_api.switch_navigation(16)
|
|
end
|
|
end
|
|
end
|
|
|
|
function setDay1NightSetup()
|
|
teacher_door_opened = false
|
|
|
|
print("setDay1NightSetup")
|
|
morning_did_open_door_index = 0
|
|
|
|
game_api.activate_interactive_object("Room_Cover_North_2_001")
|
|
game_api.activate_interactive_object("Room_Cover_North_3_001")
|
|
|
|
game_api.activate_interactive_object("Room_Cover_South_1_001")
|
|
game_api.activate_interactive_object("Room_Cover_South_2_001")
|
|
game_api.activate_interactive_object("Room_Cover_South_3_001")
|
|
game_api.deactivate_interactive_object("Room_Cover_Corridor_001")
|
|
game_api.activate_interactive_object("Room_Cover_Main_Hall_001")
|
|
|
|
game_api.set_object_rotation("Room_N_0_Leaf001", 0)
|
|
game_api.set_object_rotation("Room_N_1_Leaf001", 0)
|
|
game_api.set_object_rotation("Room_N_2_Leaf001", 0)
|
|
game_api.set_object_rotation("Room_S_0_Leaf001", 0)
|
|
game_api.set_object_rotation("Room_S_1_Leaf001", 0)
|
|
game_api.set_object_rotation("Room_S_2_Leaf001", 0)
|
|
game_api.set_object_rotation("Hall_Leaf001", 0)
|
|
|
|
game_api.set_object_alpha("Room_Cover_North_2_001", 1)
|
|
game_api.set_object_alpha("Room_Cover_North_3_001", 1)
|
|
game_api.set_object_alpha("Room_Cover_South_1_001", 1)
|
|
game_api.set_object_alpha("Room_Cover_South_2_001", 1)
|
|
game_api.set_object_alpha("Room_Cover_South_3_001", 1)
|
|
game_api.set_object_alpha("Room_Cover_Corridor_001", 1)
|
|
game_api.set_object_alpha("Room_Cover_Main_Hall_001", 1)
|
|
|
|
game_api.set_npc_enabled(0, false)
|
|
game_api.set_npc_enabled(1, false)
|
|
game_api.set_npc_enabled(2, false)
|
|
game_api.set_npc_enabled(3, false)
|
|
game_api.set_npc_enabled(4, false)
|
|
game_api.set_npc_enabled(5, false)
|
|
game_api.set_npc_enabled(6, false)
|
|
|
|
local px = game_api.get_player_x()
|
|
local pz = game_api.get_player_z()
|
|
|
|
if (pz > 8.0) then
|
|
game_api.activate_interactive_object("Room_Cover_Corridor_001")
|
|
game_api.deactivate_interactive_object("Room_Cover_Main_Hall_001")
|
|
morning_can_open_door_index = 6
|
|
print("(pz > 8.0)")
|
|
elseif (pz <= 8.0) and (pz > 0) and (px >= 1.5) then
|
|
game_api.activate_interactive_object("Room_Cover_Corridor_001")
|
|
game_api.deactivate_interactive_object("Room_Cover_North_3_001")
|
|
morning_can_open_door_index = 5
|
|
print("(pz <= 8.0) and (pz > 0) and (px >= 1.5)")
|
|
elseif (pz <= 8.0) and (pz > 0) and (px <= -1.5) then
|
|
game_api.activate_interactive_object("Room_Cover_Corridor_001")
|
|
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
|
|
morning_can_open_door_index = 3
|
|
print("(pz <= 8.0) and (pz > 0) and (px <= -1.5)")
|
|
elseif (pz <= 0.0) and (pz > -8) and (px >= 1.5) then
|
|
game_api.activate_interactive_object("Room_Cover_Corridor_001")
|
|
game_api.deactivate_interactive_object("Room_Cover_North_2_001")
|
|
morning_can_open_door_index = 4
|
|
print("(pz <= 0.0) and (pz > -8) and (px >= 1.5)")
|
|
elseif (pz <= 0.0) and (pz > -8) and (px <= -1.5) then
|
|
game_api.activate_interactive_object("Room_Cover_Corridor_001")
|
|
game_api.deactivate_interactive_object("Room_Cover_South_2_001")
|
|
morning_can_open_door_index = 2
|
|
print("(pz <= 0.0) and (pz > -8) and (px <= -1.5)")
|
|
elseif (pz <= -8.0) and (px <= -1.5) then
|
|
game_api.activate_interactive_object("Room_Cover_Corridor_001")
|
|
game_api.deactivate_interactive_object("Room_Cover_South_1_001")
|
|
morning_can_open_door_index = 1
|
|
print("(pz <= -8.0) and (px <= -1.5)")
|
|
else
|
|
--All set before
|
|
morning_can_open_door_index = 0
|
|
print("pz and px not working")
|
|
end
|
|
end
|
|
|
|
game_api.set_enter_night_callback(
|
|
function()
|
|
game_api.start_dialogue("dialog_video001")
|
|
setDay1NightSetup()
|
|
game_api.switch_navigation(16)
|
|
end
|
|
)
|
|
|
|
game_api.set_chat_callbacks(
|
|
function()
|
|
if (game_api.is_night()) then
|
|
if (game_api.is_dawn()) then
|
|
local morning_player_can_leave = game_api.getIntValue("morning_player_can_leave")
|
|
|
|
if morning_player_can_leave == 0 then
|
|
game_api.start_dialogue("phone_morning_aiperi001")
|
|
else
|
|
game_api.start_dialogue("cancel_phone_morning_aiperi001")
|
|
end
|
|
else
|
|
local day = game_api.getIntValue("day")
|
|
local asked_help_locked = game_api.getIntValue("asked_help_locked")
|
|
|
|
if (day == 0) then
|
|
if (asked_help_locked == 0) then
|
|
game_api.start_dialogue("phone_night_aiperi001")
|
|
end
|
|
else
|
|
game_api.start_dialogue("cancel_phone_night_aiperi001")
|
|
end
|
|
end
|
|
game_api.setIntValue("aiperi_talked_after_knife", 1)
|
|
game_api.setIntValue("aiperi_chat_opened", 1)
|
|
else
|
|
|
|
local aiperi_chat_opened = game_api.getIntValue("aiperi_chat_opened")
|
|
local aiperi_knife_aware = game_api.getIntValue("aiperi_knife_aware")
|
|
local aiperi_talked_after_knife = game_api.getIntValue("aiperi_talked_after_knife")
|
|
local lection_is_over = game_api.getIntValue("lection_is_over")
|
|
|
|
if (player_hold_knife) and (aiperi_talked_after_knife == 0) then
|
|
game_api.start_dialogue("dialog_chat_aiperi003")
|
|
game_api.setIntValue("aiperi_talked_after_knife", 1)
|
|
else
|
|
print("dialogx step 2")
|
|
if aiperi_chat_opened == 0 then
|
|
print("dialogx step 3")
|
|
game_api.setIntValue("aiperi_chat_opened", 1)
|
|
if aiperi_knife_aware == 0 then
|
|
print("dialogx step 4")
|
|
if (lection_is_over == 1) then
|
|
print("dialogx step 5")
|
|
print("player_hold_key")
|
|
print(player_hold_key)
|
|
if (player_hold_key == false) then
|
|
print("dialogx step 6")
|
|
game_api.start_dialogue("dialog_chat_aiperi002")
|
|
end
|
|
else
|
|
game_api.start_dialogue("dialog_chat_aiperi001")
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
end
|
|
end,
|
|
function()
|
|
local parents_chat_opened = game_api.getIntValue("parents_chat_opened")
|
|
if parents_chat_opened == 0 then
|
|
game_api.setIntValue("parents_chat_opened", 1)
|
|
game_api.start_dialogue("dialog_chat_parents001")
|
|
end
|
|
end,
|
|
function()
|
|
local news_chat_opened = game_api.getIntValue("news_chat_opened")
|
|
if news_chat_opened == 0 then
|
|
game_api.setIntValue("news_chat_opened", 1)
|
|
game_api.start_dialogue("dialog_chat_news001")
|
|
end
|
|
end
|
|
)
|
|
|
|
|
|
function on_aiperi_opens_door()
|
|
print("on_aiperi_opens_door")
|
|
game_api.close_phone()
|
|
if (morning_can_open_door_index == 6) then
|
|
if (morning_did_open_door_index == 0) then
|
|
morning_did_open_door_index = 6
|
|
game_api.start_dialogue("door_unlock_dialog001")
|
|
|
|
game_api.rotate_object("Hall_Leaf001", 90, 0.5, nil)
|
|
game_api.fade_object("Room_Cover_Corridor_001", 0, 0.5, function()
|
|
game_api.deactivate_interactive_object("Room_Cover_Corridor_001")
|
|
end)
|
|
|
|
if (teacher_door_opened) then
|
|
game_api.fade_object("Room_Cover_South_3_001", 0, 0.5, function()
|
|
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
|
|
end)
|
|
game_api.switch_navigation(12)
|
|
else
|
|
game_api.switch_navigation(6)
|
|
end
|
|
|
|
--Aiperi incoming
|
|
game_api.npc_set_position(1, 0, 0, 6.5)
|
|
game_api.set_npc_enabled(1, true)
|
|
game_api.npc_walk_to(1, 0.0, 0, 9.1, function()
|
|
game_api.start_dialogue("dialog_aiperi_morning001")
|
|
end)
|
|
game_api.player_walk_to(0.0, 0.0, 10.0, nil)
|
|
end
|
|
elseif (morning_can_open_door_index == 5) then
|
|
if (morning_did_open_door_index == 0) then
|
|
morning_did_open_door_index = 5
|
|
game_api.start_dialogue("door_unlock_dialog001")
|
|
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.deactivate_interactive_object("Room_Cover_Corridor_001")
|
|
end)
|
|
|
|
if (teacher_door_opened) then
|
|
game_api.fade_object("Room_Cover_South_3_001", 0, 0.5, function()
|
|
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
|
|
end)
|
|
game_api.switch_navigation(13)
|
|
else
|
|
game_api.switch_navigation(7)
|
|
end
|
|
|
|
--Aiperi incoming
|
|
game_api.npc_set_position(1, 0.0, 0, 6.43818)
|
|
game_api.set_npc_enabled(1, true)
|
|
game_api.npc_walk_to(1, 2.34349, 0, 6.31229, function()
|
|
game_api.start_dialogue("dialog_aiperi_morning001")
|
|
end)
|
|
game_api.player_walk_to(3.52174, 0, 6.28993, nil)
|
|
end
|
|
elseif (morning_can_open_door_index == 4) then
|
|
if (morning_did_open_door_index == 0) then
|
|
morning_did_open_door_index = 4
|
|
game_api.start_dialogue("door_unlock_dialog001")
|
|
|
|
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.deactivate_interactive_object("Room_Cover_Corridor_001")
|
|
end)
|
|
if (teacher_door_opened) then
|
|
game_api.fade_object("Room_Cover_South_3_001", 0, 0.5, function()
|
|
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
|
|
end)
|
|
game_api.switch_navigation(14)
|
|
else
|
|
game_api.switch_navigation(0)
|
|
end
|
|
|
|
--Aiperi incoming
|
|
game_api.npc_set_position(1, 0, 0, -1.7911)
|
|
game_api.set_npc_enabled(1, true)
|
|
game_api.npc_walk_to(1, 2.11898, 0, -1.7074, function()
|
|
game_api.start_dialogue("dialog_aiperi_morning001")
|
|
end)
|
|
game_api.player_walk_to(3.36055, 0, -2.0345, nil)
|
|
end
|
|
elseif (morning_can_open_door_index == 2) then
|
|
if (morning_did_open_door_index == 0) then
|
|
morning_did_open_door_index = 2
|
|
game_api.start_dialogue("door_unlock_dialog001")
|
|
|
|
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.deactivate_interactive_object("Room_Cover_Corridor_001")
|
|
end)
|
|
|
|
if (teacher_door_opened) then
|
|
game_api.fade_object("Room_Cover_South_3_001", 0, 0.5, function()
|
|
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
|
|
end)
|
|
game_api.switch_navigation(15)
|
|
else
|
|
game_api.switch_navigation(9)
|
|
end
|
|
--Aiperi incoming
|
|
game_api.npc_set_position(1, 0, 0, -1.7911)
|
|
game_api.set_npc_enabled(1, true)
|
|
game_api.npc_walk_to(1, -2.454, 0, -1.61871, function()
|
|
game_api.start_dialogue("dialog_aiperi_morning001")
|
|
end)
|
|
game_api.player_walk_to(-3.63363, 0, -1.50727, nil)
|
|
end
|
|
elseif (morning_can_open_door_index == 1) then
|
|
if (morning_did_open_door_index == 0) then
|
|
morning_did_open_door_index = 1
|
|
game_api.start_dialogue("door_unlock_dialog001")
|
|
|
|
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.deactivate_interactive_object("Room_Cover_Corridor_001")
|
|
end)
|
|
if (teacher_door_opened) then
|
|
game_api.fade_object("Room_Cover_South_3_001", 0, 0.5, function()
|
|
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
|
|
end)
|
|
game_api.switch_navigation(11)
|
|
else
|
|
game_api.switch_navigation(8)
|
|
end
|
|
|
|
--Aiperi incoming
|
|
game_api.npc_set_position(1, 0, 0, -9.77948)
|
|
game_api.set_npc_enabled(1, true)
|
|
game_api.npc_walk_to(1, -2.53977, 0, -9.77852, function()
|
|
game_api.start_dialogue("dialog_aiperi_morning001")
|
|
end)
|
|
game_api.player_walk_to(-3.64494, 0, -9.66711, nil)
|
|
end
|
|
end
|
|
end
|
|
|
|
function on_aiperi_morning_dialog_finished()
|
|
game_api.npc_walk_to(1, 0.98998, 0, -7.525, nil)
|
|
end
|
|
|
|
game_api.set_location_callbacks(
|
|
function()
|
|
print("Enter location uni interior-")
|
|
--player_left_darklands = false
|
|
local hp = game_api.getFloatValue("player_hp")
|
|
game_api.set_player_hp(hp)
|
|
local day = game_api.getIntValue("day")
|
|
|
|
print("day is:")
|
|
print(day)
|
|
|
|
local resetState = false
|
|
if not (day == was_day_when_player_left) then
|
|
resetState = true
|
|
elseif (was_state_when_player_left == 1) and game_api.is_darklands() == false then
|
|
resetState = true
|
|
elseif (was_state_when_player_left == 2) and (game_api.is_darklands() or game_api.is_dawn() == false) then
|
|
resetState = true
|
|
elseif (was_state_when_player_left == 3) and (game_api.is_darklands() or game_api.is_night() == false) then
|
|
resetState = true
|
|
elseif (was_state_when_player_left == 4) and (game_api.is_night() or game_api.is_darklands()) then
|
|
resetState = true
|
|
end
|
|
|
|
if (day > 0) and resetState then
|
|
if (game_api.is_darklands()) then
|
|
--Currently not possible
|
|
print("Entered darklands setup")
|
|
elseif (game_api.is_dawn()) then
|
|
print("setDay1MorningSetup entered-")
|
|
setDay1MorningSetup()
|
|
elseif (game_api.is_night()) then
|
|
print("entered night setup")
|
|
setDay1NightSetup()
|
|
game_api.switch_navigation(16)
|
|
else
|
|
print("entered day setup")
|
|
setDay1setup()
|
|
game_api.switch_navigation(3)
|
|
end
|
|
end
|
|
|
|
if (day > 0) and (game_api.is_night() == false) then
|
|
print("entered day setup")
|
|
setDay1setup()
|
|
game_api.switch_navigation(3)
|
|
end
|
|
|
|
print("entered exited-")
|
|
|
|
if (was_darklands) and (game_api.is_darklands() == false) and game_api.is_dawn() then
|
|
--Player died in exterior and then in the morning returned back
|
|
print("setDay1MorningSetup entered-")
|
|
setDay1MorningSetup()
|
|
end
|
|
end,
|
|
function()
|
|
print("Exit location uni interior")
|
|
--player_left_darklands = false
|
|
local hp = game_api.get_player_hp()
|
|
game_api.setFloatValue("player_hp", hp)
|
|
|
|
|
|
--[[
|
|
0 - day0
|
|
1 - darklands
|
|
2 - morning
|
|
3 - night
|
|
4 - day
|
|
|
|
]]
|
|
|
|
local day = game_api.getIntValue("day")
|
|
|
|
was_day_when_player_left = day
|
|
if (day == 0) then
|
|
was_state_when_player_left = 0
|
|
elseif game_api.is_darklands() then
|
|
was_state_when_player_left = 1
|
|
elseif game_api.is_dawn() then
|
|
was_state_when_player_left = 2
|
|
elseif game_api.is_night() then
|
|
was_state_when_player_left = 3
|
|
else
|
|
was_state_when_player_left = 4
|
|
end
|
|
end
|
|
)
|
|
|
|
|
|
function debugAllOpen()
|
|
game_api.deactivate_interactive_object("Room_Cover_Corridor_001")
|
|
game_api.deactivate_interactive_object("Room_Cover_Main_Hall_001")
|
|
game_api.deactivate_interactive_object("Room_Cover_North_2_001")
|
|
game_api.deactivate_interactive_object("Room_Cover_North_3_001")
|
|
game_api.deactivate_interactive_object("Room_Cover_South_1_001")
|
|
game_api.deactivate_interactive_object("Room_Cover_South_2_001")
|
|
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
|
|
|
|
game_api.rotate_object("Hall_Leaf001", 90, 0.5, nil)
|
|
|
|
game_api.rotate_object("Room_S_2_Leaf001", 90, 0.5, nil)
|
|
game_api.rotate_object("Room_S_1_Leaf001", 90, 0.5, nil)
|
|
game_api.rotate_object("Room_S_0_Leaf001", 90, 0.5, nil)
|
|
game_api.rotate_object("Room_N_1_Leaf001", -90, 0.5, nil)
|
|
game_api.rotate_object("Room_N_2_Leaf001", -90, 0.5, nil)
|
|
end
|
|
|
|
game_api.set_cutscene_callback("game_complete_cutscene001", function()
|
|
print("---Cutscene done!")
|
|
game_api.return_to_main_menu()
|
|
end)
|
|
|
|
|
|
|
|
setDay0setup()
|
|
game_api.switch_navigation(0)
|
|
--debugAllOpen()
|
|
print("Lua script loaded successfully!")
|