И снова здравствуйте. Хах, с момента моего сообщения более никто ничего не писал...грустно. (виноват за оффтоп).
Это будет в продолжение моего предыдущего поста. Благодаря
LAKI, таки сумел заставить спавниться броню в НПС после их гибели. Теперь вопрос касается прочности оной. Ибо это как-то ненормально, что она всегда - 100%.
ВНИМАНИЕ: СПОЙЛЕР!
В файле death_manager.script есть кусок:
--printf("item name [%s]", item:name())
if isWeapon(item) and not(get_clsid(item)==clsid.wpn_grenade_rgd5_s or get_clsid(item)==clsid.wpn_grenade_f1_s) then
set_weapon_drop_condition(item)
return
end
if xr_corpse_detection.lootable_table[section] == true and ammo_sections[section] == nil then
return
end
alife():release(alife():object(item:id()), true)
--[
local item_id = item:id()
local item_in_slot = npc:item_in_slot(2)
if item_in_slot ~= nil and item_in_slot:id() == item_id then
--' Тут надо уменьшить кондишн оружия
item:set_condition((math.random(40)+40)/100)
return
end
item_in_slot = npc:item_in_slot(3)
if item_in_slot ~= nil and item_in_slot:id() == item_id then
--' Тут надо уменьшить кондишн оружия
item:set_condition((math.random(40)+40)/100)
return
end
-- npc:mark_item_dropped(item)
local item_in_slot = npc:item_in_slot(4)
if item_in_slot ~= nil and item_in_slot:id() == item_id then
return
end
if not npc:marked_dropped(item) then
-- printf("releasing object ["..item:name().."]")
alife():release(alife():object(item:id()), true)
end
]]
end
function set_weapon_drop_condition(item)
local condition = (math.random(40)+40)/100
--printf("condition [%s]", tostring(condition))
item:set_condition(condition)
end
Как я понял, если оружие - не ручные гранаты, у них будет идти расчёт прочности.
И я подумал, почему бы не добавить в эти расчёты броню.
Вначале я сделал так:
item_in_slot = npc:item_in_slot(7)
if item_in_slot ~= nil and item_in_slot:id() == item_id then
--' Тут надо уменьшить кондишн оружия
item:set_condition((math.random(40)+40)/100)
return
end
7 слот отвечает за броню - outfit. Посмотрел в файле system.ltx.
Не сработало.
После приписал следующее:
function set_outfit_drop_condition(item)
local condition = (math.random(40)+40)/100
--printf("condition [%s]", tostring(condition))
item:set_condition(condition)
end
Тоже не сработало, да и я не уверен, что именно так будет называться броня. Пробовал и слово armor, не сработало.
ТО есть, вся эта кухня выглядит так:
--printf("item name [%s]", item:name())
if isWeapon(item) and not(get_clsid(item)==clsid.wpn_grenade_rgd5_s or get_clsid(item)==clsid.wpn_grenade_f1_s) then
set_weapon_drop_condition(item)
return
end
if xr_corpse_detection.lootable_table[section] == true and ammo_sections[section] == nil then
return
end
alife():release(alife():object(item:id()), true)
--[
local item_id = item:id()
local item_in_slot = npc:item_in_slot(2)
if item_in_slot ~= nil and item_in_slot:id() == item_id then
--' Тут надо уменьшить кондишн оружия
item:set_condition((math.random(40)+40)/100)
return
end
item_in_slot = npc:item_in_slot(3)
if item_in_slot ~= nil and item_in_slot:id() == item_id then
--' Тут надо уменьшить кондишн оружия
item:set_condition((math.random(40)+40)/100)
return
end
item_in_slot = npc:item_in_slot(7)
if item_in_slot ~= nil and item_in_slot:id() == item_id then
--' Тут надо уменьшить кондишн оружия
item:set_condition((math.random(40)+40)/100)
return
end
-- npc:mark_item_dropped(item)
local item_in_slot = npc:item_in_slot(4)
if item_in_slot ~= nil and item_in_slot:id() == item_id then
return
end
if not npc:marked_dropped(item) then
-- printf("releasing object ["..item:name().."]")
alife():release(alife():object(item:id()), true)
end
]]
end
function set_weapon_drop_condition(item)
local condition = (math.random(40)+40)/100
--printf("condition [%s]", tostring(condition))
item:set_condition(condition)
end
function set_outfit_drop_condition(item)
local condition = (math.random(40)+40)/100
--printf("condition [%s]", tostring(condition))
item:set_condition(condition)
end
Что характерно, нет и вылетов. Перепроверял всё с новой игры.
Что подскажете?