Colder 12 Опубликовано 12 Июня 2021 (изменено) Не получаеться( или мозгов не хватает! Делаю так: Скрытый текст function transfer_all_to_box() local level_obj_by_id = level.object_by_id local box = level_obj_by_id(id) db.actor:iterate_inventory(function(actor, item) db.actor:transfer_item(item, box) end, db.actor) end Звук есть что перекладывает, но не чего не происходит. Изменено 12 Июня 2021 пользователем Colder Поделиться этим сообщением Ссылка на сообщение
Colder 12 Опубликовано 14 Июня 2021 (изменено) Есть у кого нибуть пример как вывести в гуи окне, полоску состояния оружия? Есть вот такая фунция но незнаю как её использовать: Скрытый текст function repair_dialog:DrawConditionRemBar(de_item, x, y) if x == nil then x = 0 end if y == nil then y = 0 end local cond_rem_bar_width = 0 if de_item then cond_rem_bar_width = (math.floor(de_item:condition()*100)*1.1) x = x - 55 --(cond_rem_bar_width/2) local c = self.cond_rem_bar if not c then self.cond_rem_bar = CUIStatic() c = self.cond_rem_bar c:SetWindowName("cond_rem_bar") c:SetAutoDelete(true) c:InitTexture("ui\\cop\\ui_cop_hint_wnd") c:SetOriginalRect(678,153,110,7) c:SetStretchTexture(true) self:AttachChild(c) end if cond_rem_bar_width > 109 then cond_rem_bar_width = 109 elseif cond_rem_bar_width <= 0 then cond_rem_bar_width = 1 end c:SetOriginalRect(677+cond_rem_bar_width,153,1,7) c:Init(x,y,cond_rem_bar_width,7) else c:Init(0,0,0,0) end end Изменено 14 Июня 2021 пользователем Colder Поделиться этим сообщением Ссылка на сообщение
Colder 12 Опубликовано 16 Июня 2021 @Rod_K Тебе нужно просто время перемотать или перемотать когда спишь? Поделиться этим сообщением Ссылка на сообщение
Colder 12 Опубликовано 16 Июня 2021 (изменено) @Rod_K как то так: Скрытый текст k = 1000 --// перемотать function reg_time() t = xr_logic.pstor_retrieve(db.actor, "t", 0) t = t + k level.set_time_factor(t) xr_logic.pstor_store(db.actor, "t", t) news_manager.send_tip(db.actor, "%c[25,240,25,25]Таймфактор увеличен до "..t.."", nil, nil, 5000) end --// остановить function stop_time() level.set_time_factor(10) xr_logic.pstor_store(db.actor, "t", 0) news_manager.send_tip(db.actor, "%c[0,0,255,25]Таймфактор стандартный", nil, nil, 5000) end Увеличь "k" будет быстрее Изменено 16 Июня 2021 пользователем Colder 1 1 Поделиться этим сообщением Ссылка на сообщение
Colder 12 Опубликовано 25 Июня 2021 Можно ли скриптово, переместить актора на другую локацию без использования спавна? Или где можно подсмотреть подобное? Поделиться этим сообщением Ссылка на сообщение
Colder 12 Опубликовано 4 Октября 2021 Подскажите финкцию для открытия окна торговли (ТЧ). Функция trade_init почему-то не работает. Поделиться этим сообщением Ссылка на сообщение
Colder 12 Опубликовано 26 Октября 2021 Подскажите в чем проблема. Пытаюсь вывести прогресс бар для каждого слота но не могу выровнить шкалу. Пишу так: Скрытый текст local slots = { [1] = {100, 190}, [2] = {330, 190}, [4] = {330, 440}, [6] = {170, 400}, } for num, xy in pairs(slots) do local item = db.actor:item_in_slot(num) if item then local item_sect = item:section() local x, y, width, height, y_fix, x_fix, w_fix = axr_base.icon_new_pos(item_sect, num) --// окно local weapon_tex = CUIStatic() self:AttachChild(weapon_tex) local wnd_x, wnd_y = unpack(xy) weapon_tex:Init(wnd_x + x_fix, wnd_y + y_fix, w_fix * f_size, height * f_size) --// текстура weapon_tex:InitTexture("ui\\ui_icon_equipment") weapon_tex:SetStretchTexture(true) weapon_tex:SetOriginalRect(x, y, width, height) --// прогресс local wpn_condition_progress = 0 local bar = xml:InitProgressBar("bar_frame", weapon_tex) wpn_condition_progress = item:condition()*100 bar:SetProgressPos(wpn_condition_progress) -- имя local wnd_name = "repair_wpn_" .. num self:Register(xml:Init3tButton(wnd_name, self), wnd_name) self:AddCallback("repair_wpn_" ..num, ui_events.BUTTON_CLICKED, function() self:repair_wpn(num) end, self) Скрытый текст <bar_frame_ x="50" y="50" width="56" height="5" horz="1" min="0" max="100" pos="1"> <background> <texture>ui_cop_Game_progress_efficiency_full</texture> </background> <min_color r="86" g="196" b="209"/> <middle_color r="86" g="196" b="209"/> <max_color r="86" g="196" b="209"/> <progress> <texture>ui_cop_item_cond</texture> </progress> </bar_frame> Итог: https://yadi.sk/i/AH1ZOpH45nyQXQ Поделиться этим сообщением Ссылка на сообщение
Colder 12 Опубликовано 27 Октября 2021 (изменено) @naxac Мне нужно выровнить шкалу! А не иконку. Изменено 27 Октября 2021 пользователем Colder Поделиться этим сообщением Ссылка на сообщение
Colder 12 Опубликовано 27 Октября 2021 Вот я и не могу сдвинуть сам прогресс Поделиться этим сообщением Ссылка на сообщение
Colder 12 Опубликовано 3 Ноября 2021 Может кто подсказать, почему сообщение приходит из секции патронов а не так как в text(имя) ? Скрытый текст function on_weapon_ammo(wpn) local active_item = db.actor:item_in_slot(db.actor:active_slot()) if active_item then local ammo_type = ca_get_weapon_ammo_type( alife():object(wpn:id())) local section_ammo = ca_ammo_by_num(wpn:section(),ammo_type) if section_ammo~=nil and string.find(section_ammo,"ammo") then get_hud():AddCustomStatic("text2", true):wnd():SetText("%c[cyan]"..gts("st_ammo_string_0_1").."\\n".."%c[default]"..gts(section_ammo)) end end end Поделиться этим сообщением Ссылка на сообщение
Colder 12 Опубликовано 3 Ноября 2021 И еще вопрос. Можно как-то исправить длинющий вывод condition оружия https://yadi.sk/i/2KXBYb8CstNu4Q Скрытый текст function weapon_info() local time = time_global() if time_add == nil then time_add = time_global() + time_update end local active_slot = act:active_item() if active_slot and act:active_slot()==2 then if time > time_add then time_add = time_global() + time_update local sect = act:item_in_slot(2):section() local name = tostring(system_ini():r_string(sect,"inv_name_short")) condition = act:item_in_slot(2):condition() local text = "\\n%c[white]Текущее оружие: \\n%c[d_green]"..gts(tostring(name)).."\\n%c[d_cyan]состояние : "..gts(tostring(condition)) act:give_game_news(text,"ui\\cop\\ui_cop_iconstotal",Frect():set(664,329,83,47),150,5000) end time_add = nil end end Поделиться этим сообщением Ссылка на сообщение
Colder 12 Опубликовано 9 Ноября 2021 Возможно ли скриптово отследить удар ножом (ТЧ) Поделиться этим сообщением Ссылка на сообщение
Colder 12 Опубликовано 28 Ноября 2021 Всем привет. Возможно ли в рексисторе проверить нахождение в нем мутантов? Поделиться этим сообщением Ссылка на сообщение
Colder 12 Опубликовано 29 Ноября 2021 Подскажите откуда можно вытащить скрипт отлова мини-карты? Поделиться этим сообщением Ссылка на сообщение
Colder 12 Опубликовано 30 Ноября 2021 Создал фриплейный старт игры https://yadi.sk/i/ya2rFPr8BFbS-A Пытаюсь заспавнить предметы в инвентарь так: Скрытый текст Сама кнопка function ui_main_menu_new:novice_on_start() local console = get_console() console:execute("g_game_difficulty gd_novice") self:StartGame() start_game_novice() end Функция function start_game_novice() local spawn_items = { "wpn_pm", "medkit", "conserva", "zvezda_2", "bandage" } for i = 1,2 do table.insert(spawn_items, "ammo_9x18_fmj") end local k,v = 0,0 for k,v in pairs(spawn_items) do alife():create(v, db.actor:position(), db.actor:level_vertex_id(), db.actor:game_vertex_id(), db.actor:id()) end end Может кто подсказать как все таки заспавнить предметы. Скрытый текст function start_game_novice() local ini = ini_file("misc\\items_link.ltx") if not ini then ini=system_ini() end if ini:section_exist("generic_list") then local n = ini:line_count("generic_list") local key = math.random(0,n-1) local result, item, num = ini:r_line("generic_list",key,"","") return item, num end end в ltx [generic_list] wpn_pm = 0.7 Тоже не выходит Поделиться этим сообщением Ссылка на сообщение
Colder 12 Опубликовано 16 Декабря 2021 (изменено) Прошу помощи! Не срабатывает проверка: Скрытый текст function generic_object_binder:use_callback(obj, who) if self.use_flag == nil and self.object:section()~="m_trader" then self.object:set_nonscript_usable(false) self.use_flag = true end if self.object:alive() or self.used then return end local knife = who:item_in_slot(0) if who:id() ~= db.actor:id() or (knife~=nil and who:active_slot() == 0) then local wnd = mutant_lut.MutaNTlut(obj,who) level.start_stop_menu(wnd, true) wnd.owner = self self.used = true else news_manager.send_tip(db.actor,"1 есть!") if db.actor:item_in_slot(0):condition() <= 0.20 then news_manager.send_tip(db.actor,"2 есть!") end return end end Изменено 16 Декабря 2021 пользователем Colder Поделиться этим сообщением Ссылка на сообщение
Colder 12 Опубликовано 26 Декабря 2021 Можно ли скриптово откл. автоматическое перемещение костюмов в слот или это движковая правка? Поделиться этим сообщением Ссылка на сообщение
Colder 12 Опубликовано 29 Декабря 2021 При попытке загрузить игру получаю вылет: Скрытый текст Expression : fatal error Function : CScriptEngine::lua_error File : E:\stalker\sources\trunk\xr_3da\xrGame\script_engine.cpp Line : 73 Description : <no expression> Arguments : LUA error: ...Oaiu ?a?iiauey\gamedata\scripts\dxr_inventory.script:132: attempt to index global 'wpn1' (a nil value) Вот сам скрипт: Скрытый текст local rec_wnd = nil local initial = false class "InvenToryWindow" (CUIScriptWnd) function InvenToryWindow:__init(owner) super() self.owner = owner self:Init(0,0,1024,768) self:InitControls() end --// --------------------------------------------------------------------- function InvenToryWindow:__finalize() end --// --------------------------------------------------------------------- function InvenToryWindow:InitControls() self.stat = CUIStatic() self.stat:Init(0,0,1024,768) self.owner:AttachChild(self.stat) local xml = CScriptXmlInit() xml:ParseFile("inventory_new.xml") self.fast_use_slots_wnd = axr_keylogger_use_slot.FastUseSlotsWnd(self) self.stat:AttachChild(self.fast_use_slots_wnd) wpn1 = xml:InitProgressBar("wpn1_condition_progress", self.stat) wpn1:Show(false) wpn2 = xml:InitProgressBar("wpn2_condition_progress", self.stat) wpn2:Show(false) wpn3 = xml:InitProgressBar("wpn3_condition_progress", self.stat) wpn3:Show(false) wpn4 = xml:InitProgressBar("wpn4_condition_progress", self.stat) wpn4:Show(false) outfit = xml:InitProgressBar("outfit_condition_progress", self.stat) outfit:Show(false) wpn8 = xml:InitProgressBar("wpn8_condition_progress", self.stat) wpn8:Show(false) wpn9 = xml:InitProgressBar("wpn9_condition_progress", self.stat) wpn9:Show(false) wpn10 = xml:InitProgressBar("wpn10_condition_progress", self.stat) wpn10:Show(false) initial = true end --// --------------------------------------------------------------------- function InvenToryWindow:ShowWnd() if initial and rec_wnd.stat~= nil then rec_wnd.stat:Show(true) end end --// --------------------------------------------------------------------- function InvenToryWindow:HideWnd() if initial and rec_wnd.stat~= nil then rec_wnd.stat:Show(false) end end --// --------------------------------------------------------------------- function InvenToryWindow:DetachWnd() self.owner:DetachChild(self.stat) initial = false end --// --------------------------------------------------------------------- local inventory_window function on_info(info_id) if info_id=="ui_inventory" then inventory_window = level.main_input_receiver() if not initial then rec_wnd = InvenToryWindow(level.main_input_receiver()) end if not rec_wnd.stat:IsShown() then rec_wnd:ShowWnd() end elseif info_id=="ui_inventory_hide" then if rec_wnd then rec_wnd:DetachWnd() end end end --// --------------------------------------------------------------------- function on_update() if db.actor:has_info("ui_inventory") then local wpn1_condition_progress = 0 local wpn_1 = db.actor:item_in_slot(1) if wpn_1 then wpn1_condition_progress = wpn_1:condition()*101 wpn1:Show(true) wpn1:SetProgressPos(wpn1_condition_progress) else wpn1:Show(false) end local wpn2_condition_progress = 0 local wpn_2 = db.actor:item_in_slot(2) if wpn_2 then wpn2_condition_progress = wpn_2:condition()*101 wpn2:Show(true) wpn2:SetProgressPos(wpn2_condition_progress) else wpn2:Show(false) end local wpn3_condition_progress = 0 local wpn_3 = db.actor:item_in_slot(4) if wpn_3 then wpn3_condition_progress = wpn_3:condition()*101 wpn3:Show(true) wpn3:SetProgressPos(wpn3_condition_progress) else wpn3:Show(false) end local wpn4_condition_progress = 0 local wpn_4 = db.actor:item_in_slot(0) if wpn_4 then wpn4_condition_progress = wpn_4:condition()*101 wpn4:Show(true) wpn4:SetProgressPos(wpn4_condition_progress) else wpn4:Show(false) end local outfit_condition_progress = 0 local armor = db.actor:item_in_slot(6) if armor then outfit_condition_progress = armor:condition()*101 outfit:Show(true) outfit:SetProgressPos(outfit_condition_progress) else outfit:Show(false) end local wpn8_condition_progress = 0 local wpn_8 = db.actor:item_in_slot(8) if wpn_8 then wpn8_condition_progress = wpn_8:condition()*101 wpn8:Show(true) wpn8:SetProgressPos(wpn8_condition_progress) else wpn8:Show(false) end local wpn9_condition_progress = 0 local wpn_9 = db.actor:item_in_slot(9) if wpn_9 then wpn9_condition_progress = wpn_9:condition()*101 wpn9:Show(true) wpn9:SetProgressPos(wpn9_condition_progress) else wpn9:Show(false) end local wpn10_condition_progress = 0 local wpn_10 = db.actor:item_in_slot(10) if wpn_10 then wpn10_condition_progress = wpn_10:condition()*101 wpn10:Show(true) wpn10:SetProgressPos(wpn10_condition_progress) else wpn10:Show(false) end end end Поделиться этим сообщением Ссылка на сообщение
Colder 12 Опубликовано 2 Февраля 2022 Создал ремкомплект и возникла такая проблема. При появление 2-х одинаковых(сломаных) оружия у ГГ в списке появляеться вот это https://disk.yandex.ru/i/yPsc0Q9N-FsBBQ Можно это как то решить? Вот сам лист Скрытый текст function UIrepair:FillList() item_table = 0 item_table = {} item_table_index = 0 local function fill_list(actor,item) local main_section = system_ini():r_string_ex(item:section(),"repair_type") or item:section() if main_section then if (self.repair_type == "weapon" and IsWeapon(item)) or (self.repair_type == "knife" and IsKnife(item)) or (self.repair_type == "pistol" and IsPistol(item)) or (self.repair_type == "shotgun" and IsShotgun(item)) or (self.repair_type == "riflight" and IsRlight(item)) or (self.repair_type == "rifheavy" and IsRheavy(item)) or (self.repair_type == "outfit" and IsOutfit(item)) or (self.repair_type == "outlight" and IsOutlight(item)) or (self.repair_type == "outheavy" and IsOutheavy(item)) or (self.repair_type == "outexo" and IsOutexo(item)) or (self.repair_type == "all" and (IsWeapon(item) or IsOutfit(item) or IsKnife(item) or IsPistol(item) or IsShotgun(item) or IsRlight(item) or IsRheavy(item) or IsOutfit(item) or IsOutlight(item) or IsOutheavy(item) or IsOutexo(item))) then local con = item:condition() if con < self.max_condition and con >= self.min_condition then item_table_index = item_table_index + 1 item_table[item_table_index] = item local item_in_slot_1 = db.actor:item_in_slot(1) and db.actor:item_in_slot(1):id() or false local item_in_slot_2 = db.actor:item_in_slot(2) and db.actor:item_in_slot(2):id() or false local item_in_slot_4 = db.actor:item_in_slot(4) and db.actor:item_in_slot(4):id() or false local item_in_slot_6 = db.actor:item_in_slot(6) and db.actor:item_in_slot(6):id() or false local i = 1 while (item_table) do local s_item = item_table local s_item_section = s_item:section() local _item_num = "" .. i .. "" local _item_name = gts(axr_base.get_inv_name_short(s_item_section)) if string.len(_item_name)>25 then _item_name = string.sub(_item_name,1,23).."..." end if s_item:id() == item_in_slot_1 or s_item:id() == item_in_slot_2 or s_item:id() == item_in_slot_4 then _item_name = _item_name.." (в руках)" elseif s_item:id() == item_in_slot_6 then _item_name = _item_name.." (одет)" end local _item_cond = s_item:condition() if _item_cond then _item_cond = math.floor((_item_cond)*100) end _item_cond = "[" .. _item_cond .. "%]" self:AddItemToList(_item_num, _item_name, _item_cond) i = i+1 end end end end end db.actor:iterate_inventory(fill_list,db.actor) end Поделиться этим сообщением Ссылка на сообщение