Redix 0 Опубликовано 26 Сентября 2020 Нужен скриптер, возможно ли переделать скрипт из мода Dynamics Helmets на ЗП в ТЧ? Поменял только названия визуалов, вылет. Скрытый текст [26.09.20 15:11:25.868] ********************************************************************************* [26.09.20 15:11:25.868] [print_output([CScriptEngine::lua_pcall_failed])] SCRIPT RUNTIME ERROR: ....a.l.k.e.r - shadow of chernobyl\gamedata\scripts\m_visuals.script:125: bad argument #1 to 'find' (string expected, got nil) stack traceback: [C]: at 0x7ff92d71b8d8 [C]: in function 'find' ....a.l.k.e.r - shadow of chernobyl\gamedata\scripts\m_visuals.script:125: in function 'str_explode' ....a.l.k.e.r - shadow of chernobyl\gamedata\scripts\m_visuals.script:68: in function 'update' ...l.k.e.r - shadow of chernobyl\gamedata\scripts\bind_stalker.script:340: in function <...l.k.e.r - shadow of chernobyl\gamedata\scripts\bind_stalker.script:214> [26.09.20 15:11:25.868] ********************************************************************************* [26.09.20 15:11:25.868] FATAL ERROR [error]Expression : FATAL ERROR [error]Function : CScriptEngine::lua_pcall_failed [error]File : c:\projects\ogsr-engine\ogsr_engine\common_ai\script_engine.cpp [error]Line : 52 [error]Description : [CScriptEngine::lua_pcall_failed]: ....a.l.k.e.r - shadow of chernobyl\gamedata\scripts\m_visuals.script:125: bad argument #1 to 'find' (string expected, got nil) [26.09.20 15:11:25.868] ***************************[ScriptCrashHandler]********************************** [26.09.20 15:11:25.868] stack traceback: [C]: at 0x7ff92d71b8d8 [C]: in function 'find' ....a.l.k.e.r - shadow of chernobyl\gamedata\scripts\m_visuals.script:125: in function 'str_explode' ....a.l.k.e.r - shadow of chernobyl\gamedata\scripts\m_visuals.script:68: in function 'update' ...l.k.e.r - shadow of chernobyl\gamedata\scripts\bind_stalker.script:340: in function <...l.k.e.r - shadow of chernobyl\gamedata\scripts\bind_stalker.script:214> [26.09.20 15:11:25.868] Locals: [26.09.20 15:11:25.868] string (*temporary) : ....a.l.k.e.r - shadow of chernobyl\gamedata\scripts\m_visuals.script:125: bad argument #1 to 'find' (string expected, got nil) [26.09.20 15:11:25.868] End [26.09.20 15:11:25.868] Locals: [26.09.20 15:11:25.868] nil (*temporary) : [not available] [26.09.20 15:11:25.868] string (*temporary) : . [26.09.20 15:11:25.868] number (*temporary) : 1.000000 [26.09.20 15:11:25.868] boolean (*temporary) : true [26.09.20 15:11:25.868] string (*temporary) : string expected, got nil [26.09.20 15:11:25.868] string (*temporary) : bad argument #1 to 'find' (string expected, got nil) [26.09.20 15:11:25.868] End [26.09.20 15:11:25.868] Locals: [26.09.20 15:11:25.868] string div : . [26.09.20 15:11:25.868] nil str : [not available] [26.09.20 15:11:25.868] number pos1 : 1.000000 [26.09.20 15:11:25.868] number pos2 : 1.000000 [26.09.20 15:11:25.868] nil clear : [not available] [26.09.20 15:11:25.868] nil conv : [not available] [26.09.20 15:11:25.868] Table: t [26.09.20 15:11:25.868] nil cpt : [not available] [26.09.20 15:11:25.868] nil pos : [not available] [26.09.20 15:11:25.868] End [26.09.20 15:11:25.868] Locals: [26.09.20 15:11:25.868] End [26.09.20 15:11:25.868] Locals: [26.09.20 15:11:25.868] Userdata: self [26.09.20 15:11:25.868] Table: self.st [26.09.20 15:11:25.868] number self.next_restrictors_update_time : 28190.000000 [26.09.20 15:11:25.868] boolean self.weapon_hide : false [26.09.20 15:11:25.868] boolean self.bCheckStart : false [26.09.20 15:11:25.868] Userdata: self.weather_manager [26.09.20 15:11:25.868] table self.weather_manager.weather_list : [...] [26.09.20 15:11:25.868] number self.weather_manager.update_time : 10000.000000 [26.09.20 15:11:25.868] string self.weather_manager.update_level : l01_escape [26.09.20 15:11:25.868] number self.weather_manager.weather_change_day : 1.000000 [26.09.20 15:11:25.868] Userdata: self.actor_detector [26.09.20 15:11:25.868] number self.actor_detector.init_time : -1.000000 [26.09.20 15:11:25.868] number delta : 0.000000 [26.09.20 15:11:25.868] number time : 27990.000000 [26.09.20 15:11:25.868] End Вот сам скрипт: Скрытый текст ---------------------- -- File: Visuals -- Author: Shoker, Mechanic -- Правки: Antnigm, Redix -- Меняет визуал ГГ в зависимости от одетого на него шлема ---------------------- -- Таблица секций брони, а также визуалов --[[ local visuals = { секция_брони = { секция_шлема = путь к моделе ... } ... } ]] -- Если шлем не нужен, то ничего не пишем local visuals = { without_outfit = { helm_respirator = "actors\\novice\\green_stalker_antigas", }, novice_outfit = { helm_respirator = "actors\\novice\\green_stalker_antigas", }, stalker_outfit = { helm_respirator = "actors\\novice\\green_stalker_antigas", }, svoboda_light_outfit = { helm_respirator = "actors\\novice\\green_stalker_antigas", }, dolg_outfit = { helm_respirator = "actors\\novice\\green_stalker_antigas", }, svoboda_heavy_outfit = { helm_respirator = "actors\\novice\\green_stalker_antigas", }, specops_outfit = { helm_respirator = "actors\\novice\\green_stalker_antigas", }, military_outfit = { helm_respirator = "actors\\novice\\green_stalker_antigas", }, dolg_heavy_outfit = { helm_respirator = "actors\\novice\\green_stalker_antigas", }, } local otf local helm local curent_vis local helm_tbl local new_model function update() otf = db.actor:item_in_slot(7) helm = db.actor:item_in_slot(11) curent_vis = db.actor:get_visual_name() if otf==nil and helm==nil then db.actor:set_visual_name("actors\\hero\\hero_novice") return end if otf~=nil and helm==nil then local otf_vis_name = str_explode(".", get_ltx(otf:section(), "actor_visual", "str"))[1] if otf_vis_name~=curent_vis then db.actor:set_visual_name(otf_vis_name) end else ------------------------------------- if otf==nil and helm~=nil then helm_tbl = visuals["without_outfit"] else helm_tbl = visuals[otf:section()] end if helm_tbl~=nil then new_model = helm_tbl[helm:section()] if new_model~=nil then if new_model~=curent_vis then db.actor:set_visual_name(new_model) end end end ------------------------------------- end end -- Получить строку из LTX файла function get_ltx(l_name,l_string,type) if system_ini():section_exist(l_name) and system_ini():line_exist(l_name, l_string) then if type=="bol" then return system_ini():r_bool(l_name, l_string) end if type=="num" then -- целое число return tonumber(system_ini():r_u32(l_name, l_string)) end if type=="num_float" then -- число с запятой return tonumber(system_ini():r_float(l_name, l_string)) end if type=="str" then return tostring(system_ini():r_string(l_name, l_string)) end if type==nil then return system_ini():r_u32(l_name, l_string) end end return nil end function str_explode(div,str,pos1,pos2,clear, conv) local t={} local cpt, pos if pos1 == nil then pos1 = 1 end if pos2 == nil then pos2 = pos1 end local cpt1 = string.find (str, div, pos1, true) local cpt2 = string.find (str, div, pos2, true) if cpt1 and cpt2 then if cpt2-cpt1 > 5 then cpt = cpt1 pos = pos1 else cpt = cpt2 pos = pos2 end repeat if clear then table.insert( t, trim(string.sub(str, 1, cpt-1)) ) else table.insert( t, string.sub(str, 1, cpt-1) ) end str = string.sub( str, cpt+string.len(div) ) cpt = string.find (str, div, pos, true) until cpt==nil end if clear then table.insert(t, trim(str)) else table.insert(t, str) end if conv then t = convert_tbl(t) end return t end 125 строка - local cpt1 = string.find (str, div, pos1, true) Заранее спасибо Поделиться этим сообщением Ссылка на сообщение