SoC. Создаем худ маски — различия между версиями — S.T.A.L.K.E.R. Inside Wiki

SoC. Создаем худ маски — различия между версиями

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

Перейти к: навигация, поиск
(перевёл в незаконченные, скрипт неправильный)
(Исправил скрипт, перевел в скрипты.)
Строка 9: Строка 9:
  
 
Первым делом в директории '''gamedata\scripts''' создайте файл с названием '''xr_mask.script'''
 
Первым делом в директории '''gamedata\scripts''' создайте файл с названием '''xr_mask.script'''
Открываем его и пишем:
+
Открываем его пишем:
 
<lua>function hud_gas()
 
<lua>function hud_gas()
   local slot = db.actor:item_in_slot(6)
+
   local slot_stalker = db.actor:item_in_slot(6)
   local object = db.actor:object("stalker_outfit") or db.actor:object("killer_outfit")
+
   local object_1 = db.actor:object("stalker_outfit")
      if slot ~= nil and object ~= nil then
+
  local slot_killer = db.actor:item_in_slot(6)
                local hud = get_hud()
+
  local object_2 = db.actor:object("killer_outfit")
                local custom_static = hud:GetCustomStatic("hud_gas")
+
    if slot_stalker and slot_stalker:section() == "stalker_outfit" and object_1 ~= nil or
                if custom_static == nil then
+
    slot_killer and slot_killer:section() == "killer_outfit" and object_2 ~= nil then
 +
            local hud = get_hud()
 +
            local custom_static = hud:GetCustomStatic("hud_gas")
 +
            if custom_static == nil then
 
                         hud:AddCustomStatic("hud_gas", true)
 
                         hud:AddCustomStatic("hud_gas", true)
                end
+
            end
        else
+
    else
                local hud = get_hud()
+
            local hud = get_hud()
                local custom_static = hud:GetCustomStatic("hud_gas")
+
            local custom_static = hud:GetCustomStatic("hud_gas")
                if custom_static ~= nil then
+
            if custom_static ~= nil then
                         hud:RemoveCustomStatic("hud_gas")
+
                         hud:RemoveCustomStatic("hud_gas", false)
                end
+
            end
        end
+
      end
 
end</lua>
 
end</lua>
  
 
Теперь поясню:
 
Теперь поясню:
 
<lua>function hud_gas() -- функция
 
<lua>function hud_gas() -- функция
   local slot = db.actor:item_in_slot(6) -- переменная - слот костюмов
+
   local slot_stalker = db.actor:item_in_slot(6) -- переменная костюма
   local object = db.actor:object("stalker_outfit") or db.actor:object("killer_outfit") -- переменная объектов, если именно этот костюм одет, запускаем текстуру
+
   local object_1 = db.actor:object("stalker_outfit") -- переменная объекта
      if slot ~= nil and object ~= nil then -- соединяем переменную - слот костюмов и переменную объектов
+
  local slot_killer = db.actor:item_in_slot(6) -- переменная костюма
                local hud = get_hud() -- переменная худа
+
  local object_2 = db.actor:object("killer_outfit") -- переменная объекта
                local custom_static = hud:GetCustomStatic("hud_gas") -- переменная худа в XML - описателе
+
    if slot_stalker and slot_stalker:section() == "stalker_outfit" and object_1 ~= nil or
                if custom_static == nil then -- проверяем переменную худа в XML описателе
+
    slot_killer and slot_killer:section() == "killer_outfit" and object_2 ~= nil then -- проверяем надет ли костюм сталкера\наемника
                         hud:AddCustomStatic("hud_gas", true) -- тоже самое переменная худа в XML - описателе и ниже тому подобное
+
            local hud = get_hud() -- худ
                end
+
            local custom_static = hud:GetCustomStatic("hud_gas")
        else
+
            if custom_static == nil then -- если худа нет, выдаем, если одет костюм
                local hud = get_hud()
+
                         hud:AddCustomStatic("hud_gas", true)
                local custom_static = hud:GetCustomStatic("hud_gas")
+
            end
                if custom_static ~= nil then
+
    else
                         hud:RemoveCustomStatic("hud_gas")
+
            local hud = get_hud()
                end
+
            local custom_static = hud:GetCustomStatic("hud_gas")
        end
+
            if custom_static ~= nil then -- если худ есть, убираем при смене костюма
 +
                         hud:RemoveCustomStatic("hud_gas", false)
 +
            end
 +
      end
 
end</lua>
 
end</lua>
  
Строка 80: Строка 86:
 
Открываем программой '''Adobe Photoshop''' и рисуем подходящую для вас маску.
 
Открываем программой '''Adobe Photoshop''' и рисуем подходящую для вас маску.
 
Как работать с текстурами описано в этой статье:
 
Как работать с текстурами описано в этой статье:
 +
 
http://www.stalkerin.gameru.net/wiki/index.php/%D0%98%D0%B7%D0%BC%D0%B5%D0%BD%D0%B5%D0%BD%D0%B8%D0%B5_%D1%82%D0%B5%D0%BA%D1%81%D1%82%D1%83%D1%80
 
http://www.stalkerin.gameru.net/wiki/index.php/%D0%98%D0%B7%D0%BC%D0%B5%D0%BD%D0%B5%D0%BD%D0%B8%D0%B5_%D1%82%D0%B5%D0%BA%D1%81%D1%82%D1%83%D1%80
 
Вот и все! Начинаем новую игру, ищем костюм сталкера или наемника, надеваем и видим вашу текстуру.
 
Вот и все! Начинаем новую игру, ищем костюм сталкера или наемника, надеваем и видим вашу текстуру.
  
 
===Автор: Weanchester===
 
===Автор: Weanchester===
[[Категория:Незаконченные статьи]]
+
[[Категория:Скрипты]]

Версия 07:16, 6 июня 2011

Теория

Мне кажется многие задавались вопросом "Как же создать худ маски"? Немного пораздумав, я создал функцию, которая крепит текстуру к определенному костюму.

Опытным модмейкерам может показаться моя функция усложненной, но главное, что все работает и не вылетает!

Практика

Работа со скриптами

Первым делом в директории gamedata\scripts создайте файл с названием xr_mask.script Открываем его пишем:

function hud_gas()
   local slot_stalker = db.actor:item_in_slot(6)
   local object_1 = db.actor:object("stalker_outfit")
   local slot_killer = db.actor:item_in_slot(6)
   local object_2 = db.actor:object("killer_outfit")
    if slot_stalker and slot_stalker:section() == "stalker_outfit" and object_1 ~= nil or
    slot_killer and slot_killer:section() == "killer_outfit" and object_2 ~= nil then
            local hud = get_hud()
            local custom_static = hud:GetCustomStatic("hud_gas")
            if custom_static == nil then
                        hud:AddCustomStatic("hud_gas", true)
            end
     else
            local hud = get_hud()
            local custom_static = hud:GetCustomStatic("hud_gas")
            if custom_static ~= nil then
                        hud:RemoveCustomStatic("hud_gas", false)
            end
      end
end

Теперь поясню:

function hud_gas() -- функция
   local slot_stalker = db.actor:item_in_slot(6) -- переменная костюма
   local object_1 = db.actor:object("stalker_outfit") -- переменная объекта
   local slot_killer = db.actor:item_in_slot(6) -- переменная костюма
   local object_2 = db.actor:object("killer_outfit") -- переменная объекта
    if slot_stalker and slot_stalker:section() == "stalker_outfit" and object_1 ~= nil or
    slot_killer and slot_killer:section() == "killer_outfit" and object_2 ~= nil then -- проверяем надет ли костюм сталкера\наемника
            local hud = get_hud() -- худ
            local custom_static = hud:GetCustomStatic("hud_gas")
            if custom_static == nil then -- если худа нет, выдаем, если одет костюм
                        hud:AddCustomStatic("hud_gas", true)
            end
     else
            local hud = get_hud()
            local custom_static = hud:GetCustomStatic("hud_gas")
            if custom_static ~= nil then -- если худ есть, убираем при смене костюма
                        hud:RemoveCustomStatic("hud_gas", false)
            end
      end
end

Теперь зайдем в bind_stalker.script, который находится в gamedata\scripts, найдем функцию: function actor_binder:update(delta) и после пишем: xr_mask.hud_gas() в итоге:

function actor_binder:update(delta)
        xr_mask.hud_gas()
	object_binder.update(self, delta)
        local time = time_global()
        game_stats.update (delta, self.object)

Работа с XML - описателем

Итак, заходим в директорию gamedata\config\ui, находим файл с названием ui_custom_msgs, открываем его и в самом конце перед строкой: </header> пишем:

<hud_gas x="0" y="0" width="1024" height="768" stretch="1">
    <texture>hud\hud_gas</texture>
  </hud_gas>

Теперь поясню:

<hud_gas x="0" y="0" width="1024" height="768" stretch="1">
    <texture>hud\hud_gas</texture> -- текстура маски. Посмотрите внимательно в скрипте мы указывали '''hud_gas'''
  </hud_gas>

Текстура

Теперь заходим в gamedata\textures\ui, находим файл с названием ui_mainmenu.dds. Копируем его, заходим в gamedata\textures\hud вставляем его и переминуем в hud_gas.dds Открываем программой Adobe Photoshop и рисуем подходящую для вас маску. Как работать с текстурами описано в этой статье:

http://www.stalkerin.gameru.net/wiki/index.php/%D0%98%D0%B7%D0%BC%D0%B5%D0%BD%D0%B5%D0%BD%D0%B8%D0%B5_%D1%82%D0%B5%D0%BA%D1%81%D1%82%D1%83%D1%80 Вот и все! Начинаем новую игру, ищем костюм сталкера или наемника, надеваем и видим вашу текстуру.

Автор: Weanchester

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