Divergent/mods/[DEV] Brotherhood/gamedata/scripts/task_brotherhood_ac.script

334 lines
12 KiB
Plaintext

------- GENERAL Functions --------
local HI = has_alife_info
local GI = give_info
local DI = disable_info
local spawn_squad = dialogs_brotherhood.spawn_squad
function NI(str)
return not (has_alife_info(str))
end
function on_game_start()
RegisterScriptCallback("actor_on_update",actor_on_update)
RegisterScriptCallback("actor_on_first_update",actor_on_first_update)
end
function actor_on_update()
end
function actor_on_first_update()
---atomic_crusader_start()
end
function atomic_crusader_start()
if NI("atomic_crusader_start") then
if get_actor_true_community() == "monolith" then
GI("atomic_crusader_start")
dialogs_brotherhood_ac.give_task_father_charon_quest_1()
end
end
end
function task_status_functor.give_task_blue_winter_quest_1_status_f(tsk,task_id)
local pos_1 = vector():set( -94.356330871582,-0.46535187959671,-53.193744659424 ) --- caspar
local pos_2 = vector():set( -96.955108642578,-0.46410083770752,-53.258888244629 ) ---melchior
local pos_3 = vector():set( -56.787971496582,2.5227835178375,-96.418365478516 ) --- snorks 1 trigger
local pos_4 = vector():set( -50.74377822876,4.2098917961121,-101.90814208984 ) --- snorks 1
local pos_5 = vector():set( -75.341384887695,4.2088317871094,-91.308197021484 ) --- snorks 2 trigger
local pos_6 = vector():set( -80.527206420898,4.2104706764221,-105.93899536133 ) --- snorks 2
local pos_7 = vector():set( -99.864273071289,0.84025031328201,-91.754333496094 ) ---poltergeist trigger
local pos_8 = vector():set( -107.9713973999,4.2113361358643,-101.23147583008 ) ---poltergeist spawn
local npc = get_story_se_object("ac_blue_winter_squad")
local dist_1 = 7
local dist_2 = 3
local smart = SIMBOARD.smarts_by_names["pri_sim_3"]
if (tsk.stage == 0) then
if HI("ac_blue_winter_1_done") then
if level.name() == "pripyat" then
xr_effects.clear_smart_terrain(nil,nil,{"pri_a25_smart_terrain","true"})
xr_effects.clear_smart_terrain(nil,nil,{"pri_sim_9","true"})
xr_effects.clear_smart_terrain(nil,nil,{"pri_b307","true"})
xr_effects.clear_smart_terrain(nil,nil,{"pri_sim_3","true"})
xr_effects.clear_smart_terrain(nil,nil,{"pri_sim_5","true"})
xr_effects.clear_smart_terrain(nil,nil,{"pri_sim_7","true"})
xr_effects.clear_smart_terrain(nil,nil,{"pri_a22_smart_terrain","true"})
tsk.stage = 1
end
end
end
if (tsk.stage == 1) then
if NI("ac_melchior_caspar_spawn_init") then
local squad_1 = SIMBOARD:create_squad(smart,"ac_caspar_squad")
local squad_2 = SIMBOARD:create_squad(smart,"ac_melchior_squad")
GI("ac_melchior_caspar_spawn_init")
tsk.stage = 2
end
end
if (tsk.stage == 2) then
if npc and (npc.position:distance_to(pos_2) < dist_1) then
if NI("st_ac_task_1_init") then
actor_menu.set_msg(1, game.translate_string("st_ac_task_1_0"), 10)
CreateTimeEvent("st_ac_task_1_init_1","st_ac_task_1_init_1", 4,st_ac_task_1_init_1)
CreateTimeEvent("st_ac_task_1_init_2","st_ac_task_1_init_2", 8,st_ac_task_1_init_2)
CreateTimeEvent("st_ac_task_1_init_3","st_ac_task_1_init_3", 12,st_ac_task_1_init_3)
CreateTimeEvent("st_ac_task_1_init_4","st_ac_task_1_init_4", 16,st_ac_task_1_init_4)
CreateTimeEvent("st_ac_task_1_init_5","st_ac_task_1_init_5", 20,st_ac_task_1_init_5)
CreateTimeEvent("st_ac_task_1_init_6","st_ac_task_1_init_6", 24,st_ac_task_1_init_6)
GI("st_ac_task_1_init")
tsk.stage = 3
end
end
end
if (tsk.stage == 3) then
if HI("ac_blue_winter_task_1_stage_3") then
if (db.actor:position():distance_to(pos_3) < dist_2) then
if NI("ac_blue_winter_task_1_spawn_init_1") then
local se_squad_3 = spawn_squad("pack_ac_snorks_1", pos_4, 138716, 4947)
local se_squad_4 = spawn_squad("ac_pri_a25_poltergeist_1_squad", pos_8, 85234, 4948)
GI("ac_blue_winter_task_1_spawn_init_1")
end
end
if (db.actor:position():distance_to(pos_5) < dist_2) then
if NI("ac_blue_winter_task_1_spawn_init_2") then
local se_squad_5 = spawn_squad("pack_ac_snorks_2", pos_6, 109339, 4948)
GI("ac_blue_winter_task_1_spawn_init_2")
end
end
if HI("ac_blue_winter_task_1_spawn_init_2") and HI("ac_blue_winter_task_1_spawn_init_1") then
tsk.stage = 4
end
end
end
if (tsk.stage == 4) then
if HI("pack_ac_snorks_1_dead") and HI("pack_ac_snorks_2_dead") and HI("ac_pri_a25_poltergeist_1_squad_dead") then
GI("ac_task_1_everyone_dead")
end
end
end
function st_ac_task_1_init_1()
actor_menu.set_msg(1, game.translate_string("st_ac_task_1_1"), 10)
return true
end
function st_ac_task_1_init_2()
actor_menu.set_msg(1, game.translate_string("st_ac_task_1_2"), 10)
return true
end
function st_ac_task_1_init_3()
actor_menu.set_msg(1, game.translate_string("st_ac_task_1_3"), 10)
return true
end
function st_ac_task_1_init_4()
actor_menu.set_msg(1,string.format(game.translate_string("st_ac_task_1_4"), alife():actor():character_name()), 10)
return true
end
function st_ac_task_1_init_5()
actor_menu.set_msg(1, string.format(game.translate_string("st_ac_task_1_5"), alife():actor():character_name()), 10)
GI("ac_blue_winter_task_1_stage_3")
return true
end
function st_ac_task_1_init_6()
actor_menu.set_msg(1, game.translate_string("st_ac_task_1_6"), 10)
return true
end
function task_status_functor.give_task_blue_winter_quest_1_status_f(tsk,task_id)
local pos_1 = vector():set( 65.763290405273,14.580019950867,-133.64477539063 ) --- trigger
local pos_2 = vector():set( 49.821727752686,-0.49124795198441,-177.17810058594 ) --- path 1
local pos_3 = vector():set( -7.3301563262939,-0.17000591754913,-182.1794128418 ) --- path 2
local pos_4 = vector():set( 141.32060241699,-0.096420645713806,-176.77297973633 ) --- spawn squad
local pos_5 = vector():set( -100.89275360107,0.4929051399231,-246.49229431152 ) --- destination
local pos_6 = vector():set( -116.92031860352,-7.8898968696594,-232.40341186523 ) --- trigger assault
local pos_7 = vector():set( -99.864273071289,0.84025031328201,-91.754333496094 ) ---poltergeist trigger
local pos_8 = vector():set( -107.9713973999,4.2113361358643,-101.23147583008 ) ---poltergeist spawn
local dist_1 = 3
local dist_2 = 5
local dist_3 = 20
local dist_4 = 10
local npc = get_story_se_object("ac_task_3_stalker_squad")
local name = alife():actor():character_name()
local se = strformat("%s",name)
local squad = get_story_se_object("ac_blue_winter_squad")
local commander_id = squad and squad:commander_id()
local commander = commander_id and db.storage[commander_id] and db.storage[commander_id].object
local squad_2 = get_story_se_object("ac_melchior_squad")
local commander_id_2 = squad_2 and squad_2:commander_id()
local commander_2 = commander_id_2 and db.storage[commander_id_2] and db.storage[commander_id_2].object
if (tsk.stage == 0) then
if NI("ac_task_3_smart_clear") then
xr_effects.clear_smart_terrain(nil,nil,{"pri_a28_shop","true"})
xr_effects.clear_smart_terrain(nil,nil,{"pri_a28_base","true"})
xr_effects.clear_smart_terrain(nil,nil,{"pri_a15","true"})
xr_effects.clear_smart_terrain(nil,nil,{"pri_b305_dogs","true"})
xr_effects.clear_smart_terrain(nil,nil,{"pri_b35_military","true"})
xr_effects.clear_smart_terrain(nil,nil,{"pri_b35_mercs","true"})
xr_effects.clear_smart_terrain(nil,nil,{"pri_sim_5","true"})
xr_effects.clear_smart_terrain(nil,nil,{"pri_b304_monsters_smart_terrain","true"})
GI("ac_task_3_smart_clear")
end
if (db.actor:position():distance_to(pos_1) < dist_1) then
CreateTimeEvent("ac_task_3_spawn_1","ac_task_3_spawn_1", 5,ac_task_3_spawn_init)
tsk.stage = 1
end
end
if (tsk.stage == 1) then
if HI("ac_task_3_spawn_init") then
if NI("ac_task_3_spawn_done") then
local se_squad = spawn_squad("ac_task_3_stalker_squad", pos_4, 370570, 4922)
GI("ac_task_3_spawn_done")
tsk.stage = 2
end
end
end
if (tsk.stage == 2) then
if NI("ac_task_3_sight_1") then
if npc and (npc.position:distance_to(pos_2) < dist_4) then
local actor_dir = device().cam_dir
local npc_dir = vec_sub(npc:position(),db.actor:position())
local yaw = yaw_degree3d(actor_dir, npc_dir)
if yaw < 35 then
dynamic_news_helper.send_tip(game.translate_string("st_ac_task_3_0"), se, 0, 10, db.actor:character_icon(), nil, "npc")
dynamic_news_helper.send_tip(game.translate_string("st_ac_task_3_1"), commander:character_name(), 5, 10, commander:character_icon(), nil, "npc" )
GI("ac_task_3_sight_1")
end
end
end
if npc and (npc.position:distance_to(pos_2) < dist_2) then
GI("ac_task_3_pos_2")
tsk.stage = 3
end
end
if (tsk.stage == 3) then
if NI("ac_task_3_sight_2") then
if npc and (npc.position:distance_to(pos_3) < dist_2) then
local actor_dir = device().cam_dir
local npc_dir = vec_sub(npc:position(),db.actor:position())
local yaw = yaw_degree3d(actor_dir, npc_dir)
if yaw < 35 then
dynamic_news_helper.send_tip(game.translate_string("st_ac_task_3_2"), se, 0, 10, db.actor:character_icon(), nil, "npc")
dynamic_news_helper.send_tip(game.translate_string("st_ac_task_3_3"), commander:character_name(), 5, 10, commander:character_icon(), nil, "npc" )
dynamic_news_helper.send_tip(game.translate_string("st_ac_task_3_4"), se, 10, 10, db.actor:character_icon(), nil, "npc")
dynamic_news_helper.send_tip(game.translate_string("st_ac_task_3_5"), commander:character_name(), 15, 10, commander:character_icon(), nil, "npc" )
GI("ac_task_3_sight_2")
end
end
end
if npc and (npc.position:distance_to(pos_3) < dist_2) then
GI("ac_task_3_pos_3")
tsk.stage = 4
end
end
if (tsk.stage == 4) then
if NI("ac_task_3_sight_3") then
if npc and (npc.position:distance_to(pos_5) < dist_2) then
local actor_dir = device().cam_dir
local npc_dir = vec_sub(npc:position(),db.actor:position())
local yaw = yaw_degree3d(actor_dir, npc_dir)
if yaw < 35 then
dynamic_news_helper.send_tip(game.translate_string("st_ac_task_3_6"), commander_2:character_name(), 0, 10, commander_2:character_icon(), nil, "npc" )
dynamic_news_helper.send_tip(game.translate_string("st_ac_task_3_7"), commander:character_name(), 5, 10, commander:character_icon(), nil, "npc" )
dynamic_news_helper.send_tip(string.format(game.translate_string("st_ac_task_3_8"), alife():actor():character_name()), commander:character_name(), 7, 10, commander:character_icon(), nil, "npc" )
GI("ac_task_3_sight_3")
end
end
end
if npc and (npc.position:distance_to(pos_5) < dist_3) then
GI("ac_task_3_pos_5")
tsk.stage = 5
end
end
if (tsk.stage == 5) then
CreateTimeEvent("ac_task_3_reloc_1","ac_task_3_reloc_1", 15,ac_task_3_reloc_init)
xr_effects.clear_smart_terrain(nil,nil,{"pri_a21_smart_terrain","true"})
xr_effects.clear_smart_terrain(nil,nil,{"pri_sim_8","true"})
xr_effects.clear_smart_terrain(nil,nil,{"pri_sim_11","true"})
xr_effects.clear_smart_terrain(nil,nil,{"pri_b305_dogs","true"})
xr_effects.clear_smart_terrain(nil,nil,{"pri_sim_4","true"})
xr_effects.clear_smart_terrain(nil,nil,{"pri_sim_5","true"})
tsk.stage = 6
end
if (tsk.stage == 6) then
if HI("ac_task_3_reloc_init") then
if NI("relocated_ac_task_3_blue_winter") then
dialogs_brotherhood_ac.ac_task_3_blue_winter_relocation()
end
if NI("relocated_ac_task_3_balthazar") then
dialogs_brotherhood_ac.ac_task_3_balthazar_relocation()
end
if NI("relocated_ac_task_3_melchior") then
dialogs_brotherhood_ac.ac_task_3_melchior_relocation()
end
if NI("relocated_ac_task_3_caspar") then
dialogs_brotherhood_ac.ac_task_3_caspar_relocation()
end
end
if HI("ac_task_3_convo") then
tsk.stage = 7
end
end
if (tsk.stage == 7) then
if (db.actor:position():distance_to(pos_6) < dist_1) then
if NI("ac_task_3_sight_4") then
dynamic_news_helper.send_tip(game.translate_string("st_ac_task_3_9"), se, 0, 10, db.actor:character_icon(), nil, "npc")
dynamic_news_helper.send_tip(game.translate_string("st_ac_task_3_10"), commander:character_name(), 5, 10, commander:character_icon(), nil, "npc" )
CreateTimeEvent("ac_task_3_assault_1","ac_task_3_assault_1", 5,ac_task_3_assault_init)
GI("ac_task_3_sight_4")
end
end
end
end
function ac_task_3_spawn_init()
GI("ac_task_3_spawn_init")
return true
end
function ac_task_3_reloc_init()
GI("ac_task_3_reloc_init")
return true
end
function ac_task_3_assault_init()
GI("ac_task_3_checkpoint")
return true
end