Сповіщення
Очистити все
15.10.2023 18:31
1. Відкриваємо файл gamedata/config/misc/items.ltx і в самому кінці пишемо:
[repair_kit]:identity_immunities GroupControlSection = spawn_group discovery_dependency = $spawn = "devices\quest_items\repair_kit" $prefetch = 32 class = II_ANTIR cform = skeleton visual = physics\box\box_1c.ogf radius = 1 description = "Ящик с инструментами для ремонта. Набор содержит инструменты и детали, с помощью которых можно отремонтировать оружие и костюм." inv_name = "Ремонтный набор" inv_name_short = "Ремонтный набор" inv_weight = 3.0 inv_grid_width = 2 inv_grid_height = 2 inv_grid_x = 4 inv_grid_y = 18 cost = 500 eat_health = 0 eat_satiety = 0 eat_power = 0 eat_radiation = 0 eat_alcohol = 0 wounds_heal_perc = 0 eat_portions_num = 3 animation_slot = 4
2. Тепер відкриваємо файл gamedata/scripts/bind_stalker.script і після рядків
function actor_binder:on_item_drop ( obj ) level_tasks.proceed ( self.object ) --game_stats.update_drop_item (obj, self.object)
Пишемо:
exp_mod.itemuse(obj) --Ремонтний набір
3. Тепер у тій же папці створюємо скрипт під назвою exp_mod.script і в ньому пишемо:
------------------------------------------------------------------------ --- Скрипт на использование вещей прямо из инвенторя (в данном случае Ремонтного Набора) --- Работа с bind_stalker.script/actor_binder:on_item_drop/ ------------------------------------------------------------------------ function itemuse(what) local obj_name = what:name() if (string.find(obj_name, "repair_kit")) then use_repair_kit(what) -- If you want to add new trigger item, add script this line. end end ------------------------------------------------------------------------ --- Собственно процесс использования набора ------------------------------------------------------------------------ function use_repair_kit(what) local repair_slot_num = 0 local item_in_slot_1 = db.actor:item_in_slot(1) local item_in_slot_2 = db.actor:item_in_slot(2) local item_in_slot_6 = db.actor:item_in_slot(6) if (item_in_slot_1 ~= nil) then repair_slot_num = 1 end if (item_in_slot_2 ~= nil) then if (repair_slot_num == 0) then repair_slot_num = 2 elseif (repair_slot_num == 1) then if (item_in_slot_1:condition() > item_in_slot_2:condition()) then repair_slot_num = 2 end end end if (item_in_slot_6 ~= nil) then if (repair_slot_num == 0) then repair_slot_num = 6 elseif (repair_slot_num == 1) then if (item_in_slot_1:condition() > item_in_slot_6:condition()) then repair_slot_num = 6 end elseif (repair_slot_num == 2) then if (item_in_slot_2:condition() > item_in_slot_6:condition()) then repair_slot_num = 6 end end end if (repair_slot_num == 1) then local rep_point = item_in_slot_1:condition() + 10 if (rep_point > 1) then rep_point = 1 end item_in_slot_1:set_condition(rep_point) elseif (repair_slot_num == 2) then local rep_point = item_in_slot_2:condition() + 10 if (rep_point > 1) then rep_point = 1 end item_in_slot_2:set_condition(rep_point) elseif (repair_slot_num == 6) then local rep_point = item_in_slot_6:condition() + 10 if (rep_point > 1) then rep_point = 1 end item_in_slot_6:set_condition(rep_point) end end
4. Все! Тепер залишилося додати ремонтний набір до арсеналу торговців (gamedata/config/misc/trade_trader.ltx).