Четверг, 25.12.2025, 15:44 Вы вошли как Бодяга | Группа "Гости"Приветствую Вас Бодяга

PDA
Бодяга



Бродяга, стой!
Чего плутаешь там?
Заходи: согрейся, выпей...пообщаемся)
Садись, давай знакомится.
Регистрация

Меню сайта
Наш опрос
Оцените мой сайт
Всего ответов: 56
Администрация

Администратор сайта:
Email | Профиль
tema796: 368422105
Skype: тема на
Мой статус
Новый год

Статистика


[ Новые сообщения · Участники · Правила форума · Поиск · RSS ]
  • Страница 1 из 1
  • 1
Добавляем в игру mp3 player
tema796Дата: Понедельник, 24.10.2011, 13:40 | Сообщение # 1
Главарь сайта
Группа: Администраторы
Сообщений: 85
Награды: 1
Репутация: 2
Статус: Вне зоны
Из SGM мода понадобятся следующие файлы:

· 1. Конфиги:

o configs\ui\ui_mod_elements.xml

o configs\ui\ui_mod_elements_16.xml

o configs\ui\textures_descr\ui_mod_wnds.xml

· 2. 3d модель:

o meshes\dynamics\mod_items\mp3_player.ogf

· 3. Звуки

o sounds\Бонусы

o sounds\Веселая

o sounds\Клубная

o sounds\Саундтреки

o sounds\Сталкерская

· 4. Текстуры:

o textures\new\new_bl.dds

o textures\new\new_mp3.dds

o textures\ui\ui_mod_wnds_1.dds

· 5. Скрипты:

o scripts\_g.script

o scripts\sgm_functions.script

o scripts\sgm_variables.script

o scripts\ui_mod_elements.script



Если переносите в другой мод, а не в чистую игру из файла _g.script придется по отдельности перенести недостающие функции.



Из Оригинальной игры (или мода) нужны файлы:

· 1. Конфиги:

o configs\misc\items.ltx

· 2. Скрипты:

o scripts\bind_stalker.script



Теперь в добавим объект МП3 плеер в игру, для этого добавим секцию в файл items.ltx



[mp3_player]:identity_immunities

GroupControlSection = spawn_group

discovery_dependency =

$spawn = "devices\quest_items\mp3_player"

$prefetch = 32

class = II_ANTIR

cform = skeleton

visual = dynamics\mod_items\mp3_player.ogf

description = st_player_descr

inv_name = st_player

inv_name_short = st_player

inv_weight = 0.05

inv_grid_width = 1

inv_grid_height = 1

inv_grid_x = 14

inv_grid_y = 34

cost = 3200

eat_health = 0

eat_satiety = 0

eat_power = 0

eat_radiation = 0

wounds_heal_perc = 0

eat_portions_num = 1

animation_slot = 4

hud = wpn_vodka_hud



Добавим обработку использования предмета в bind_stalker.script после строк:



if(obj) then

local s_obj = alife():object(obj:id())

if(s_obj) and (s_obj:section_name()=="drug_anabiotic") then

xr_effects.disable_ui_only(db.actor, nil)

level.add_cam_effector("camera_effects\\surge_02.anm", 10, false, "bind_stalker.anabiotic_callback")

level.add_pp_effector("surge_fade.ppe", 11, false)

give_info("anabiotic_in_process")

_G.mus_vol = get_console():get_float("snd_volume_music")

_G.amb_vol = get_console():get_float("snd_volume_eff")

get_console():execute("snd_volume_music 0")

get_console():execute("snd_volume_eff 0")

end

end





добавим:



if obj~=nil then

callbacks.on_use_item(obj)

end



Создадим файл скрипта callbacks.script следующего содержания:



function on_use_item(sect)

local item_name=sect:section()

if item_name=="mp3_player" then

give_info("mp3_player_active")

-- Добавлена начальная установка уровня громкости

sgm_functions.write_variable("mp3_currert_volume",0.6)

run_dynamic_element(ui_mod_elements.mp3_player(),true)

end

end



Для того чтобы работал таймер в плеере нужно в файле ui_mod_elements.script в функции mp3_update() добавить в начало:



if mp3_plays~=nil then

mp3_length_position=string.format(math.floor(time_global()/1000))-mp3_last_position

end



И в файле bind_stalker.script в функции actor_binder:update(delta) добавить в начало:



ui_mod_elements.mp3_update()



Для ограничения на уровни громкости нужно в файле ui_mod_elements.script в функции mp3_player:btn_volume_minus() после:



sgm_functions.write_variable("mp3_currert_volume",sgm_functions.read_variable("mp3_currert_volume")-mp3_add_value)



добавить:



if sgm_functions.read_variable("mp3_currert_volume")~=nil and sgm_functions.read_variable("mp3_currert_volume")<0.0 then

sgm_functions.write_variable("mp3_currert_volume",0.0)

elseif sgm_functions.read_variable("mp3_currert_volume")~=nil and sgm_functions.read_variable("mp3_currert_volume")>1.0 then

sgm_functions.write_variable("mp3_currert_volume",1.0)

end



И в функции mp3_player:btn_volume_plus() после:



sgm_functions.write_variable("mp3_currert_volume",sgm_functions.read_variable("mp3_currert_volume")+mp3_add_value)



добавить:



if sgm_functions.read_variable("mp3_currert_volume")~=nil and sgm_functions.read_variable("mp3_currert_volume")<0.0 then

sgm_functions.write_variable("mp3_currert_volume",0.0)

elseif sgm_functions.read_variable("mp3_currert_volume")~=nil and sgm_functions.read_variable("mp3_currert_volume")>1.0 then

sgm_functions.write_variable("mp3_currert_volume",1.0)

end



Для того, чтобы все работало как следует нужно:

1. Начальную установку уровня громкости нужно перенести в какой либо скипт выполняющийся один раз при старте игры.

2. Описать в xml все текстовые переменные: название предмета, описание, названия кнопок и подсказки.

3. Сделать иконку плеера и зарегистрировать ее.


"Мы не будем играть в crysis 2 мы будем играть stalker 2"
by tema796
 
  • Страница 1 из 1
  • 1
Поиск:

Block title
Прием в группировки
Долг
Явно военизированная группировка, отличающаяся строгой дисциплиной.Каждый долговец считает своей главной целью - защиту мира от воздействия Зоны.Они изучают ее,что бы уничтожить

Лидер: REGUL
Вступить в группировку
Активист месяца
Техник месяца - GoogleРолевик месяца - Odino4ka
Мини чат
Музыка
Друзья сайта
Народный портал модостроения Xabara.net Добро пожаловать в Зону Портал по STALKER S.T.A.L.K.E.R. Очень много полезной инфы по S.T.A.L.K.E.Rу Баннерообмен
Вступай!


Отборочный пункт

Block title
[b]ТЕКСТ ВАШЕГО ПРИВЕТСТВИЯ[/b]
Конструктор сайтовuCoz