230 lines
7.4 KiB
Plaintext
230 lines
7.4 KiB
Plaintext
|
|
||
|
local HI = has_alife_info
|
||
|
local GI = give_info
|
||
|
local DI = disable_info
|
||
|
function NI(str)
|
||
|
return not (has_alife_info(str))
|
||
|
end
|
||
|
|
||
|
function create_squad(smart_name,section)
|
||
|
local smart = SIMBOARD.smarts_by_names[smart_name]
|
||
|
if (smart and not get_story_se_object(section)) then
|
||
|
SIMBOARD:create_squad(smart,section)
|
||
|
end
|
||
|
return get_story_se_object(section)
|
||
|
end
|
||
|
|
||
|
function kill_common_enemy(enemy,npc,p)
|
||
|
if (xr_conditions.is_enemy_actor_or_companion(enemy,npc,p)) then
|
||
|
return
|
||
|
end
|
||
|
if (get_object_story_id(enemy:id())) then
|
||
|
return
|
||
|
end
|
||
|
local squad = get_object_squad(enemy)
|
||
|
if (squad and squad.common and (not get_object_story_id(squad.id))) then
|
||
|
local function itr(npc_id,ene_id)
|
||
|
local obj = npc_id and level.object_by_id(npc_id)
|
||
|
local ene = ene_id and level.object_by_id(ene_id)
|
||
|
if (obj and obj:alive() and ene and ene:alive()) then
|
||
|
local h = hit()
|
||
|
h.power = 1
|
||
|
h.direction = vector():set(0,-1,0)
|
||
|
h.bone = "bip01_spine"
|
||
|
h.draftsman = obj
|
||
|
h.impulse = 0
|
||
|
h.type = hit.wound
|
||
|
ene:hit(h)
|
||
|
end
|
||
|
return true
|
||
|
end
|
||
|
CreateTimeEvent(npc:id(),"kill_common_enemy" .. enemy:id(),0,itr,npc:id(),enemy:id())
|
||
|
end
|
||
|
end
|
||
|
|
||
|
function actor_sprint(actor,npc,p)
|
||
|
if (IsMoveState("mcSprint")) then
|
||
|
return true
|
||
|
end
|
||
|
return false
|
||
|
end
|
||
|
|
||
|
function ray_cast_to_actor_le(actor,npc,p)
|
||
|
local act_pos = db.actor and db.actor:position()
|
||
|
local npc_pos = npc and npc:position()
|
||
|
if (act_pos and npc_pos and tonumber(p[1])) then
|
||
|
local dir = vector():set((act_pos):sub(npc_pos)):normalize()
|
||
|
local pick = ray_pick()
|
||
|
pick:set_position(vector():set(npc_pos.x,npc_pos.y+0.5,npc_pos.z))
|
||
|
pick:set_direction(dir)
|
||
|
pick:set_ignore_object(db.actor)
|
||
|
pick:set_flags(2)
|
||
|
pick:set_range(tonumber(p[1])+5)
|
||
|
pick:query()
|
||
|
local distance = pick:get_distance()
|
||
|
if (distance and (distance < tonumber(p[1]))) then
|
||
|
return true
|
||
|
end
|
||
|
end
|
||
|
return false
|
||
|
end
|
||
|
|
||
|
--[[----------------------------------------------------------------------------------------------------
|
||
|
Quests
|
||
|
------------------------------------------------------------------------------------------------------]]
|
||
|
function lure_prey_init()
|
||
|
if (NI("me_lure_prey_init")) then
|
||
|
local smart = SIMBOARD.smarts_by_names["rad2_prip_teleport"]
|
||
|
if (smart) then
|
||
|
SIMBOARD:create_squad(smart,"squad_lure_prey_controller_1")
|
||
|
SIMBOARD:create_squad(smart,"squad_lure_prey_phantom")
|
||
|
|
||
|
local p = vector():set(663.0,-43.60,169.5)
|
||
|
alife():create("merc_outfit",vec_add(p,vector():set(-0.2,0.0,0.0)),smart.m_level_vertex_id,smart.m_game_vertex_id)
|
||
|
alife():create("helm_m40",vec_add(p,vector():set(-0.2,0.0,0.4)),smart.m_level_vertex_id,smart.m_game_vertex_id)
|
||
|
alife():create("wpn_lr300",vec_add(p,vector():set(0.2,0.0,0.0)),smart.m_level_vertex_id,smart.m_game_vertex_id)
|
||
|
alife():create("ammo_5.56x45_fmj",vec_add(p,vector():set(0.6,0.0,0.3)),smart.m_level_vertex_id,smart.m_game_vertex_id)
|
||
|
alife():create("ammo_5.56x45_fmj",vec_add(p,vector():set(0.6,0.0,0.1)),smart.m_level_vertex_id,smart.m_game_vertex_id)
|
||
|
alife():create("ammo_5.56x45_fmj",vec_add(p,vector():set(0.6,0.0,-0.1)),smart.m_level_vertex_id,smart.m_game_vertex_id)
|
||
|
alife():create("ammo_5.56x45_fmj",vec_add(p,vector():set(0.4,0.0,0.3)),smart.m_level_vertex_id,smart.m_game_vertex_id)
|
||
|
alife():create("ammo_5.56x45_fmj",vec_add(p,vector():set(0.4,0.0,0.1)),smart.m_level_vertex_id,smart.m_game_vertex_id)
|
||
|
alife():create("ammo_5.56x45_fmj",vec_add(p,vector():set(0.4,0.0,-0.1)),smart.m_level_vertex_id,smart.m_game_vertex_id)
|
||
|
alife():create("grenade_f1",vec_add(p,vector():set(0.6,0.0,-0.3)),smart.m_level_vertex_id,smart.m_game_vertex_id)
|
||
|
alife():create("grenade_f1",vec_add(p,vector():set(0.6,0.0,-0.3)),smart.m_level_vertex_id,smart.m_game_vertex_id)
|
||
|
end
|
||
|
GI("me_lure_prey_init")
|
||
|
end
|
||
|
end
|
||
|
|
||
|
function lure_prey_before_hit(npc,shit,bone_id,flags)
|
||
|
if (shit.draftsman and (shit.draftsman:id() == AC_ID)) then
|
||
|
if (NI("me_lure_prey_argo")) then
|
||
|
GI("me_lure_prey_argo")
|
||
|
end
|
||
|
return
|
||
|
end
|
||
|
flags.ret_value = false
|
||
|
end
|
||
|
|
||
|
function lure_prey_set_stalker(actor,npc,p)
|
||
|
if (db.actor and npc) then
|
||
|
local com_1 = db.actor:character_community()
|
||
|
local com_2 = npc:character_community()
|
||
|
if (com_1 and com_2 and not string.find(com_1,com_2)) then
|
||
|
local str = string.gsub(com_1,"actor_","")
|
||
|
npc:set_character_community(str)
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
|
||
|
--[[----------------------------------------------------------------------------------------------------
|
||
|
------------------------------------------------------------------------------------------------------]]
|
||
|
function bloodsucker_val_init()
|
||
|
if (NI("me_bloodsucker_val_init")) then
|
||
|
local smart = SIMBOARD.smarts_by_names["val_smart_terrain_1_2"]
|
||
|
if (smart) then
|
||
|
SIMBOARD:create_squad(smart,"squad_bloodsucker_val_1")
|
||
|
SIMBOARD:create_squad(smart,"squad_bloodsucker_val_2")
|
||
|
SIMBOARD:create_squad(smart,"squad_bloodsucker_val_3")
|
||
|
end
|
||
|
GI("me_bloodsucker_val_init")
|
||
|
end
|
||
|
end
|
||
|
|
||
|
function bloodsucker_val_actor_sprint(actor,npc,p)
|
||
|
if not (IsMoveState("mcSprint")) then
|
||
|
return false
|
||
|
end
|
||
|
|
||
|
local pos = db.actor and db.actor:position()
|
||
|
if not (pos) then
|
||
|
return false
|
||
|
end
|
||
|
|
||
|
if not (170 < pos.x and pos.x < 177) then
|
||
|
return false
|
||
|
end
|
||
|
if not (-280 < pos.z and pos.z < -263) then
|
||
|
return false
|
||
|
end
|
||
|
return true
|
||
|
end
|
||
|
|
||
|
function bloodsucker_val_dead(actor,obj,p)
|
||
|
if (obj) then
|
||
|
local sec = {"squad_bloodsucker_val_1","squad_bloodsucker_val_2","squad_bloodsucker_val_3"}
|
||
|
for i,v in pairs (sec) do
|
||
|
if (string.find(obj:section_name(),v)) then
|
||
|
for ii,vv in pairs(sec) do
|
||
|
if (not string.find(obj:section_name(),vv) and get_story_se_object(vv)) then
|
||
|
return
|
||
|
end
|
||
|
end
|
||
|
if (NI("me_bloodsucker_val_dead")) then
|
||
|
GI("me_bloodsucker_val_dead")
|
||
|
end
|
||
|
return
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
|
||
|
--[[----------------------------------------------------------------------------------------------------
|
||
|
------------------------------------------------------------------------------------------------------]]
|
||
|
function sleeping_snork_init()
|
||
|
if (NI("me_sleeping_snork_init")) then
|
||
|
create_squad("jup_b47","squad_sleeping_bloodsucker_jup_1")
|
||
|
create_squad("jup_b47","squad_sleeping_bloodsucker_jup_2")
|
||
|
--create_squad("jup_b47","squad_sleeping_bloodsucker_jup_3")
|
||
|
GI("me_sleeping_snork_init")
|
||
|
end
|
||
|
end
|
||
|
|
||
|
|
||
|
--[[----------------------------------------------------------------------------------------------------
|
||
|
Registers
|
||
|
------------------------------------------------------------------------------------------------------]]
|
||
|
function actor_on_first_update()
|
||
|
lure_prey_init()
|
||
|
bloodsucker_val_init()
|
||
|
end
|
||
|
|
||
|
function on_game_start()
|
||
|
RegisterScriptCallback("actor_on_first_update",actor_on_first_update)
|
||
|
end
|
||
|
|
||
|
|
||
|
--[[----------------------------------------------------------------------------------------------------
|
||
|
Debug
|
||
|
------------------------------------------------------------------------------------------------------]]
|
||
|
--[[
|
||
|
cmd = debug_cmd_list.command_get_list()
|
||
|
|
||
|
function cmd.misc1()
|
||
|
lure_prey_init()
|
||
|
story_mercenary_leader()
|
||
|
end
|
||
|
|
||
|
function cmd.misc2()
|
||
|
bloodsucker_val_init()
|
||
|
end
|
||
|
function cmd.misc2kill1()
|
||
|
xr_effects.kill_squad(nil,nil,{"squad_bloodsucker_val_1"})
|
||
|
end
|
||
|
function cmd.misc2kill2()
|
||
|
xr_effects.kill_squad(nil,nil,{"squad_bloodsucker_val_2"})
|
||
|
end
|
||
|
function cmd.misc2kill3()
|
||
|
xr_effects.kill_squad(nil,nil,{"squad_bloodsucker_val_3"})
|
||
|
end
|
||
|
|
||
|
function cmd.misc3()
|
||
|
sleeping_snork_init()
|
||
|
end
|
||
|
function cmd.misc3kill()
|
||
|
xr_effects.kill_squad(nil,nil,{"squad_sleeping_snork_1"})
|
||
|
xr_effects.kill_squad(nil,nil,{"squad_sleeping_snork_2"})
|
||
|
xr_effects.kill_squad(nil,nil,{"squad_sleeping_snork_3"})
|
||
|
end
|
||
|
|
||
|
--]]
|