you mean... the script.lua? Well the code is given by Fapdarklord, so all i do was copy paste, here is the code
function FollowUnit()
local new_objective
local valid_criminals = {}
for pl_key, pl_record in pairs( managers.groupai:state():all_player_criminals() ) do
if pl_record.status ~= "dead" then
table.insert( valid_criminals, pl_key )
end
end
if #valid_criminals > 0 then
local follow_unit = managers.groupai:state():all_player_criminals()[ valid_criminals[ math.random( #valid_criminals ) ] ].unit -- pick a random player
new_objective = {
type = "follow",
follow_unit = follow_unit,
scan = true,
is_default = true
}
end
return new_objective
end
function SpawnMob()
local spawn_point = managers.network:game():get_next_spawn_point()
local spawn_pos = spawn_point.pos_rot[1]
local spawn_rot = spawn_point.pos_rot[2]
local unit_name = Idstring( "units/payday2/characters/ene_spook_1/ene_spook_1" )
local myobjective = FollowUnit()
local spawn_ai = {
init_state = "idle",
objective = myobjective
}
local unit = World:spawn_unit( unit_name, spawn_pos, spawn_rot )
unit:movement():set_character_anim_variables()
end
Im not sure if there is any missing cause im really clueless in this thing