Перейти к контенту

Скриптование


Svoboда

Рекомендуемые сообщения

(изменено)

Здравствуйте,я сегодня в сталкер тч,создал персонажа,прописал его параметры,записал в npc_profile;зарегал его в spawn_sections.Зашёл в игру,записал координаты(туды я его поставлю)создал скрипт,а в нём прописал:

alife():create("gar_bandit",vector():set(-209.08,-18.8,-155.46),43935,50)

end

 

уже раз 7 начинал игру а персонажа там нет,хотя и пробовал его заспавнить через повелителя зоны-заспавнился....

Помогите сделать так,чтоб он появился на месте указанном в скрипте.

Редактировал:character_desc_escape,spawn_sections,npc_profile;cоздал скрипт new_stalkers с кодом (alife():create("gar_bandit",vector():set(-209.08,-18.8,-155.46),43935,50)

end)

Изменено пользователем stalker19965

Поделиться этим сообщением


Ссылка на сообщение
(изменено)

Здравствуйте.Персонажа я заспавнил,прописал ему вэйпоинты в скрипте all.spawn,Но игрок ходит по базе где попало,а по моему пути не ходит.Вот профиль:

<specific_character id="ross_6" team_default = "1">

<name>GENERATE_NAME_stalker</name>

<icon>ui_npc_u_stalker_ki_antigas</icon>

<bio>Солдат группировки РОСС</bio>

 

<class>ross_6</class>

<community>ross</community> <terrain_sect>stalker_ross_terrain</terrain_sect>

 

<rank>599</rank>

<reputation>209</reputation>

 

<snd_config>characters_voice\human_03\newbie\</snd_config>

<crouch_type>0</crouch_type>

 

<visual>actors\neytral\stalker_neytral_exoskeleton</visual>

<supplies>

[spawn] \n

 

</supplies>

wpn_fn2000 \n

#include "gameplay\character_criticals_4.xml"

#include "gameplay\character_dialogs.xml"

<start_dialog>hello_dialog</start_dialog>

<actor_dialog>jup_a6_duty_leader_about_you</actor_dialog>

</specific_character>

 

 

npc_profile:

<character id="ross_6">

<class>ross_6</class>

</character>

 

spawn_sections:

[ross_6]:stalker

$spawn = "respawn\ross_6"

character_profile = ross_6

spec_rank = master

community = ross

custom_data = scripts\ross_6.ltx

 

 

спавн игрока через all.spawn:

[870]

; cse_abstract properties

section_name = stalker

name = ross6

position = -209.08,-18.8,-155.46

direction = 0,0,0

 

; cse_alife_trader_abstract properties

money = 5000

character_profile = ross_6

 

; cse_alife_object properties

game_vertex_id = 50

distance = 4.90000009536743

level_vertex_id = 43935

object_flags = 0xffffffbf

custom_data = <<END

[logic]

cfg = scripts\ross_6.ltx

[smart_terrains]

none = true

END

 

; cse_visual properties

visual_name = actors\neytral\stalker_neytral_exoskeleton

 

; cse_alife_creature_abstract properties

g_team = 0

g_squad = 1

g_group = 5

health = 1

dynamic_out_restrictions =

dynamic_in_restrictions =

 

upd:health = 1

upd:timestamp = 0

upd:creature_flags = 0

upd:position = -209.08,-18.8,-155.46

upd:o_model = 0

upd:o_torso = 0,0,0

upd:g_team = 0

upd:g_squad = 0

upd:g_group = 0

 

; cse_alife_monster_abstract properties

 

upd:next_game_vertex_id = 65535

upd:prev_game_vertex_id = 65535

upd:distance_from_point = 0

upd:distance_to_point = 0

 

; cse_alife_human_abstract properties

predicate5 = 1,1,0,0,1

predicate4 = 2,2,0,2

 

; cse_ph_skeleton properties

 

upd:start_dialog =

 

; se_stalker properties

 

скрипт ross_6.ltx:

[logic]

active = walker

 

[walker]

path_walk = ross_6_walk

path_look = ross_6_look

 

и прописанные вейпоэнты:

[ross_6_walk]

points = p0,p1,p2

p0:name = name00|p=90|t=10000

p0:flags = 0x1

p0:position = -226.22203063965,-20.156566619873,-146.0369720459

p0:game_vertex_id = 47

p0:level_vertex_id = 28501

p0:links = p1(1)

 

p1:name = name02|p=50|t=8000

p1:flags = 0x2

p1:position = -204.38716125488,-20.550384521484,-145.06907653809

p1:game_vertex_id = 57

p1:level_vertex_id = 48482

p1:links = p2(1)

 

p2:name = name03|p=90|t=12000

p2:flags = 0x4

p2:position = -169.30325317383,-20.079622268677,-144.25030517578

p2:game_vertex_id = 55

p2:level_vertex_id = 80666

p2:links = p0(1)

 

[ross_6_look]

points = p0,p1,p2

p0:name = name00

p0:flags = 0x1

p0:position = -222.32,-18.33,-148.49

p0:game_vertex_id = 47

p0:level_vertex_id = 31586

 

p1:name = name02|p=50|t=8000

p1:flags = 0x2

p1:position = -205.29,-18.78,-147.08

p1:game_vertex_id = 57

p1:level_vertex_id = 47833

 

p2:name = name03

p2:flags = 0x4

p2:position = -160.59,-17.95,-148.13

p2:game_vertex_id = 45

p2:level_vertex_id = 89340

 

Изменено пользователем ColR_iT

Поделиться этим сообщением


Ссылка на сообщение

И ещё,я хочю уточнить параметры некоторые в файле alife_l01_escape.ltx.

Что значут и за что отвечают эти строки:

object_flags = 0xffffffbf

g_team = 0

g_squad = 1

g_group = 5

health = 1

dynamic_out_restrictions =

dynamic_in_restrictions =

upd:health = 1

upd:timestamp = 0

upd:creature_flags = 0

upd:o_model = 0

upd:o_torso = 0,0,0

upd:g_team = 0

upd:g_squad = 0

upd:g_group = 0

upd:distance_from_point = 0

upd:distance_to_point = 0

predicate5 = 1,1,0,0,1

predicate4 = 2,2,0,2

Поделиться этим сообщением


Ссылка на сообщение
Строгое предупреждение от модератора n6260
Нехорошо размножать свои одинаковые сообщения по темам форума.

Поделиться этим сообщением


Ссылка на сообщение

Здравствуйте,я извиняюсь за тупой вопрос,но всё же:Как заспавнить машины через all,и как в моде амк задали логику бтр?

Поделиться этим сообщением


Ссылка на сообщение

Здравствуйте,я создал снайпера в тч,что ему прописать в логике,чтоб когда он увидит кого нить,не уходил,а стрелял с одного места,заранее спасибо..

Поделиться этим сообщением


Ссылка на сообщение

Я скачал АИ вертолётов,хочу заспавнить бтр.

В самом файле spawn нужно подставлять координаты или создавать копию с координатами?

И как его заставить появиться,я в bind_stalker вписал вот это:

В секции function actor_binder:net_spawn(data),добавил это:

             -- БТР
               function spawn()
               spawn.btr(-86.21,-9.43,-152.87,179600,107,"test" )
        end

А вот сам файл spawn

-------------------------------------------------------------------------------------------------------------
-- Спавн вертолета. На основе АМК
--Параметры вызова: 
--позиция x,
--позиция y,
--позиция z, 
--левел вертекс, 
--гейм вертекс,
--файл логики без расширения .ltx. !!!ДОЛЖЕН находиться в config\scripts\heli!!!
-------------------------------------------------------------------------------------------------------------
function heli(section,posx,posy,posz,lvid,gvid,logic)
local obj = alife():create(section,vector():set(posx,posy,posz),lvid,gvid)
local packet = net_packet()
obj:STATE_Write(packet)

-- свойства cse_alife_object
local game_vertex_id = packet:r_u16()
local cse_alife_object__unk1_f32 = packet:r_float()
local cse_alife_object__unk2_s32 = 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_s32 = packet:r_s32()

-- свойства cse_visual
local model_visual = packet:r_stringZ()
local cse_visual__unk1_u8 = packet:r_u8()
-- свойства cse_motion
local motion_name = packet:r_stringZ()

-- свойства cse_ph_skeleton
local skeleton_name = packet:r_stringZ()
local cse_ph_skeleton__unk1_u8 = packet:r_u8()
local cse_ph_skeleton__unk2_u16 = packet:r_u16()

-- свойства cse_alife_helicopter
local cse_alife_helicopter__unk1_sz = packet:r_stringZ()
local engine_sound = packet:r_stringZ()

--устанавливаем логику
custom_data = "[logic]\ncfg = scripts\\heli\\"..logic..".ltx"

-- теперь заполняем нужные параметры
-- свойства cse_alife_object
packet:w_begin(game_vertex_id)
packet:w_float(cse_alife_object__unk1_f32)
packet:w_s32(cse_alife_object__unk2_s32)
packet:w_s32(level_vertex_id)
object_flags = bit_not(5)	-- ~5 = 0xfffffffa
packet:w_s32(object_flags)
packet:w_stringZ(custom_data)
packet:w_s32(-1)
packet:w_s32(cse_alife_object__unk3_s32)

-- свойства cse_visual
packet:w_stringZ(model_visual)
packet:w_u8(cse_visual__unk1_u8)

-- свойства cse_motion
packet:w_stringZ(motion_name)		

-- свойства cse_ph_skeleton
skeleton_name = "idle"
packet:w_stringZ(skeleton_name)
packet:w_u8(cse_ph_skeleton__unk1_u8)
packet:w_u16(cse_ph_skeleton__unk2_u16)

-- свойства cse_alife_helicopter
cse_alife_helicopter__unk1_sz = "idle"
engine_sound = "alexmx\\helicopter"
packet:w_stringZ(cse_alife_helicopter__unk1_sz)
packet:w_stringZ(engine_sound)

-- считываем скорректированные параметры
packet:r_seek(0)
obj:STATE_Read(packet, packet:w_tell())


return obj
end

-------------------------------------------------------------------------------------------------------------
-- Спавн БТР. На основе АМК
--Параметры вызова: 
--позиция x,
--позиция y,
--позиция z, 
--левел вертекс, 
--гейм вертекс,
--файл логики без расширения .ltx. !!!ДОЛЖЕН находиться в config\scripts\btr!!!
-------------------------------------------------------------------------------------------------------------
function btr(posx,posy,posz,lvid,gvid,logic)
local obj = alife():create("btr",vector():set(posx,posy,posz),lvid,gvid)
local packet = net_packet()
obj:STATE_Write(packet)

-- свойства cse_alife_object
local game_vertex_id = packet:r_u16()
local cse_alife_object__unk1_f32 = packet:r_float()
local cse_alife_object__unk2_s32 = 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_s32 = packet:r_s32()

-- свойства cse_visual
local model_visual = packet:r_stringZ()
local cse_visual__unk1_u8 = packet:r_u8()

-- свойства cse_ph_skeleton
local skeleton_name = packet:r_stringZ()
local cse_ph_skeleton__unk1_u8 = packet:r_u8()
local cse_ph_skeleton__unk2_u16 = packet:r_u16()
local health = packet:r_float()

--устанавливаем логику
custom_data = "[logic]\ncfg = scripts\\btr\\"..logic..".ltx"

-- теперь заполняем нужные параметры
-- свойства cse_alife_object
packet:w_begin(game_vertex_id)
packet:w_float(cse_alife_object__unk1_f32)
packet:w_s32(cse_alife_object__unk2_s32)
packet:w_s32(level_vertex_id)
object_flags = bit_not(5)	-- ~5 = 0xfffffffa
packet:w_s32(object_flags)
packet:w_stringZ(custom_data)
packet:w_s32(-1)
packet:w_s32(cse_alife_object__unk3_s32)

-- свойства cse_visual
packet:w_stringZ(model_visual)
packet:w_u8(cse_visual__unk1_u8)

-- свойства cse_ph_skeleton
skeleton_name = "idle"
packet:w_stringZ(skeleton_name)
packet:w_u8(cse_ph_skeleton__unk1_u8)
packet:w_u16(cse_ph_skeleton__unk2_u16)
health = 1
packet:w_float(health)

-- считываем скорректированные параметры
packet:r_seek(0)
obj:STATE_Read(packet, packet:w_tell())


return obj
end

function item(item,posx,posy,posz,lvid,gvid)
local obj = alife():create(item,vector():set(posx,posy,posz),lvid,gvid)
return obj
end

function inv(item,npc_id)
if npc_id == nil then
	npc_id = db.actor:id()
end
local obj = alife():create(item,vector():set(0,0,0),1,1,npc_id)
return obj
end

function heli_pair(posx,posy,posz,lvid,gvid,logic)
local heli_a = heli(posx,posy,posz,lvid,gvid,logic)
local heli_b = heli_copy(vector():set(posx+25,posy,posz),lvid,gvid,heli_a.id)
heli_target.add_heli_pair(heli_a,heli_
end

function heli_pair2(posx,posy,posz,lvid,gvid,logic)
local heli_a = heli(posx,posy,posz,lvid,gvid,logic)
local heli_b = heli(posx+25,posy,posz,lvid,gvid,"test_heli2")
heli_target.add_heli_pair(heli_a,heli_
end

function heli_copy(section,pos,lvid,gvid,id,logic)
--читаем данные из прототипа
local prototype = alife():object(id)
local packet1 = net_packet()
prototype:STATE_Write(packet1)

-- свойства cse_alife_object
local game_vertex_id1 = packet1:r_u16()
local cse_alife_object1__unk1_f32 = packet1:r_float()
local cse_alife_object1__unk2_s32 = packet1:r_s32()
local level_vertex_id1 = packet1:r_s32()
local object_flags1 = packet1:r_s32()
local custom_data1 = packet1:r_stringZ()

local obj = alife():create(section,pos,lvid,gvid)
local packet = net_packet()
obj:STATE_Write(packet)

-- свойства cse_alife_object
local game_vertex_id = packet:r_u16()
local cse_alife_object__unk1_f32 = packet:r_float()
local cse_alife_object__unk2_s32 = 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_s32 = packet:r_s32()

-- свойства cse_visual
local model_visual = packet:r_stringZ()
local cse_visual__unk1_u8 = packet:r_u8()
-- свойства cse_motion
local motion_name = packet:r_stringZ()

-- свойства cse_ph_skeleton
local skeleton_name = packet:r_stringZ()
local cse_ph_skeleton__unk1_u8 = packet:r_u8()
local cse_ph_skeleton__unk2_u16 = packet:r_u16()

-- свойства cse_alife_helicopter
local cse_alife_helicopter__unk1_sz = packet:r_stringZ()
local engine_sound = packet:r_stringZ()

--устанавливаем логику
game_vertex_id = game_vertex_id1
level_vertex_id = level_vertex_id1
object_flags = object_flags1
if not logic then
	custom_data = custom_data1
else
	custom_data = "[logic]\ncfg = scripts\\heli\\"..logic..".ltx"
end

-- теперь заполняем нужные параметры
-- свойства cse_alife_object
packet:w_begin(game_vertex_id)
packet:w_float(cse_alife_object__unk1_f32)
packet:w_s32(cse_alife_object__unk2_s32)
packet:w_s32(level_vertex_id)
object_flags = bit_not(5)	-- ~5 = 0xfffffffa
packet:w_s32(object_flags)
packet:w_stringZ(custom_data)
packet:w_s32(-1)
packet:w_s32(cse_alife_object__unk3_s32)

-- свойства cse_visual
packet:w_stringZ(model_visual)
packet:w_u8(cse_visual__unk1_u8)

-- свойства cse_motion
packet:w_stringZ(motion_name)		

-- свойства cse_ph_skeleton
skeleton_name = "idle"
packet:w_stringZ(skeleton_name)
packet:w_u8(cse_ph_skeleton__unk1_u8)
packet:w_u16(cse_ph_skeleton__unk2_u16)

-- свойства cse_alife_helicopter
cse_alife_helicopter__unk1_sz = "idle"
engine_sound = "alexmx\\helicopter"
packet:w_stringZ(cse_alife_helicopter__unk1_sz)
packet:w_stringZ(engine_sound)

-- считываем скорректированные параметры
packet:r_seek(0)
obj:STATE_Read(packet, packet:w_tell())


return obj
end

function missile(lncpos,lvid,gvid,target,launcher,trgpos,lncdir,sundir)
--lncpos - позиция запуска,  в ней спавнится ракета. Нужна для спавна и в биндере
--lvid - левел вертекс запуска. Только для спавна
--gvid - гейм вертекс запуска. Только для спавна
--target - строка с ИД цели. Задает цель в биндере 
--launcher - строка с ИД объекта, запустившего ракету. Для оповещения цели, кто стрелял. Может отсутствовать при старте ракеты из недоступной области
--trgpos - позиция цели. 
--lncdir - направление запуска. нужно для задания траектории, особенно без launcher-а
--sundir - направление на Солнце. Считаем во время полета постоянным, чтобы не грузить комп.

--	local particle = particles_object([[explosions\group_items\expl_10_smoke00]]) -- для стандартного particles.xr
local particle = particles_object([[weapons\group_items\missile_smoke_launch]])
particle:play_at_pos(lncpos)

local obj = alife():create("missile",lncpos,lvid,gvid)
local packet = net_packet()
obj:STATE_Write(packet)

-- свойства cse_alife_object
local game_vertex_id = packet:r_u16()
local cse_alife_object__unk1_f32 = packet:r_float()
local cse_alife_object__unk2_s32 = 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_s32 = packet:r_s32()

-- свойства cse_visual
local model_visual = packet:r_stringZ()
local cse_visual__unk1_u8 = packet:r_u8()
-- свойства cse_motion
local motion_name = packet:r_stringZ()

-- свойства cse_ph_skeleton
local skeleton_name = packet:r_stringZ()
local cse_ph_skeleton__unk1_u8 = packet:r_u8()
local cse_ph_skeleton__unk2_u16 = packet:r_u16()

-- свойства cse_alife_helicopter
local cse_alife_helicopter__unk1_sz = packet:r_stringZ()
local engine_sound = packet:r_stringZ()

--устанавливаем логику
--if launcher == nil then launcher = 0 end
custom_data =   "[logic]\ntarget = "..tostring(target)..

				"\ntrgposx = "..tostring(trgpos.x)..
				"\ntrgposy = "..tostring(trgpos.y)..
				"\ntrgposz = "..tostring(trgpos.z)..

				"\nlauncher = "..tostring(launcher)..

				"\nlncposx = "..tostring(lncpos.x)..
				"\nlncposy = "..tostring(lncpos.y)..
				"\nlncposz = "..tostring(lncpos.z)..

				"\nlncdirx = "..tostring(lncdir.x)..
				"\nlncdiry = "..tostring(lncdir.y)..
				"\nlncdirz = "..tostring(lncdir.z)..

				"\nsundirx = "..tostring(sundir.x)..
				"\nsundiry = "..tostring(sundir.y)..
				"\nsundirz = "..tostring(sundir.z)..

				"\nactive = heli_move@missile"..
				"\n[heli_move@missile]"..
				"\npath_move = missile_path"

-- теперь заполняем нужные параметры
-- свойства cse_alife_object
packet:w_begin(game_vertex_id)
packet:w_float(cse_alife_object__unk1_f32)
packet:w_s32(cse_alife_object__unk2_s32)
packet:w_s32(level_vertex_id)
object_flags = bit_not(5)	-- ~5 = 0xfffffffa
packet:w_s32(object_flags)
packet:w_stringZ(custom_data)
packet:w_s32(-1)
packet:w_s32(cse_alife_object__unk3_s32)

-- свойства cse_visual
packet:w_stringZ(model_visual)
packet:w_u8(cse_visual__unk1_u8)

-- свойства cse_motion
packet:w_stringZ(motion_name)		

-- свойства cse_ph_skeleton
skeleton_name = "idle"
packet:w_stringZ(skeleton_name)
packet:w_u8(cse_ph_skeleton__unk1_u8)
packet:w_u16(cse_ph_skeleton__unk2_u16)

-- свойства cse_alife_helicopter
cse_alife_helicopter__unk1_sz = "idle"
engine_sound = "weapons\\rocket_fly"
packet:w_stringZ(cse_alife_helicopter__unk1_sz)
packet:w_stringZ(engine_sound)

-- считываем скорректированные параметры
packet:r_seek(0)
obj:STATE_Read(packet, packet:w_tell())


return obj
end

Подскажите пожалуйста,что делать...Заренее спасибо.

 

Поделиться этим сообщением


Ссылка на сообщение

Строгое предупреждение от модератора Halford
Цитирования правил не забываем. ;)

Убрал,получилось вот что:

function init    (obj)
xr_motivator.AddToMotivator(obj)
end

function actor_init    (npc)
npc:bind_object(actor_binder(npc))
end

local game_difficulty_by_num = {
[0] = "gd_novice",
[1] = "gd_stalker",
[2] = "gd_veteran",
[3] = "gd_master"
}

lasthealth  = 0
lasttime	= 0
post_process = 0
local weapon_hide = false
----------------------------------------------------------------------------------------------------------------------
class "actor_binder" (object_binder)
----------------------------------------------------------------------------------------------------------------------
function actor_binder:__init (obj) super(obj)
self.bCheckStart = false
self.weather_manager = level_weathers.WeatherManager()
self.actor_detector = xr_detector.actor_detector()
end
----------------------------------------------------------------------------------------------------------------------
function actor_binder:net_spawn(data)
printf("actor net spawn")		

level.show_indicators()

self.bCheckStart = true
self.weapon_hide = false -- спрятано или нет оружие при разговоре.
weapon_hide = false -- устанавливаем глобальный дефолтовый флаг.

if object_binder.net_spawn(self,data) == false then
	return false
end

db.add_actor(self.object)

if self.st.disable_input_time == nil then
	level.enable_input()
end

self.weather_manager:reset()
--	game_stats.initialize ()

if(actor_stats.add_to_ranking~=nil)then
	actor_stats.add_to_ranking(self.object:id())
end

if xr_logic.pstor_retrieve(db.actor, "first_run", 0)==0 then 
	-- тест ПЗРК
	spawn.inv("wpn_igla")
	for i = 1,3 do
		-- СЛИШКОМ тяжело, но можно сбросить у Сидоровича, жрать не просит. Больше взять негде.
		spawn.inv("ammo_igla")
	end

	-- Вертушки на кордоне
	spawn.heli("mi24",-356.30456542969,15.556171417236,231.61962890625,613,66,"esc_railroad_patrol" )
               xr_logic.pstor_store(db.actor, "first_run", 1) 
end 


              spawn.btr(-86.21,-9.43,-152.87,179600,107,"test_btr" )
       end

--' Загружаем настройки дропа
death_manager.init_drop_settings()
       new_stalkers.spawn_pochti_vsex_mudil()
return true
end
----------------------------------------------------------------------------------------------------------------------
function actor_binder:net_destroy()
if(actor_stats.remove_from_ranking~=nil)then
	actor_stats.remove_from_ranking(self.object:id())
end
--	game_stats.shutdown ()
db.del_actor(self.object)

   sr_light.clean_up ()

self.object:set_callback(callback.inventory_info, nil)
self.object:set_callback(callback.article_info, nil)
self.object:set_callback(callback.on_item_take, nil)
self.object:set_callback(callback.on_item_drop, nil)
--self.object:set_callback(callback.actor_sleep, nil)
self.object:set_callback(callback.task_state, nil)
self.object:set_callback(callback.level_border_enter, nil)
self.object:set_callback(callback.level_border_exit, nil)
self.object:set_callback(callback.take_item_from_box, nil)

if sr_psy_antenna.psy_antenna then
	sr_psy_antenna.psy_antenna:destroy()
	sr_psy_antenna.psy_antenna = false
end

xr_sound.stop_all_sound_object()

object_binder.net_destroy(self)
end
----------------------------------------------------------------------------------------------------------------------
function actor_binder:reinit()
object_binder.reinit(self)

local npc_id = self.object:id()

db.storage[npc_id] = { }

self.st = db.storage[npc_id]
self.st.pstor = nil

self.next_restrictors_update_time = -10000

self.object:set_callback(callback.inventory_info, self.info_callback, self)
self.object:set_callback(callback.article_info, self.article_callback, self)
self.object:set_callback(callback.on_item_take, self.on_item_take, self)
self.object:set_callback(callback.on_item_drop, self.on_item_drop, self)
self.object:set_callback(callback.trade_sell_buy_item, self.on_trade, self) -- for game stats
--self.object:set_callback(callback.actor_sleep, self.sleep_callback, self)
self.object:set_callback(callback.task_state, self.task_callback, self)
--self.object:set_callback(callback.map_location_added, self.map_location_added_callback, self)
self.object:set_callback(callback.level_border_enter, self.level_border_enter, self)
self.object:set_callback(callback.level_border_exit, self.level_border_exit, self)
self.object:set_callback(callback.take_item_from_box, self.take_item_from_box, self)
end
----------------------------------------------------------------------------------------------------------------------
function actor_binder:take_item_from_box(box, item)
local story_id = box:story_id()
if story_id == nil then
	return
end

treasure_manager.take_item_from_box(box, story_id)
--[[	
local respawner = se_respawn.get_respawner_by_parent(story_id)
if respawner == nil then
	return
end

--' Необходимо уменьшить счетчик в респавнере
respawner:remove_spawned(item:id())

local smart_terrain = db.strn_by_respawn[respawner:name()]
if smart_terrain == nil then
	return
end

local npc = smart_terrain.gulag:get_nearest_online_obj(db.actor:position())
   if npc ~= nil then
    xr_sound.set_sound_play(npc, "reac_box")
    xr_gulag.setGulagEnemy(smart_terrain:name() , db.actor)		
   end
]]
end
----------------------------------------------------------------------------------------------------------------------
function actor_binder:level_border_enter(npc, info_id)
self.actor_detector:actor_enter()
end
----------------------------------------------------------------------------------------------------------------------
function actor_binder:level_border_exit(npc, info_id)
self.actor_detector:actor_exit()
end
----------------------------------------------------------------------------------------------------------------------
function actor_binder:info_callback(npc, info_id)
printf("*INFO*: npc='%s' id='%s'", npc:name(), info_id)
--' Сюжет
level_tasks.proceed(self.object)
-- Отметки на карте
level_tasks.process_info_portion(info_id)
end
----------------------------------------------------------------------------------------------------------------------
function actor_binder:on_trade (item, sell_bye, money)
   if sell_bye == true then
      game_stats.money_trade_update (money)
   else       
      game_stats.money_trade_update (-money) 
   end   
end
----------------------------------------------------------------------------------------------------------------------
function actor_binder:article_callback(npc, group, name)
--printf("article_callback [%s][%s]", group, name)
if device().precache_frame >1 then return end

if group == "Diary" then
	news_manager.send_encyclopedy("diary", group)
else
	news_manager.send_encyclopedy("encyclopedy", group)
end
end
----------------------------------------------------------------------------------------------------------------------
function actor_binder:on_item_take (obj)
   level_tasks.proceed(self.object)
   --game_stats.update_take_item (obj, self.object)
end
----------------------------------------------------------------------------------------------------------------------
function actor_binder:on_item_drop (obj)
   level_tasks.proceed(self.object)
   --game_stats.update_drop_item (obj, self.object)
end
----------------------------------------------------------------------------------------------------------------------

function actor_binder:task_callback(_task, _objective, _state)
task_manager.task_callback(_task:get_id(), _objective:get_idx(), _state)
if _objective:get_idx() == 0 then
	if _state == task.fail then
		news_manager.send_task(db.actor, "fail", _task, _objective)
	elseif _state == task.completed then
		task_manager.reward_by_task(_task)
		news_manager.send_task(db.actor, "complete", _task, _objective)
	else
		news_manager.send_task(db.actor, "new", _task, _objective)
	end
else
	if _task:get_objective(0):get_state() == task.in_progress then
		news_manager.send_task(db.actor, "update", _task, _objective)
	end
end
end

----------------------------------------------------------------------------------------------------------------------
function actor_binder:map_location_added_callback(spot_type_str, object_id)
if (false==app_ready()) or (device().precache_frame>1) then return end
--'news_manager.send_task(db.actor, "new")
end
----------------------------------------------------------------------------------------------------------------------
function actor_binder:update(delta)
object_binder.update(self, delta)

-- DEBUG slowdown
--	slowdown.update()

local time = time_global()

game_stats.update (delta, self.object)

       pzrk.update()

-- апдейт погоды
self.weather_manager:update()

-- апдейт схемы детектора
self.actor_detector:update()

-- апдейт звуковой схемы актера
xr_sound.update_actor()

--' Проверка потери жизни
--[[
if self.object.health - lasthealth > 0.001 or
   self.object.health - lasthealth < -0.001 then
	printf("%f | %f", self.object.health, self.object.health - lasthealth, game.time() - lasttime)
	lasthealth = self.object.health
	lasttime = game.time()

    end
]]	
-- Обновление отключения ввода с клавиатуры.
if self.st.disable_input_time ~= nil and
   game.get_game_time():diffSec(self.st.disable_input_time) >= self.st.disable_input_idle 
then
	level.enable_input()
	self.st.disable_input_time = nil
end
-- Обновление сна с переносом чувака в указанную позицию
if self.st.sleep_relocate_time ~= nil and
   game.get_game_time():diffSec(self.st.sleep_relocate_time) >= self.st.sleep_relocate_idle 
then
	self.object:set_actor_position(self.st.sleep_relocate_point)
	local dir = self.st.sleep_relocate_point:sub(self.st.sleep_relocate_look)
	self.object:set_actor_direction(dir:getH())
	self.st.sleep_relocate_time = nil
end

-- Апдейт прятание оружия игрока во время диалога
if weapon_hide == true or self.object:is_talking() then
	if self.weapon_hide == false then
		self.object:hide_weapon()
		self.weapon_hide = true
	end
else
	if self.weapon_hide == true then
		self.object:restore_weapon()
		self.weapon_hide = false
	end
end	

-- обновление рестрикторов, которые под логикой, срабатывает через интервалы времени
if self.next_restrictors_update_time < time then
	bind_restrictor.actor_update(delta)

	self.next_restrictors_update_time = time + 200

	task_manager.actor_update()
end

-- обновление постпроцессов
if post_process ~= 0 then
	if post_process:update () == true then
	   post_process = 0
	end
end

-- обновление пси-антенны
if sr_psy_antenna.psy_antenna then
	sr_psy_antenna.psy_antenna:update(delta)
end

--' Вывод сообщения о большой радиации
if self.object.radiation >= 0.7 then
	local hud = get_hud()
	local custom_static = hud:GetCustomStatic("cs_radiation_danger")
	if custom_static == nil then
		hud:AddCustomStatic("cs_radiation_danger", true)
		hud:GetCustomStatic("cs_radiation_danger"):wnd():SetTextST("st_radiation_danger")
	end
else
	local hud = get_hud()
	local custom_static = hud:GetCustomStatic("cs_radiation_danger")
	if custom_static ~= nil then
		hud:RemoveCustomStatic("cs_radiation_danger")
	end
end



	if self.bCheckStart then
	printf("SET DEFAULT INFOS")		

	if not has_alife_info("storyline_actor_start") and
	   (level.name() == "l01_escape")
	then
		self.object:give_info_portion("storyline_actor_start")
		_G.g_start_avi = true
		printf("*AVI* RUN START AVI")			
	end

--		if not has_alife_info("encyclopedy") then
--			self.object:give_info_portion("encyclopedy")
--		end

	if not has_alife_info("global_dialogs") then
		self.object:give_info_portion("global_dialogs")
	end

	if not has_alife_info("level_changer_icons") then
		self.object:give_info_portion("level_changer_icons")
	end

	level_tasks.add_lchanger_location()

	self.bCheckStart = false		
end

if sniper_add.load_variable("spawn_sniper",false)==false then
sniper_add.start_add_spawn()
sniper_add.save_variable("spawn_sniper",true)
end


end
----------------------------------------------------------------------------------------------------------------------
function actor_binder:save(packet)

local save_treasure_manager = true

printf("actor_binder:save(): self.object:name()='%s'", self.object:name())
object_binder.save(self, packet)

--' Сохраняем уровень сложности
if save_treasure_manager == true then
	packet:w_u8(level.get_game_difficulty() + 128)
else
	packet:w_u8(level.get_game_difficulty())
end


--' Сохраняем данные об отключенном вводе
if self.st.disable_input_time == nil then
	packet:w_bool(false)
else
	packer:w_bool(true)
	utils.w_CTime(packet, self.st.disable_input_time)
end

xr_logic.pstor_save_all(self.object, packet)
self.weather_manager:save(packet)

sr_psy_antenna.save( packet )

if save_treasure_manager == true then
	treasure_manager.save(packet)      
end                                  

task_manager.save(packet)
self.actor_detector:save(packet)	
end
----------------------------------------------------------------------------------------------------------------------
function actor_binder:load(reader)
printf("actor_binder:load(): self.object:name()='%s'", self.object:name())
object_binder.load(self, reader)
printf("actor_binder:object_binder.load(): self.object:name()='%s'", self.object:name())

--' Загружаем уровень сложности
local game_difficulty = reader:r_u8()

local load_treasure_manager = false      
if game_difficulty >= 128 then           
	game_difficulty = game_difficulty - 128
	load_treasure_manager = true           
end                                      


get_console():execute("g_game_difficulty "..game_difficulty_by_num[game_difficulty])

if reader:r_eof() then
	abort("SAVE FILE IS CORRUPT")
end

local stored_input_time = reader:r_u8()
if stored_input_time == true then
	self.st.disable_input_time = utils.r_CTime(reader)
end

xr_logic.pstor_load_all(self.object, reader)
self.weather_manager:load(reader)

sr_psy_antenna.load(reader)

if load_treasure_manager == true then
	treasure_manager.load(reader)      
end                                  


task_manager.load(reader)
self.actor_detector:load(reader)	
end
----------------------------------------------------------------------------------------------------------------------

--старт префетча звуков
--if string.find(command_line(), "-noprefetch") == nil then
--	sound_prefetch.prefetch_sounds()
--end


-- Weapon functions
function hide_weapon()
weapon_hide = true
end
function restore_weapon()
weapon_hide = false
end

// this is test for section iteration
/**
local function test_section_iteration(file_name, section_name)
printf			("file    : %s",file_name)
printf			("section : %s",section_name)

local			file = ini_file(file_name)
local			n = file:line_count(section_name)
printf			("lines   : %d",n)

local			id, value = "", "", result
for i=0,n-1 do
	result, id, value	= file:r_line(section_name,i,"","")
	printf		("line %d : %s = %s",i,id,value)
end
end

test_section_iteration("system.ltx","space_restrictor")
/**/

 

 

Но вылетает((

Expression    : fatal error
Function      : CScriptEngine::lua_error
File          : E:\stalker\patch_1_0004\xr_3da\xrGame\script_engine.cpp
Line          : 73
Description   : <no expression>
Arguments     : LUA error: ....r. - shadow of chernobyl\gamedata\scripts\_g.script:20: bad argument #2 to 'format' (string expected, got no value)

В чём ошибка то,какие файлы нужны для этого бтра,у бтр какой файл-конфиг?

p.s Делаю на чистой игре.

Поделиться этим сообщением


Ссылка на сообщение
  • Недавно просматривали   0 пользователей

    Ни один зарегистрированный пользователь не просматривает эту страницу.

AMK-Team.ru

×
×
  • Создать...