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

474 lines
16 KiB
Plaintext
Raw Normal View History

---remove spawn zaton_mercenary_1_squad
local HI = has_alife_info
local GI = give_info
local DI = disable_info
function NI(str)
return not (has_alife_info(str))
end
local spawn_squad = dialogs_brotherhood.spawn_squad
------- GENERAL Functions --------
function actor_on_first_update()
marlo_stanfield_init()
chris_partlow_init()
---flavio_becca_init()
---nr_ecologist_rydzyk_init()
---nr_ecologist_1_init()
---nr_ecologist_2_init()
---nr_ecologist_3_init()
vybegallo_init()
sasha_tolstoy_init()
bellerophon_init()
---erast_fandorin_init()
---ac_pri_medic_monolith_init()
end
function on_game_start()
RegisterScriptCallback("actor_on_first_update",actor_on_first_update)
RegisterScriptCallback("npc_on_net_spawn", npc_on_net_spawn_1)
RegisterScriptCallback("npc_on_net_spawn", npc_on_net_spawn_2)
RegisterScriptCallback("npc_on_net_spawn", npc_on_net_spawn_3)
RegisterScriptCallback("npc_on_net_spawn", npc_on_net_spawn_4)
RegisterScriptCallback("npc_on_net_spawn", npc_on_net_spawn_5)
RegisterScriptCallback("npc_on_net_spawn", npc_on_net_spawn_6)
RegisterScriptCallback("npc_on_net_spawn", npc_on_net_spawn_7)
end
function ac_pri_medic_monolith_init()
if (NI("ac_pri_medic_monolith_init")) then
local pos_1 = vector():set( -14.302313804626,0.84455877542496,198.07749938965 )
if not (get_story_se_object("ac_pri_medic_monolith_squad")) then
local se_squad = spawn_squad("ac_pri_medic_monolith_squad", pos_1, 85652, 2985)
end
if (get_story_se_object("ac_pri_medic_monolith_squad")) then
GI("ac_pri_medic_monolith_init")
end
end
end
function marlo_stanfield_init()
if HI("bar_deactivate_radar_done") then
if (NI("marlo_stanfield_init")) then
if not (get_story_se_object("marlo_stanfield")) then
local pos = vector():set( -7.0992422103882,23.103616714478,245.94242858887 )
local se_obj = alife_create( "marlo_stanfield", pos, 703991, 4556 )
end
if (get_story_se_object("marlo_stanfield")) then
GI("marlo_stanfield_init")
end
end
end
end
function chris_partlow_init()
if HI("bar_deactivate_radar_done") then
if (NI("chris_partlow_init")) then
if not (get_story_se_object("chris_partlow")) then
local pos = vector():set( -9.5265302658081,23.103614807129,245.18560791016 )
local se_obj = alife_create( "chris_partlow", pos, 699550, 4556 )
end
if (get_story_se_object("chris_partlow")) then
GI("chris_partlow_init")
end
end
end
end
function bellerophon_init()
if (NI("bellerophon_init")) then
if not (get_story_se_object("bellerophon_squad")) then
local smart = SIMBOARD.smarts_by_names["gar_smart_terrain_3_5"]
local squad = SIMBOARD:create_squad(smart,"bellerophon_squad")
end
if (get_story_se_object("bellerophon_squad")) then
GI("bellerophon_init")
end
end
end
function erast_fandorin_init()
if (NI("erast_fandorin_init")) then
if not (get_story_se_object("erast_fandorin_squad")) then
local smart = SIMBOARD.smarts_by_names["yan_smart_terrain_6_4"]
local squad = SIMBOARD:create_squad(smart,"erast_fandorin_squad")
end
if (get_story_se_object("erast_fandorin_squad")) then
GI("erast_fandorin_init")
end
end
end
function flavio_becca_init()
if (NI("flavio_becca_init")) then
if not (get_story_se_object("flavio_becca_squad")) then
local smart = SIMBOARD.smarts_by_names["jup_b41"]
local squad = SIMBOARD:create_squad(smart,"flavio_becca_squad")
end
if (get_story_se_object("flavio_becca_squad")) then
GI("flavio_becca_init")
end
end
end
function nr_ecologist_rydzyk_init()
if (NI("nr_ecologist_rydzyk_init")) then
if not (get_story_se_object("nr_ecologist_rydzyk_squad")) then
local smart = SIMBOARD.smarts_by_names["yan_smart_terrain_6_4"]
local squad = SIMBOARD:create_squad(smart,"nr_ecologist_rydzyk_squad")
end
if (get_story_se_object("nr_ecologist_rydzyk_squad")) then
GI("nr_ecologist_rydzyk_init")
end
end
end
function nr_ecologist_1_init()
if (NI("nr_ecologist_1_init")) then
if not (get_story_se_object("nr_ecologist_1_squad")) then
local smart = SIMBOARD.smarts_by_names["yan_smart_terrain_6_4"]
local squad = SIMBOARD:create_squad(smart,"nr_ecologist_1_squad")
end
if (get_story_se_object("nr_ecologist_1_squad")) then
GI("nr_ecologist_1_init")
end
end
end
function nr_ecologist_2_init()
if (NI("nr_ecologist_2_init")) then
if not (get_story_se_object("nr_ecologist_2_squad")) then
local smart = SIMBOARD.smarts_by_names["yan_smart_terrain_6_4"]
local squad = SIMBOARD:create_squad(smart,"nr_ecologist_2_squad")
end
if (get_story_se_object("nr_ecologist_2_squad")) then
GI("nr_ecologist_2_init")
end
end
end
function nr_ecologist_3_init()
if (NI("nr_ecologist_3_init")) then
if not (get_story_se_object("nr_ecologist_3_squad")) then
local smart = SIMBOARD.smarts_by_names["jup_b41"]
local squad = SIMBOARD:create_squad(smart,"nr_ecologist_3_squad")
end
if (get_story_se_object("nr_ecologist_3_squad")) then
GI("nr_ecologist_3_init")
end
end
end
function sasha_tolstoy_init()
if (NI("sasha_tolstoy_init")) then
if not (get_story_se_object("sasha_tolstoy_squad")) then
local smart = SIMBOARD.smarts_by_names["mar_smart_terrain_base"]
local squad = SIMBOARD:create_squad(smart,"sasha_tolstoy_squad")
end
if (get_story_se_object("sasha_tolstoy_squad")) then
GI("sasha_tolstoy_init")
end
end
end
function vybegallo_init()
if (NI("vybegallo_init")) then
if not (get_story_se_object("vybegallo_squad")) then
local smart = SIMBOARD.smarts_by_names["agr_smart_terrain_4_4"]
local squad = SIMBOARD:create_squad(smart,"vybegallo_squad")
end
if (get_story_se_object("vybegallo_squad")) then
GI("vybegallo_init")
end
end
end
function zaton_mercenary_1_init()
if (NI("zaton_mercenary_1_init")) then
if not (get_story_se_object("zaton_mercenary_1_squad")) then
local smart = SIMBOARD.smarts_by_names["zat_b40_smart_terrain"]
local squad = SIMBOARD:create_squad(smart,"zaton_mercenary_1_squad")
end
if (get_story_se_object("zaton_mercenary_1_squad")) then
GI("zaton_mercenary_1_init")
end
end
end
function npc_on_net_spawn_1(npc,se_obj)
local chris_partlow = get_story_object("chris_partlow")
if chris_partlow and npc:id() == chris_partlow:id() then
setup_npc_logic_brotherhood_1()
end
end
function npc_on_net_spawn_2(npc,se_obj)
local marlo_stanfield = get_story_object("marlo_stanfield")
if marlo_stanfield and npc:id() == marlo_stanfield:id() then
setup_npc_logic_brotherhood_2()
end
end
function setup_npc_logic_brotherhood_1()
local npc = get_story_object("chris_partlow")
npc:give_info_portion("npc_not_move")
local ltx_name = "scripts\\brotherhood_npc_control_chris.ltx"
local ltx = ini_file(ltx_name)
if not (ltx) then
log("ERROR: do not have access to scripts\\brotherhood_npc_control_chris.ltx! Make sure you installed properly!")
return
end
local id = npc:id()
local sim = alife()
local se_npc = sim:object(id)
local unreg_id = se_npc and se_npc.m_smart_terrain_id
if (unreg_id and unreg_id ~= 65535) then
local unreg = sim:object(unreg_id)
if (unreg) then
unreg:unregister_npc(se_npc)
end
end
xr_logic.configure_schemes(npc, ltx, ltx_name, modules.stype_stalker, loaded and st.loaded_section_logic or "logic", "")
local section = loaded and st.loaded_active_section or xr_logic.determine_section_to_activate(npc, ltx, "logic", db.actor)
xr_logic.activate_by_section(npc, ltx, section, "", loaded)
--printf("setup complete")
end
function setup_npc_logic_brotherhood_2()
local npc = get_story_object("marlo_stanfield")
npc:give_info_portion("npc_not_move")
local ltx_name = "scripts\\brotherhood_npc_control_marlo.ltx"
local ltx = ini_file(ltx_name)
if not (ltx) then
log("ERROR: do not have access to scripts\\brotherhood_npc_control.ltx! Make sure you installed properly!")
return
end
local id = npc:id()
local sim = alife()
local se_npc = sim:object(id)
local unreg_id = se_npc and se_npc.m_smart_terrain_id
if (unreg_id and unreg_id ~= 65535) then
local unreg = sim:object(unreg_id)
if (unreg) then
unreg:unregister_npc(se_npc)
end
end
xr_logic.configure_schemes(npc, ltx, ltx_name, modules.stype_stalker, loaded and st.loaded_section_logic or "logic", "")
local section = loaded and st.loaded_active_section or xr_logic.determine_section_to_activate(npc, ltx, "logic", db.actor)
xr_logic.activate_by_section(npc, ltx, section, "", loaded)
--printf("setup complete")
end
function npc_on_net_spawn_3(npc,se_obj)
local nr_ambush_1 = get_story_object("nr_ambush_1")
if nr_ambush_1 and npc:id() == nr_ambush_1:id() then
setup_nr_ambush_logic_brotherhood_1()
end
end
function npc_on_net_spawn_4(npc,se_obj)
local nr_ambush_2 = get_story_object("nr_ambush_2")
if nr_ambush_2 and npc:id() == nr_ambush_2:id() then
setup_nr_ambush_logic_brotherhood_2()
end
end
function npc_on_net_spawn_5(npc,se_obj)
local nr_ambush_3 = get_story_object("nr_ambush_3")
if nr_ambush_3 and npc:id() == nr_ambush_3:id() then
setup_nr_ambush_logic_brotherhood_3()
end
end
function npc_on_net_spawn_6(npc,se_obj)
local nr_ambush_4 = get_story_object("nr_ambush_4")
if nr_ambush_4 and npc:id() == nr_ambush_4:id() then
setup_nr_ambush_logic_brotherhood_4()
end
end
function npc_on_net_spawn_7(npc,se_obj)
local nr_ambush_5 = get_story_object("nr_ambush_5")
if nr_ambush_5 and npc:id() == nr_ambush_5:id() then
setup_nr_ambush_logic_brotherhood_5()
end
end
function setup_nr_ambush_logic_brotherhood_1()
local npc = get_story_object("nr_ambush_1")
npc:give_info_portion("npc_not_move")
local ltx_name = "scripts\\brotherhood\\brotherhood_npc_nr_ambush_logic_1.ltx"
local ltx = ini_file(ltx_name)
if not (ltx) then
log("ERROR: do not have access to scripts\\brotherhood\\brotherhood_npc_nr_ambush_logic_1! Make sure you installed properly!")
return
end
local id = npc:id()
local sim = alife()
local se_npc = sim:object(id)
local unreg_id = se_npc and se_npc.m_smart_terrain_id
if (unreg_id and unreg_id ~= 65535) then
local unreg = sim:object(unreg_id)
if (unreg) then
unreg:unregister_npc(se_npc)
end
end
xr_logic.configure_schemes(npc, ltx, ltx_name, modules.stype_stalker, loaded and st.loaded_section_logic or "logic", "")
local section = loaded and st.loaded_active_section or xr_logic.determine_section_to_activate(npc, ltx, "logic", db.actor)
xr_logic.activate_by_section(npc, ltx, section, "", loaded)
--printf("setup complete")
end
function setup_nr_ambush_logic_brotherhood_2()
local npc = get_story_object("nr_ambush_2")
npc:give_info_portion("npc_not_move")
local ltx_name = "scripts\\brotherhood\\brotherhood_npc_nr_ambush_logic_2.ltx"
local ltx = ini_file(ltx_name)
if not (ltx) then
log("ERROR: do not have access to scripts\\brotherhood_npc_nr_ambush_logic.ltx! Make sure you installed properly!")
return
end
local id = npc:id()
local sim = alife()
local se_npc = sim:object(id)
local unreg_id = se_npc and se_npc.m_smart_terrain_id
if (unreg_id and unreg_id ~= 65535) then
local unreg = sim:object(unreg_id)
if (unreg) then
unreg:unregister_npc(se_npc)
end
end
xr_logic.configure_schemes(npc, ltx, ltx_name, modules.stype_stalker, loaded and st.loaded_section_logic or "logic", "")
local section = loaded and st.loaded_active_section or xr_logic.determine_section_to_activate(npc, ltx, "logic", db.actor)
xr_logic.activate_by_section(npc, ltx, section, "", loaded)
--printf("setup complete")
end
function setup_nr_ambush_logic_brotherhood_3()
local npc = get_story_object("nr_ambush_3")
npc:give_info_portion("npc_not_move")
local ltx_name = "scripts\\brotherhood\\brotherhood_npc_nr_ambush_logic_3.ltx"
local ltx = ini_file(ltx_name)
if not (ltx) then
log("ERROR: do not have access to scripts\\brotherhood_npc_nr_ambush_logic.ltx! Make sure you installed properly!")
return
end
local id = npc:id()
local sim = alife()
local se_npc = sim:object(id)
local unreg_id = se_npc and se_npc.m_smart_terrain_id
if (unreg_id and unreg_id ~= 65535) then
local unreg = sim:object(unreg_id)
if (unreg) then
unreg:unregister_npc(se_npc)
end
end
xr_logic.configure_schemes(npc, ltx, ltx_name, modules.stype_stalker, loaded and st.loaded_section_logic or "logic", "")
local section = loaded and st.loaded_active_section or xr_logic.determine_section_to_activate(npc, ltx, "logic", db.actor)
xr_logic.activate_by_section(npc, ltx, section, "", loaded)
--printf("setup complete")
end
function setup_nr_ambush_logic_brotherhood_4()
local npc = get_story_object("nr_ambush_4")
npc:give_info_portion("npc_not_move")
local ltx_name = "scripts\\brotherhood\\brotherhood_npc_nr_ambush_logic_4.ltx"
local ltx = ini_file(ltx_name)
if not (ltx) then
log("ERROR: do not have access to scripts\\brotherhood_npc_nr_ambush_logic.ltx! Make sure you installed properly!")
return
end
local id = npc:id()
local sim = alife()
local se_npc = sim:object(id)
local unreg_id = se_npc and se_npc.m_smart_terrain_id
if (unreg_id and unreg_id ~= 65535) then
local unreg = sim:object(unreg_id)
if (unreg) then
unreg:unregister_npc(se_npc)
end
end
xr_logic.configure_schemes(npc, ltx, ltx_name, modules.stype_stalker, loaded and st.loaded_section_logic or "logic", "")
local section = loaded and st.loaded_active_section or xr_logic.determine_section_to_activate(npc, ltx, "logic", db.actor)
xr_logic.activate_by_section(npc, ltx, section, "", loaded)
--printf("setup complete")
end
function setup_nr_ambush_logic_brotherhood_5()
local npc = get_story_object("nr_ambush_5")
npc:give_info_portion("npc_not_move")
local ltx_name = "scripts\\brotherhood\\brotherhood_npc_nr_ambush_logic_5.ltx"
local ltx = ini_file(ltx_name)
if not (ltx) then
log("ERROR: do not have access to scripts\\brotherhood_npc_nr_ambush_logic.ltx! Make sure you installed properly!")
return
end
local id = npc:id()
local sim = alife()
local se_npc = sim:object(id)
local unreg_id = se_npc and se_npc.m_smart_terrain_id
if (unreg_id and unreg_id ~= 65535) then
local unreg = sim:object(unreg_id)
if (unreg) then
unreg:unregister_npc(se_npc)
end
end
xr_logic.configure_schemes(npc, ltx, ltx_name, modules.stype_stalker, loaded and st.loaded_section_logic or "logic", "")
local section = loaded and st.loaded_active_section or xr_logic.determine_section_to_activate(npc, ltx, "logic", db.actor)
xr_logic.activate_by_section(npc, ltx, section, "", loaded)
--printf("setup complete")
end