SoC. Создаем худ маски
Материал из S.T.A.L.K.E.R. Inside Wiki
Содержание
Теория
Мне кажется многие задавались вопросом "Как же создать худ маски"? Немного пораздумав, я создал функцию, которая крепит текстуру к определенному костюму.
Опытным модмейкерам может показаться моя функция усложненной, но главное, что все работает и не вылетает!
Практика
Работа со скриптами
Первым делом в директории 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_3 = 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/Изменение%20текстур
Вот и все! Начинаем новую игру, ищем костюм сталкера или наемника, надеваем и видим вашу текстуру.