Сповіщення
Очистити все
03.11.2023 23:53
Автор: Xmk
Для цього нам знадобляться файли ( AMK Mod ):
config/misc/items.ltx
config/text/ukr/string_table_enc_equipment.xml
scripts/amk.script
script/amk_mod.script
1. Створюємо файл вашу_назву_скрипта.script у папці gamedata/scripts і пишемо в нього:
snd = sound_object([[ambient\underground\rnd_giant]]) -- Проверяем нужно ли покурить. Вызывается каждые 6 игровых минут function test_for_need_kur() amk.save_variable("kur",amk.load_variable("kur",0)+1) amk.g_start_timer("kur",0,0,6) kur_reduce_health() end -- Уменьшение здоровья, если долго не курил function kur_reduce_health() local tmp = amk.load_variable("kur",0) if tmp > 150 then if db.actor.health > 0.15 then db.actor.health = - 0.15 end if not snd:playing() then snd:play_at_pos(db.actor, vector():set(0,0,0), 0, sound_object.s2d) end end end -- Курение function kur_item(oid, time) if alife():object(oid)==nil then local tmp = amk.load_variable("kur",0) - time*10 if tmp < 0 then tmp = 0 end amk.save_variable("kur", tmp) kur_reduce_health() end end
2. Відкриваємо файл amk.script :
після:
function __do_timer_action ( select_string,params_string )
пишемо:
if select_string== "kur" then назва_вашого_скрипта.test_for_need_kur ( ) end
3. Відкриваємо файл amk_mod.script у функції first_run пишемо:
amk.g_start_timer ( "kur" , 0 , 0 , 6 )
потім у функції check_sleep_item(obj) після
elseif section== "treasure_item" then stype= "tr_item"
але перед end пишемо:
elseif section == "sigaret" then stype = "sgr"
4. Відкриваємо файл items.ltx
[sigaret]:identity_immunities GroupControlSection = spawn_group discovery_dependency = $spawn = "food and drugs\antirad" $prefetch = 32 class = II_ANTIR cform = skeleton visual = weapons\sigaret\sigaret.ogf inv_name = sigareta inv_name_short = sigareta description = enc_food_sigareta inv_weight = 0.02 inv_grid_width = 1 inv_grid_height = 2 inv_grid_x = 10 inv_grid_y = 24 cost = 50 ; eatable item eat_health = 0 eat_satiety = 0 eat_power = 0 eat_radiation = 0 eat_alcohol = 0 wounds_heal_perc = 0 eat_portions_num = 1 ; food item animation_slot = 4 ;hud item hud = wpn_vodka_hud
5. Відкриваємо файл string_table_enc_equipment.xml
<string id = "sigareta" > <text > Цигарка </text > </string > <string id = "enc_food_sigareta" > <text > Пишемо будь-який опис сигарети, мені щось на думку нічим не спадає </text > </ string >