Regulamin forum
Dział "Tworzenie Modyfikacji" służy do zadawania pytań odnośnie tworzenia modyfikacji, edytowania plików gry, oraz pisania tzw. tutoriali, czyli poradników odnośnie modyfikowania gry. Nie zadajemy tutaj pytań odnośnie modyfikacji gotowych (nie dyskutujemy o nich!), prócz prób ich połączenia etc.
Przy cytowaniu plików *.LTX stosować tag [SYNTAX="ini"], przy cytowaniu plików *.script [SYNTAX="lua"] a przy cytowaniu plików *.xml - [SYNTAX="xml"].
Witam kolegów stalkerów.. Mam problem otóż: Mam bass mod-a w wersji 1.47 i trochę go trzeba było zedytować by działał i zrobiłem tak że działał od kiedy nie poszedłem na zaton i wróciłem na janów to co chwila coś nie działa jakieś crashe niektórych plików od scripts nie było w ogóle w modzie a w nich znajduje błąd przeanalizowałem wszystkie skrypty i wszystko jest w miarę ok (mówię że w miarę dlatego że ktoś zawsze znajdzie jakis błąd chociaż skrypty można pisać w 100% a lubią się czasem tak z siebie posypać) no i właśnie dlatego jest pewnie ten problem. chodząc po Janowie potrafiło mi wyrzucić że: xr_meet.script
j1:
function process_npc_usability(npc) if xr_wounded.is_wounded(npc) then if npc:relation(db.actor) == game_object.enemy then npc:disable_talk() else local wounded = db.storage[npc:id()].wounded if wounded.enable_talk then npc:enable_talk() else npc:disable_talk() end end return end
local meet = db.storage[npc:id()].meet
if meet then
local use = meet.meet_manager.use
if use == "true" then if xr_corpse_detection.is_under_corpse_detection(npc) or xr_help_wounded.is_under_help_wounded(npc) then npc:disable_talk() else npc:enable_talk() end elseif use == "false" then npc:disable_talk() if npc:is_talking() then npc:stop_talk() end end
end end
i jak nie dałem tutaj tego : "if meet then" to wyrzucało mi błąd że meet is null
inne to np: xr_logic.script
j2:
function configure_schemes(npc, ini, ini_filename, stype, section_logic, gulag_name) --printf("DEBUG: enable_scripts: npc:name()=%s", npc:name())
local npc_id = npc:id() local st = db.storage[npc_id]
-- ĺńëč ęŕęŕ˙-ňî ńőĺěŕ áűëŕ äî ýňîăî ŕęňčâíŕ, äĺŕęňčâčđîâŕňü ĺ¸ if st and st.active_section then issue_event(npc, st[st.active_scheme], "deactivate", npc) end
local actual_ini local actual_ini_filename
tutaj też że st is null no to dalem że "if st and " i działa
--[[ local se_obj = alife():object(obj:id()) if se_obj and se_obj.m_smart_terrain_id ~= 65535 and amount > 0 then local smart_obj = alife():object(se_obj.m_smart_terrain_id) smart_obj:set_alarm()
if smart_obj.base_on_actor_control ~= nil then smart_obj.base_on_actor_control:actor_attack() end end ]] -- Čůĺě ńěŕđňű ďî đŕńńňî˙íčţ if amount > 0 then for k,v in pairs(sim_board.get_sim_board().smarts) do local smart = v.smrt if smart.base_on_actor_control ~= nil then local level_id = game_graph():vertex(smart.m_game_vertex_id):level_id() local actor_level_id = game_graph():vertex(alife():actor().m_game_vertex_id):level_id() if level_id == actor_level_id and db.actor:position():distance_to_sqr(smart.position) <= 6400 then if self.object:relation(db.actor) ~= game_object.enemy then smart.base_on_actor_control:actor_attack() end end end end end end if self.st.active_section then xr_logic.issue_event(self.object, self.st[self.st.active_scheme], "hit_callback", obj, amount, local_direction, who, bone_index) end if self.st.combat_ignore then xr_logic.issue_event(self.object, self.st.combat_ignore, "hit_callback", obj, amount, local_direction, who, bone_index) end if self.st.combat then xr_logic.issue_event(self.object, self.st.combat, "hit_callback", obj, amount, local_direction, who, bone_index) end if self.st.hit then xr_logic.issue_event(self.object, self.st.hit, "hit_callback", obj, amount, local_direction, who, bone_index) end
local xr_mot_hit_call_obj = false local xr_mot_hit_call_obj_a = false local xr_mot_hit_call_obj_b = false local xr_mot_hit_call_obj_c = false
if self.object then if self.object.health and self.object.health ~= nil then xr_mot_hit_call_obj_a = true end end if xr_mot_hit_call_obj_a ~= false then xr_mot_send_new_object("object.health is not nil") end if bone_index then if bone_index ~= nil then xr_mot_hit_call_obj_b = true end end if xr_mot_hit_call_obj_b ~= false then xr_mot_send_new_object("bone_index is not nil") end if amount then if amount ~= nil then xr_mot_hit_call_obj_c = true end end if xr_mot_hit_call_obj_c ~= false then xr_mot_send_new_object("amount is not nil") end if xr_mot_hit_call_obj_a == true and xr_mot_hit_call_obj_a == true and xr_mot_hit_call_obj_a == true then xr_mot_hit_call_obj = true end if xr_mot_hit_call_obj then -- Ĺńëč ďđčřĺë ńěĺđňĺëüíűé őčň, ń íĺęîňîđîé âĺđî˙ňíîńňüţ äĺëŕĺě ÷óâŕęŕ đŕíĺíűě. if bone_index ~= 15 and amount > self.object.health*100 then xr_mot_send_new_object("self.object.health has been set to 0.15") --printf("DEADLY HIT %s %s", amount, self.object.health*100) self.object.health = 0.15 end end
if amount > 0 then printf("HIT_CALLBACK: %s amount=%s bone=%s", obj:name(), amount, tostring(bone_index)) -- self.need_relation_update = who:id() == db.actor:id() xr_wounded.hit_callback(obj:id()) end if rx_ai then rx_ai.npc_hit(obj,amount,local_direction,who,bone_index,self.object) end end
function xr_mot_send_new_object(news_content) --[[ local news_caption news_caption = game.translate_string("st_mr_Dektyarev") news_contena = game.translate_string("st_n_loc_found") news_content = "debug: "..news_content xr_sound.set_sound_play(db.actor:id(), "pda_tips") db.actor:give_game_news(news_caption, news_content, "ui_inGame2_PD_Svoy_paren", 0, 5000) ]] end
od razu dodam że tutaj wywalało błąd że "object is a nil value" lub że chyba '?' a to : local xr_mot_hit_call_obj i każe ten wpis z tym lub pochodną to do debugu bo chciałem wiedzieć co to powoduje jak zrobiłem tak to już działa..
to teraz misja z Zulusem ... jak wiadomo Zulus lubi sobie wypić i jak pójdę do niego to zaczynamy się upijać itd i diektiariev mi usypia u niego podczas dialogu... jak wychodzę z dialogu u Zula z tym że nie buj się mam plany czy jakoś tak to gre mi czas w senskie przesówa w kółko że potrafi dac nawet o jeden czy dwa dni do przodu.... i gra w tym momencie sie crashuje i w logu jest napisane że coś tam z "t jest nil" lub "?" nawet takiej nazwy skryptu w tym modzie nie ma więc wrzucam oryginał z wypakowanej gamedata utils.script
j4:
-- запись CTime в пакет. если t=nil, то запишет один нулевой байт function w_CTime( p, t ) --set_save_marker(p, "save", false, "CTIME") if t == nil then p:w_u8(-1) --set_save_marker(p, "save", true, "CTIME") return end
if (CTime == nil) or (t ~= CTime_0) then local Y, M, D, h, m, s, ms = 0, 0, 0, 0, 0, 0, 0 Y, M, D, h, m, s, ms = t:get( Y, M, D, h, m, s, ms )
p:w_u8 ( Y - 2000 ) p:w_u8 ( M ) p:w_u8 ( D ) p:w_u8 ( h ) p:w_u8 ( m ) p:w_u8 ( s ) p:w_u16( ms ) else p:w_u8 ( 0 ) end --set_save_marker(p, "save", true, "CTIME") end
coś na lini gdzie jest "t:get " wywala
nie wiem jak to za pomocą skryptu zatrzymać wiem tylko że bassmod dodaje eat_sleepness do skryptu jak to zatrzymam to to może powinno działać ale dlaczego mi czas tak mknie do przodu przeanalizowałem pliki odnośnie snu callbacki itd ale nie wiem co i jak ruszyć
następny crash występuje przez to : xr_combat_ignore.script
j5:
function is_enemy(obj, enemy, st, not_check_sim) if st then if not obj:alive() then return false end
if obj:critically_wounded() then return true end
if st.enabled == false then return true end
local overrides = st.overrides local obj_id = obj:id() local storage = db.storage[obj_id] if storage == nil then return true end storage.enemy_id = enemy:id()
--' Îňńĺčâŕĺě ďî çîíĺ local active_sector = storage.active_sector if active_sector ~= nil then if sr_danger.check_danger_position(enemy:position(), active_sector) == false then -- obj:enable_memory_object( enemy, false ) return false end end
-- Ďđîâĺđęŕ íŕ çîíű ęîěáŕň čăíîđŕ âîçëĺ áŕç: -- čăíîđčđîâŕňü ĺńëč: -- âđŕă íĺ ŕęňĺđ. -- ńňŕëęĺđ íŕőîäčňń˙ â çîíĺ. -- ńěŕđň â ęîňîđîě íŕőîäčňń˙ ńňŕëęĺđ íĺ â ńîńňî˙íčč ňđĺâîăč. if enemy:id() ~= db.actor:id() and not IsMonster(enemy) and character_community(obj) ~= "zombied" and character_community(enemy) ~= "zombied" then for k,v in pairs (smarts_by_no_assault_zones) do local zone = db.zone_by_name[k] if zone and (utils.npc_in_zone(obj, zone) or utils.npc_in_zone(enemy, zone)) then local smart = sim_board.get_sim_board():get_smart_by_name(v) if smart and smart.base_on_actor_control ~= nil and smart.base_on_actor_control.status ~= smart_terrain_control.ALARM then return false end end end end
local se_obj,se_enemy = alife():object(obj_id),alife():object(enemy:id()) if se_obj and se_enemy ~= nil and se_enemy.m_smart_terrain_id ~= nil and se_enemy.m_smart_terrain_id ~= 65535 and se_enemy.m_smart_terrain_id == se_obj.m_smart_terrain_id then local enemy_smart = alife():object(se_enemy.m_smart_terrain_id) local smart_name = enemy_smart:name() if ignored_smart[smart_name] == true then -- obj:enable_memory_object( enemy, false ) return false end end --printf("checking combat_ignore for stalker[%s] enemy name [%s] in section[%s]",obj:name(), enemy:name(),storage.active_section) --' Ĺńëč ĺńňü îâĺđđŕéäű, ňî đŕáîňŕĺě ďî íčě. if overrides and overrides.combat_ignore then local ret_value = xr_logic.pick_section_from_condlist( enemy, obj, overrides.combat_ignore.condlist ) if ret_value == "true" then --printf("pl:Disabling_memory_object[1] for stalker[%s] enemy name [%s] in section[%s]",obj:name(), enemy:name(),storage.active_section) -- obj:enable_memory_object( enemy, false ) return false end return true end return true end end
tuaj jak nie dam "if st then" na początku też gre crashuje ponieważ w logu jest napisane że "st is nil value"
więc moja prośba jest taka jak zmodyfikować dialogi by nie używało tego sleepness gdy gadam z Zulusem i jak naprawić te błędy?? co je może powodować jak wróciłem na chwile na Zaton zabiłem chimerę i wróciłem do Janowa i zaczeły się robić przysłowiowe "krzaki" ... dodam dodatkowo że jak wchodziłem na Janów miałem granat w ręce (nie rzuciłem w nikogo) te z Wolności gdzieś pobiegły i w tym momencie gra się crashowała z tym meet.
dobra bo tutaj i tak dużo będzie do wyjaśniania... bardzo proszę o pomoc
---------------------
Dobra problem ze skryptami rozwiązany co dziwne chodziło o config od Hawajczyka w sensie co sprzedaje nie wiem dlaczego ale coś nie stykało i to powodowało błąd. usunąłem wszystko z supplies_sci itd z tym duty i freedom i zaczeło działać. Udziwnienia Stalkiera
Tylko to z Zulusem.. gdzie mogę znaleźć coś by pozmieniać w dialogach by mi nie zasypiał podczas "gatki" z Zulusem ?
próbowałem if npc:is_talking() then w postprocess_mod ale nie pyka...
co mogę zrobić z tym eat_sleepness ?? załącze skrypt postprocess_mod:
local upd_time = 0 --- апдейтер не трогаем!!! local pret = game.get_game_time() function update() local time = game.get_game_time() sleep_update() if time_global() > upd_time then local delta = time:diffSec(pret) mezaton_update(delta) hunger_update(delta) -- здесь нужен апдейт почаще, хотя бы раз в секунду upd_time = time_global()+810 pret = time end end
local max_wake_time = 24*60*60 -- сколько может продержаться без сна. часы*минуты*секунды local drst = pret local zevoksnd,sleepsnd = sound_object("actor\\zevok"),sound_object("actor\\sleep") local sleepd = nil local sleep_ppe local sleep_updt = 0 function sleep_update() local time = game.get_game_time() if time_global() < sleep_updt then return end sleep_updt = time_global()+6100 if sleepd ~= nil then if sleepd == false then sleepd = nil drst = time end return end local val = xr_logic.pstor_retrieve(db.actor,"drowse",0) local add = time:diffSec(drst)/max_wake_time drst = time val = val+add xr_logic.pstor_store(db.actor,"drowse",val) local power_in = (1-db.actor.power)/10 -- влияние силы на сонливость -- rx_ai.printf("drowse:add %s, val = %s,power_in = %s",add,val,power_in) --не спать вне укрытия во время выброса и за пол часа до него if val > 1-power_in and (surge_manager.actor_in_cover() or (not surge_manager.is_started() and surge_manager.get_surge_manager()._delta > time:diffSec(surge_manager.get_surge_manager().last_surge_time)+1200)) then -- отруб sleepsnd:play(db.actor,0,sound_object.s2d) if val > 1.1 then ui_sleep_dialog.sleep_forced(math.floor(10*val)) --- нажрались водяры? Спим дольше else ui_sleep_dialog.sleep_forced() end sleepd = true elseif val > 0.75-power_in then -- блюр if sleep_ppe ~= 2 then sleep_ppe = 2 level.add_pp_effector("blur.ppe",2017,true) end if math.random(100) > 91 then -- зевок zevoksnd:play(db.actor,0,sound_object.s2d) level.add_cam_effector("camera_effects\\surge_01.anm",1002,false) level.add_pp_effector("zevok.ppe",2018,false) end elseif val > 0.5-power_in then -- двоение if sleep_ppe ~= 1 then sleep_ppe = 1 level.add_pp_effector("sleep.ppe",2017,true) end local m = math.random(100) if m == 99 then -- зевок zevoksnd:play(db.actor,0,sound_object.s2d) end if m > 90 then level.add_pp_effector("zevok.ppe",2018,false) end elseif sleep_ppe then level.remove_pp_effector(2017) sleep_ppe = nil end end
local mez_eff function mezaton_update(delta) -- mezaton local val = xr_logic.pstor_retrieve(db.actor,"mez",nil) if val then local add = delta/3600 val = val-add if val <= 0 then level.remove_complex_effector(1095) db.storage[0].pstor.mez = nil -- rx_ai.printf("mez = 0") else -- rx_ai.printf("mez:store %s",val) xr_logic.pstor_store(db.actor,"mez",val) if not mez_eff then level.add_complex_effector("metazon",1095) mez_eff = true end end end end
local hunger_ppe local satiety_v = tonumber(rx_utils.read_from_ini(nil,"actor_condition","satiety_v",0,1)) function hunger_update(delta) if db.actor:dont_has_info("satiety_sync") then local bs = db.actor:object("bread_script") if bs then db.actor:eat(bs) db.actor:give_info_portion("satiety_sync") -- rx_ai.printf("sync eat") else alife():create("bread_script",db.actor:position(),db.actor:level_vertex_id(),db.actor:game_vertex_id(),db.actor:id()) -- rx_ai.printf("sync spawn") return end end local val = xr_logic.pstor_retrieve(db.actor,"satiety",1) if val <= 0 then val = 0 else val = val-delta*satiety_v end -- rx_ai.printf("satiety %s",val) xr_logic.pstor_store(db.actor,"satiety",val) if val < 0.1 then -- hunger if hunger_ppe ~= 2 then hunger_ppe = 2 -- rx_ai.printf("hunger") level.remove_pp_effector(2019) level.add_complex_effector("hunger",1096) end elseif val < 0.3 then -- hungry if hunger_ppe ~= 1 then hunger_ppe = 1 -- rx_ai.printf("hungry") level.remove_complex_effector(1096) level.add_pp_effector("hungry.ppe",2019,true) end elseif hunger_ppe then level.remove_complex_effector(1096) level.remove_pp_effector(2019) hunger_ppe = nil end end
local wakeupsnd = sound_object("actor\\wakeup") function sleep_callback(hours,mins,forced) rx_ai.printf("sleep:%s:%s (-%s)",hours,mins,hours/16+mins/960) sleepd = false wakeupsnd:play(db.actor,2,sound_object.s2d) local val = xr_logic.pstor_retrieve(db.actor,"drowse",0) val = val-hours/10-mins/600 if val < 0 then val = 0 end xr_logic.pstor_store(db.actor,"drowse",val) val = xr_logic.pstor_retrieve(db.actor,"drowse_cut",0) val = val-hours/16-mins/960 if val < 0 then val = 0 end xr_logic.pstor_store(db.actor,"drowse_cut",val) -- spawn surprise if not forced or surge_manager.actor_in_cover() then rx_ai.printf("not forced or actor_in_cover") return end for i,v in ipairs(no_surprise_zones) do if xr_conditions.actor_in_zone(nil,nil,{[1] = v}) then rx_ai.printf("in ns zone: %s",v) return end end local rnd = 0 local tmp = {} for k,v in pairs(surprise_list) do rnd = rnd+v[1] table.insert(tmp,{sec = k,rnd = rnd}) end rnd = math.random(rnd) local pre = 0 for k,v in ipairs(tmp) do if rnd >= pre and rnd < v.rnd then local sim = alife() local actor_pos,actor_lvid,actor_gvid = db.actor:position(),db.actor:level_vertex_id(),db.actor:game_vertex_id() for i=1,math.random(surprise_list[v.sec][2],surprise_list[v.sec][3]) do local pos = vector():set(actor_pos):add(vector():set(math.random(4,9),0,math.random(4,9))) sim:create(v.sec,pos,actor_lvid,actor_gvid) rx_ai.printf("spawn: %s",v.sec) end break else pre = v.rnd end end end
--[[------ Сдесь определяется сонливость в зависимоти от принятых на грудь литров водки или энергетиков. В принципе можете добавлять любой предмет который можно "съесть". я добавил некоторые медикаменты --]] ------ local function use_sleepiness(add) -- rx_ai.printf("use_sleepiness: %s",add) local val = xr_logic.pstor_retrieve(db.actor,"drowse_cut",0) if val >= 1 and add < 0 then return -- если лимит использования энeргеников исчерпан end if add < 0 then xr_logic.pstor_store(db.actor,"drowse_cut",val-add) end val = xr_logic.pstor_retrieve(db.actor,"drowse",0)+add if val < 0 then val = 0 end xr_logic.pstor_store(db.actor,"drowse",val) end
local function use_satiety(add) -- rx_ai.printf("use_satiety: %s",add) local val = xr_logic.pstor_retrieve(db.actor,"satiety",1) val = val+add if val < 0 then val = 0 elseif val > 1 then val = 1 end xr_logic.pstor_store(db.actor,"satiety",val) end
local function use_mezaton(s) if s == "drug_mezaton" then level.add_complex_effector("metazon",1095) xr_logic.pstor_store(db.actor,"mez",1) mezt = game.get_game_time() mez_eff = true end end
local obj_table = {} function use_obj(obj) local s = obj:section() if not obj_table[s] then obj_table[s] = {} obj_table[s].sleepiness = rx_utils.read_from_ini(nil,s,"eat_sleepiness",0) obj_table[s].satiety = rx_utils.read_from_ini(nil,s,"eat_satiety",0) end if obj_table[s].sleepiness ~= 0 then use_sleepiness(obj_table[s].sleepiness) end if obj_table[s].satiety ~= 0 then use_satiety(obj_table[s].satiety) end use_mezaton(s) end
lite_treshold = 0.05 -- насколько должно уменьшиться здоровье с предыдущего обновления чтоб экран окрасился в красный crit_treshold = 0.30 -- насколько должно уменьшиться здоровье с предыдущего обновления чтоб ГГ начало шатать drop_item_on_crit_prob = 0.20 -- вероятность того что ГГ выронит оружие effector_power_coeff = 0.7 prev_health = -1 chk_h_t = 0
local painsnd = sound_object("actor\\pain_3") function wounded_pp_update() if (chk_h_t or 0) < time_global() then chk_h_t = time_global()+100 if prev_health > (db.actor.health + lite_treshold) then level.add_pp_effector("fire_hit.ppe", 2011, false) local effector_power = (prev_health - db.actor.health)*100*effector_power_coeff level.set_pp_effector_factor(2011, effector_power) if prev_health > db.actor.health + crit_treshold then painsnd:play(db.actor,0,sound_object.s2d) level.add_cam_effector("camera_effects\\fusker.anm", 999, false, "") if math.random() < drop_item_on_crit_prob then local active_item = db.actor:active_item() if active_item and active_item:section() ~= "bolt" and active_item:section()~= "wpn_knife" then db.actor:drop_item(active_item) end end end end prev_health = db.actor.health end end
może i ten skrypt się komukolwiek do czegoś przyda... dokładniej to tutaj zjada ten sen:
the_code:
if obj_table[s].sleepiness ~= 0 then use_sleepiness(obj_table[s].sleepiness) end
jak to się z tymi Dialogami w ogóle robi .. ?? i nie znalazłem jeszcze żadnego poradnika w tym temacie jedyne co to edytowałem jakiś skrypt od dialogów na tym się kończyło..