Вариант без таймеров (время работы, бездействия). Готовый спавн аномалий на локации "Затон" в количестве 150 штук
function spawn_zaton_anomalies(zaton_anomalies_sect)
for i=1,150 do
local anomalies = {"zone_mine_acidic_weak","zone_mine_acidic_average","zone_mine_acidic_strong",
"zone_mine_acidic_big","zone_mine_chemical_weak","zone_mine_chemical_average","zone_mine_chemical_strong",
"zone_buzz_weak","zone_buzz_average","zone_buzz_strong","zone_mine_electric_weak","zone_mine_electric_average",
"zone_mine_electric_strong","zone_witches_galantine_weak","zone_witches_galantine_average","zone_witches_galantine_strong",
"zone_mine_gravitational_average","zone_mine_gravitational_weak","zone_mine_gravitational_big","zone_gravi_zone",
"zone_mine_thermal_weak","zone_mine_thermal_average","zone_mine_thermal_strong","zone_mine_steam_weak",
"zone_mine_steam_average","zone_mine_steam_strong","zone_zharka_static_weak","zone_zharka_static_average",
"zone_zharka_static_strong"}
local zaton_anomalies_sect = anomalies[math.random(#anomalies)]
z_anom(zaton_anomalies_sect)
end
end
function z_anom(zaton_anomalies_sectt)
lv_new = math.random(1700000)
pos_new = level.vertex_position(lv_new)
create_anomalies(zaton_anomalies_sectt,3,pos_new.x,pos_new.y,pos_new.z,lv_new,0)
end
function create_anomalies(section,rad_anom,x,y,z,lv,gv,mode)
if gv==nil then gv=db.actor:game_vertex_id() end
if lv==nil then lv=db.actor:level_vertex_id() end
if pos==nil then pos=db.actor:position() end
local p_obj = alife():create(section,vector():set(x,y,z),lv,gv)
local packet = net_packet()
packet:w_begin(0)
p_obj:STATE_Write(packet)
packet:r_seek(2)
local game_vertex_id = packet:r_u16()
local cse_alife_object__unk1_f32 = packet:r_float()
local cse_alife_object__unk2_u32 = packet:r_s32()
local level_vertex_id = packet:r_s32()
local object_flags = packet:r_s32()
local custom_data = packet:r_stringZ()
local story_id = packet:r_s32()
local cse_alife_object__unk3_u32 = packet:r_s32()
local shape_count = packet:r_u8()
for i=1,shape_count do
local shape_type = packet:r_u8()
if shape_type == 0 then
local center = packet:r_vec3()
local radius = packet:r_float()
else
local box = packet:r_matrix()
end
end
local restrictor_type = packet:r_u8()
local cse_alife_custom_zone__unk1_f32 = packet:r_float()
local cse_alife_custom_zone__unk2_u32 = packet:r_s32()
local on_off_mode_enabled_time = packet:r_s32()
local on_off_mode_disabled_time = packet:r_s32()
local on_off_mode_shift_time = packet:r_s32()
local offline_interactive_radius = packet:r_float()
local artefact_spawn_places_count = packet:r_u16()
local cse_alife_anomalous_zone__unk1_u32 = packet:r_s32()
local last_spawn_time_present = packet:r_u8()
packet:w_u16(game_vertex_id)
packet:w_float(cse_alife_object__unk1_f32)
packet:w_s32(cse_alife_object__unk2_u32)
packet:w_s32(level_vertex_id)
packet:w_s32(object_flags)
if mode~=nil then custom_data = mode end
packet:w_stringZ(custom_data)
packet:w_s32(story_id)
packet:w_s32(cse_alife_object__unk3_u32)
packet:w_u8(1)
packet:w_u8(0)
local sphere_center = vector()
sphere_center:set(0, 0, 0)
packet:w_vec3(sphere_center)
radius = rad_anom
packet:w_float(radius)
packet:w_u8(restrictor_type)
packet:w_float(cse_alife_custom_zone__unk1_f32)
cse_alife_custom_zone__unk2_u32 = bit_not(0)
packet:w_s32(cse_alife_custom_zone__unk2_u32)
packet:w_s32(on_off_mode_enabled_time)
packet:w_s32(on_off_mode_disabled_time)
packet:w_s32(on_off_mode_shift_time)
packet:w_float(offline_interactive_radius)
packet:w_u16(artefact_spawn_places_count)
packet:w_s32(cse_alife_anomalous_zone__unk1_u32)
if mode == nil then
packet:w_u8(last_spawn_time_present)
end
p_obj:STATE_Read(packet, packet:w_tell()-packet:r_tell())
return p_obj
end
Вариант с таймерами
function create_anom(section,rad_anom,x,y,z,lv,gv,mode,time1,time2)
if gv==nil then gv=db.actor:game_vertex_id() end
if lv==nil then lv=db.actor:level_vertex_id() end
if pos==nil then pos=db.actor:position() end
local p_obj = alife():create(section,vector():set(x,y,z),lv,gv)
local packet = net_packet()
packet:w_begin(0)
p_obj:STATE_Write(packet)
packet:r_seek(2)
local game_vertex_id = packet:r_u16()
local cse_alife_object__unk1_f32 = packet:r_float()
local cse_alife_object__unk2_u32 = packet:r_s32()
local level_vertex_id = packet:r_s32()
local object_flags = packet:r_s32()
local custom_data = packet:r_stringZ()
local story_id = packet:r_s32()
local cse_alife_object__unk3_u32 = packet:r_s32()
local shape_count = packet:r_u8()
for i=1,shape_count do
local shape_type = packet:r_u8()
if shape_type == 0 then
local center = packet:r_vec3()
local radius = packet:r_float()
else
local box = packet:r_matrix()
end
end
local restrictor_type = packet:r_u8()
local cse_alife_custom_zone__unk1_f32 = packet:r_float()
local cse_alife_custom_zone__unk2_u32 = packet:r_s32()
local on_off_mode_enabled_time = packet:r_s32()
local on_off_mode_disabled_time = packet:r_s32()
local on_off_mode_shift_time = packet:r_s32()
local offline_interactive_radius = packet:r_float()
local artefact_spawn_places_count = packet:r_u16()
local cse_alife_anomalous_zone__unk1_u32 = packet:r_s32()
local last_spawn_time_present = packet:r_u8()
packet:w_u16(game_vertex_id)
packet:w_float(cse_alife_object__unk1_f32)
packet:w_s32(cse_alife_object__unk2_u32)
packet:w_s32(level_vertex_id)
packet:w_s32(object_flags)
if mode~=nil then custom_data = mode end
packet:w_stringZ(custom_data)
packet:w_s32(story_id)
packet:w_s32(cse_alife_object__unk3_u32)
packet:w_u8(1)
packet:w_u8(0)
local sphere_center = vector()
sphere_center:set(0, 0, 0)
packet:w_vec3(sphere_center)
radius = rad_anom
packet:w_float(radius)
packet:w_u8(restrictor_type)
packet:w_float(cse_alife_custom_zone__unk1_f32)
cse_alife_custom_zone__unk2_u32 = bit_not(0)
packet:w_s32(cse_alife_custom_zone__unk2_u32)
if time1 ~= nil then
packet:w_s32(time1)
else
packet:w_s32(on_off_mode_enabled_time)
end
if time2 ~= nil then
packet:w_s32(time2)
else
packet:w_s32(on_off_mode_disabled_time)
end
packet:w_s32(on_off_mode_shift_time)
packet:w_float(offline_interactive_radius)
packet:w_u16(artefact_spawn_places_count)
packet:w_s32(cse_alife_anomalous_zone__unk1_u32)
if mode==nil then
packet:w_u8(last_spawn_time_present)
else
end
p_obj:STATE_Read(packet, packet:w_tell()-packet:r_tell())
return p_obj
end
section - секция аномалии из конфигов
rad_anom - радиус аномалии (3 норма)
x - перваяя координата х
y - вторая координата у
z - третья координата z
lv - Level vertex
gv - Game vertex
mode - если используете поля, то нужно писать "filed", если обычные аномалии то nil
time1 - время работы в мс (1 с = 1000 мс)
time2 - время неработы в мс (1 с = 1000 мс)
если постоянно, то в обоих ставте nil