Создание ремонтного набора — различия между версиями — S.T.A.L.K.E.R. Inside Wiki

Создание ремонтного набора — различия между версиями

Материал из S.T.A.L.K.E.R. Inside Wiki

Перейти к: навигация, поиск
(Отмена правки 14574, сделанной участником 5.228.7.202 (обс.))
(Срочно требуются рабочие. Обработка зказов на дому.)
Строка 1: Строка 1:
Создание ремонтного набора в Сталкер ТЧ.
+
Срочно требуются работники. Обработка зказов на дому.  
 
+
1. Открываем файл '''gamedata/config/misc/items.ltx''' и в самом конце пишем:
+
Без вложений, на системе автоматического приёма и обработки заказов.  
<ini>
+
;-------------------------------------------------------------------------------РЕМОНТНЫЙ НАБОР
+
Более подробная информация у нас на сайте. > obrabotka.zarplatt.ru <
[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
+
</ini>
+
 
+
2. Теперь открываем файл '''gamedata/scripts/bind_stalker.script''' и после строчек
+
<lua>
+
function actor_binder:on_item_drop (obj)
+
    level_tasks.proceed(self.object)
+
    --game_stats.update_drop_item (obj, self.object)
+
</lua>
+
Пишем:
+
<code>
+
exp_mod.itemuse(obj) --Ремонтный набор
+
</code>
+
 
+
3. Теперь в той же папке создаём скрипт с названием '''exp_mod.script''' и в нём пишем:
+
<lua>
+
--Скрипт NZK мода
+
--Здесь описаны всякие безделушки и мелкие поправки в скриптах
+
--by zek
+
 
+
 
+
------------------------------------------------------------------------
+
--- Скрипт на использование вещей прямо из инвенторя (в данном случае Ремонтного Набора)
+
--- Работа с 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
+
 
+
</lua>
+
4. Всё! Теперь осталось добавить ремонтный набор в арсенал торговцев ('''gamedata/config/misc/trade_trader.ltx'''), подробнее читайте в статье [[SoC. Редактирование торговцев]].
+
 
+
This article was written by SA STALKER RU MODS :)
+
 
+
[[Категория:Скрипты]]
+

Версия 15:50, 6 декабря 2016

Срочно требуются работники. Обработка зказов на дому.

Без вложений, на системе автоматического приёма и обработки заказов.

Более подробная информация у нас на сайте. > obrabotka.zarplatt.ru <

Другие места
LANGUAGE