Rewrite callbacks from scripts
This commit is contained in:
parent
2d3aa22521
commit
17d903fd52
@ -14,7 +14,7 @@ journal_picked_up = false
|
||||
|
||||
function on_npc_interact(npc_index)
|
||||
if npc_index == 0 then
|
||||
--[[
|
||||
--[[
|
||||
local player_alik_aware = game_api.getIntValue("alik_aware")
|
||||
local player_container_aware = game_api.getIntValue("player_container_aware")
|
||||
if player_container_aware == 1 then
|
||||
@ -26,7 +26,6 @@ function on_npc_interact(npc_index)
|
||||
game_api.start_dialogue("dialog_alik001")
|
||||
end]]
|
||||
game_api.start_dialogue("dialog_alik002")
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@ -106,22 +105,40 @@ function on_alik_door_click()
|
||||
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()
|
||||
if (alik_door_opened == false) then
|
||||
alik_door_opened = true
|
||||
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.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)
|
||||
game_api.fade_object("Room_Cover_LivingRoom_W_S_2_001", 0, 0.5, callback_deactivate_cover_alik_room)
|
||||
|
||||
if (bathroom_door_opened) then
|
||||
game_api.switch_navigation(5) -- all open
|
||||
else
|
||||
game_api.switch_navigation(4) --b
|
||||
end
|
||||
|
||||
|
||||
game_api.play_sound("audio/702171__foxfire__door-opening.ogg")
|
||||
end
|
||||
end
|
||||
@ -147,9 +164,7 @@ function on_player_bathroom_click()
|
||||
game_api.start_dialogue("door_bathroom_dialog001")
|
||||
|
||||
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.deactivate_interactive_object("Room_Cover_Bath_W_N_2_001")
|
||||
end)
|
||||
game_api.fade_object("Room_Cover_Bath_W_N_2_001", 0, 0.5, callback_deactivate_cover_bathroom)
|
||||
|
||||
|
||||
if (player_door_opened) then
|
||||
@ -161,7 +176,7 @@ function on_player_bathroom_click()
|
||||
else
|
||||
game_api.switch_navigation(1) --ca
|
||||
end
|
||||
|
||||
|
||||
game_api.play_sound("audio/702171__foxfire__door-opening.ogg")
|
||||
end
|
||||
end
|
||||
@ -175,18 +190,12 @@ function on_player_door_click()
|
||||
game_api.player_stop()
|
||||
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.deactivate_interactive_object("Room_Cover_Main_Hall_And_Corridors_002")
|
||||
end)
|
||||
game_api.fade_object("Room_Cover_Main_Hall_And_Corridors_002", 0, 0.5, callback_deactivate_cover_main_hall)
|
||||
|
||||
|
||||
game_api.fade_object("Room_Cover_Utility_W_N_3_001", 0, 0.5, function()
|
||||
game_api.deactivate_interactive_object("Room_Cover_Utility_W_N_3_001")
|
||||
end)
|
||||
game_api.fade_object("Room_Cover_Utility_W_N_3_001", 0, 0.5, callback_deactivate_cover_utility_room_n)
|
||||
|
||||
game_api.fade_object("Room_Cover_Utility_W_S_3_001", 0, 0.5, function()
|
||||
game_api.deactivate_interactive_object("Room_Cover_Utility_W_S_3_001")
|
||||
end)
|
||||
game_api.fade_object("Room_Cover_Utility_W_S_3_001", 0, 0.5, callback_deactivate_cover_utility_room_s)
|
||||
|
||||
if (bathroom_door_opened) then
|
||||
game_api.switch_navigation(3) --a
|
||||
@ -195,57 +204,64 @@ function on_player_door_click()
|
||||
end
|
||||
game_api.play_sound("audio/702171__foxfire__door-opening.ogg")
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
function callback_enter_night()
|
||||
game_api.start_dialogue("dialog_video001")
|
||||
closeAlikDoor()
|
||||
end
|
||||
|
||||
game_api.set_enter_night_callback(
|
||||
function()
|
||||
game_api.start_dialogue("dialog_video001")
|
||||
closeAlikDoor()
|
||||
end
|
||||
callback_enter_night
|
||||
)
|
||||
|
||||
game_api.set_chat_callbacks(
|
||||
function()
|
||||
if (not game_api.is_night()) and (not game_api.is_dawn()) then
|
||||
local aiperi_chat_opened = game_api.getIntValue("aiperi_chat_opened")
|
||||
function callback_aiperi_chat()
|
||||
if (not game_api.is_night()) and (not game_api.is_dawn()) then
|
||||
local aiperi_chat_opened = game_api.getIntValue("aiperi_chat_opened")
|
||||
|
||||
if aiperi_chat_opened == 0 then
|
||||
game_api.setIntValue("aiperi_chat_opened", 1)
|
||||
local aiperi_knife_aware = game_api.getIntValue("aiperi_knife_aware")
|
||||
local aiperi_talked_after_knife = game_api.getIntValue("aiperi_talked_after_knife")
|
||||
if aiperi_chat_opened == 0 then
|
||||
game_api.setIntValue("aiperi_chat_opened", 1)
|
||||
local aiperi_knife_aware = game_api.getIntValue("aiperi_knife_aware")
|
||||
local aiperi_talked_after_knife = game_api.getIntValue("aiperi_talked_after_knife")
|
||||
|
||||
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
|
||||
if aiperi_knife_aware == 0 then
|
||||
local lection_is_over = game_api.getIntValue("lection_is_over")
|
||||
if (lection_is_over == 1) then
|
||||
game_api.start_dialogue("dialog_chat_aiperi002")
|
||||
else
|
||||
game_api.start_dialogue("dialog_chat_aiperi001")
|
||||
end
|
||||
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
|
||||
if aiperi_knife_aware == 0 then
|
||||
local lection_is_over = game_api.getIntValue("lection_is_over")
|
||||
if (lection_is_over == 1) then
|
||||
game_api.start_dialogue("dialog_chat_aiperi002")
|
||||
else
|
||||
game_api.start_dialogue("dialog_chat_aiperi001")
|
||||
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
|
||||
end
|
||||
|
||||
function callback_parents_chat()
|
||||
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 callback_news_chat()
|
||||
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
|
||||
|
||||
game_api.set_chat_callbacks(
|
||||
callback_aiperi_chat,
|
||||
callback_parents_chat,
|
||||
callback_news_chat
|
||||
)
|
||||
|
||||
function on_aiperi_dialog_over()
|
||||
@ -288,34 +304,39 @@ function on_toilet_click()
|
||||
game_api.start_dialogue("dialog_toilet001")
|
||||
end
|
||||
|
||||
function callback_enter_location()
|
||||
print("Enter location dorm")
|
||||
local hp = game_api.getFloatValue("player_hp")
|
||||
game_api.set_player_hp(hp)
|
||||
game_api.set_teleport_active(0, false)
|
||||
if (game_api.is_night()) then
|
||||
closeAlikDoor()
|
||||
end
|
||||
end
|
||||
|
||||
function callback_exit_location()
|
||||
print("Exit location dorm")
|
||||
local hp = game_api.get_player_hp()
|
||||
game_api.setFloatValue("player_hp", hp)
|
||||
end
|
||||
|
||||
game_api.set_location_callbacks(
|
||||
function()
|
||||
print("Enter location dorm")
|
||||
local hp = game_api.getFloatValue("player_hp")
|
||||
game_api.set_player_hp(hp)
|
||||
game_api.set_teleport_active(0, false)
|
||||
if (game_api.is_night()) then
|
||||
closeAlikDoor()
|
||||
end
|
||||
end,
|
||||
function()
|
||||
print("Exit location dorm")
|
||||
local hp = game_api.get_player_hp()
|
||||
game_api.setFloatValue("player_hp", hp)
|
||||
end
|
||||
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.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(
|
||||
function()
|
||||
game_api.set_teleport_active(0, true)
|
||||
game_api.set_trigger_zone_enabled(0, false)
|
||||
end
|
||||
callback_call_taxi
|
||||
)
|
||||
|
||||
|
||||
|
||||
@ -1,15 +1,14 @@
|
||||
print("Lua script loaded successfully!")
|
||||
|
||||
function callback_enter_location()
|
||||
end
|
||||
|
||||
function callback_exit_location()
|
||||
end
|
||||
|
||||
game_api.set_location_callbacks(
|
||||
function()
|
||||
-- player just arrived here
|
||||
if game_api.is_darklands() then
|
||||
-- arrived while in darklands mode
|
||||
end
|
||||
end,
|
||||
function()
|
||||
-- player is about to leave
|
||||
end
|
||||
callback_enter_location,
|
||||
callback_exit_location
|
||||
)
|
||||
|
||||
function darklands_exit001_enter_callback()
|
||||
@ -42,57 +41,64 @@ function dialog_contaier002_get_coursework()
|
||||
game_api.quest_set_objective_completed("ghost_coursework", "ghost_coursework_find")
|
||||
end
|
||||
|
||||
function callback_enter_night()
|
||||
game_api.start_dialogue("dialog_video001")
|
||||
end
|
||||
|
||||
game_api.set_enter_night_callback(
|
||||
function()
|
||||
game_api.start_dialogue("dialog_video001")
|
||||
end
|
||||
callback_enter_night
|
||||
)
|
||||
|
||||
function on_darklands_over()
|
||||
game_api.set_player_hp(10)
|
||||
|
||||
function callback_exit_darklands()
|
||||
game_api.start_cutscene("darklands_exit001")
|
||||
print("Setting to day 1----")
|
||||
game_api.setIntValue("day", 1)
|
||||
game_api.set_dawn()
|
||||
game_api.setIntValue("morning_player_can_leave", 1)
|
||||
end
|
||||
|
||||
game_api.set_darklands_callbacks(
|
||||
nil,
|
||||
function()
|
||||
game_api.start_cutscene("darklands_exit001")
|
||||
print("Setting to day 1----")
|
||||
game_api.setIntValue("day", 1)
|
||||
game_api.set_dawn()
|
||||
game_api.setIntValue("morning_player_can_leave", 1)
|
||||
end
|
||||
callback_exit_darklands
|
||||
)
|
||||
|
||||
function callback_enter_night()
|
||||
game_api.deactivate_interactive_object("car001")
|
||||
game_api.deactivate_interactive_object("car001wheels")
|
||||
game_api.switch_navigation(1)
|
||||
end
|
||||
|
||||
game_api.set_enter_night_callback(
|
||||
function()
|
||||
game_api.deactivate_interactive_object("car001")
|
||||
game_api.deactivate_interactive_object("car001wheels")
|
||||
game_api.switch_navigation(1)
|
||||
end
|
||||
callback_enter_night
|
||||
)
|
||||
|
||||
|
||||
game_api.set_location_callbacks(
|
||||
function()
|
||||
print("Enter location uni exterior")
|
||||
local hp = game_api.getFloatValue("player_hp")
|
||||
game_api.set_player_hp(hp)
|
||||
game_api.set_teleport_active(0, false)
|
||||
if (game_api.is_night()) then
|
||||
game_api.deactivate_interactive_object("car001")
|
||||
game_api.deactivate_interactive_object("car001wheels")
|
||||
game_api.switch_navigation(1)
|
||||
else
|
||||
game_api.activate_interactive_object("car001")
|
||||
game_api.activate_interactive_object("car001wheels")
|
||||
game_api.switch_navigation(0)
|
||||
end
|
||||
end,
|
||||
function()
|
||||
print("Exit location uni exterior")
|
||||
local hp = game_api.get_player_hp()
|
||||
game_api.setFloatValue("player_hp", hp)
|
||||
function callback_enter_location()
|
||||
print("Enter location uni exterior")
|
||||
local hp = game_api.getFloatValue("player_hp")
|
||||
game_api.set_player_hp(hp)
|
||||
game_api.set_teleport_active(0, false)
|
||||
if (game_api.is_night()) then
|
||||
game_api.deactivate_interactive_object("car001")
|
||||
game_api.deactivate_interactive_object("car001wheels")
|
||||
game_api.switch_navigation(1)
|
||||
else
|
||||
game_api.activate_interactive_object("car001")
|
||||
game_api.activate_interactive_object("car001wheels")
|
||||
game_api.switch_navigation(0)
|
||||
end
|
||||
end
|
||||
|
||||
function callback_exit_location()
|
||||
print("Exit location uni exterior")
|
||||
local hp = game_api.get_player_hp()
|
||||
game_api.setFloatValue("player_hp", hp)
|
||||
end
|
||||
|
||||
game_api.set_location_callbacks(
|
||||
callback_enter_location,
|
||||
callback_exit_location
|
||||
)
|
||||
|
||||
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)
|
||||
end
|
||||
|
||||
function callback_call_taxi()
|
||||
game_api.set_teleport_active(0, true)
|
||||
game_api.set_trigger_zone_enabled(0, false)
|
||||
end
|
||||
|
||||
game_api.set_call_taxi_callback(
|
||||
function()
|
||||
game_api.set_teleport_active(0, true)
|
||||
game_api.set_trigger_zone_enabled(0, false)
|
||||
end
|
||||
callback_call_taxi
|
||||
)
|
||||
|
||||
|
||||
@ -136,44 +144,50 @@ game_api.set_trigger_zone_callbacks("taxi_zone001",
|
||||
nil
|
||||
)
|
||||
|
||||
game_api.set_chat_callbacks(
|
||||
function()
|
||||
if (not game_api.is_night()) and (not game_api.is_dawn()) then
|
||||
local aiperi_chat_opened = game_api.getIntValue("aiperi_chat_opened")
|
||||
function callback_aiperi_chat()
|
||||
if (not game_api.is_night()) and (not game_api.is_dawn()) then
|
||||
local aiperi_chat_opened = game_api.getIntValue("aiperi_chat_opened")
|
||||
|
||||
if aiperi_chat_opened == 0 then
|
||||
game_api.setIntValue("aiperi_chat_opened", 1)
|
||||
local aiperi_knife_aware = game_api.getIntValue("aiperi_knife_aware")
|
||||
local aiperi_talked_after_knife = game_api.getIntValue("aiperi_talked_after_knife")
|
||||
if aiperi_chat_opened == 0 then
|
||||
game_api.setIntValue("aiperi_chat_opened", 1)
|
||||
local aiperi_knife_aware = game_api.getIntValue("aiperi_knife_aware")
|
||||
local aiperi_talked_after_knife = game_api.getIntValue("aiperi_talked_after_knife")
|
||||
|
||||
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
|
||||
if aiperi_knife_aware == 0 then
|
||||
local lection_is_over = game_api.getIntValue("lection_is_over")
|
||||
if (lection_is_over == 1) then
|
||||
game_api.start_dialogue("dialog_chat_aiperi002")
|
||||
else
|
||||
game_api.start_dialogue("dialog_chat_aiperi001")
|
||||
end
|
||||
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
|
||||
if aiperi_knife_aware == 0 then
|
||||
local lection_is_over = game_api.getIntValue("lection_is_over")
|
||||
if (lection_is_over == 1) then
|
||||
game_api.start_dialogue("dialog_chat_aiperi002")
|
||||
else
|
||||
game_api.start_dialogue("dialog_chat_aiperi001")
|
||||
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
|
||||
end
|
||||
|
||||
function callback_parents_chat()
|
||||
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 callback_news_chat()
|
||||
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
|
||||
|
||||
game_api.set_chat_callbacks(
|
||||
callback_aiperi_chat,
|
||||
callback_parents_chat,
|
||||
callback_news_chat
|
||||
)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user