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 | + | local slot_stalker = db.actor:item_in_slot(6) |
− | local | + | 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) | 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") | + | hud:RemoveCustomStatic("hud_gas", false) |
− | + | end | |
− | + | end | |
end</lua> | end</lua> | ||
Теперь поясню: | Теперь поясню: | ||
<lua>function hud_gas() -- функция | <lua>function hud_gas() -- функция | ||
− | local | + | local slot_stalker = db.actor:item_in_slot(6) -- переменная костюма |
− | local | + | 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 -- проверяем надет ли костюм сталкера\наемника | |
− | hud:AddCustomStatic("hud_gas", true) | + | local hud = get_hud() -- худ |
− | + | local custom_static = hud:GetCustomStatic("hud_gas") | |
− | + | if custom_static == nil then -- если худа нет, выдаем, если одет костюм | |
− | + | hud:AddCustomStatic("hud_gas", true) | |
− | + | end | |
− | + | else | |
− | hud:RemoveCustomStatic("hud_gas") | + | local hud = get_hud() |
− | + | local custom_static = hud:GetCustomStatic("hud_gas") | |
− | + | 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 Вот и все! Начинаем новую игру, ищем костюм сталкера или наемника, надеваем и видим вашу текстуру.