Сповіщення
Очистити все

Обчислюємо координати. Альтернативний метод


Ранг:
Майстер
Роль:
Гість
Записи:
752
Приєднався:
7 місяців тому
 

Пропоную легший спосіб: Створіть новий скрипт, до нього запишіть таку функцію:

function show_coordinates()
 local hud = get_hud()
 local cs = hud:GetCustomStatic("cs_debug")
 if cs == nil then
 hud:AddCustomStatic("cs_debug", true)
 cs = hud:GetCustomStatic("cs_debug")
 end
 local lvid, gvid = db.actor:level_vertex_id(), db.actor:game_vertex_id()
 local pos, dir = db.actor:position(), db.actor:direction()
 local pos2 = level.vertex_position(lvid)
 local d = vector():sub(pos, pos2)
 local valid = (math.abs(dx) <= 0.35 and math.abs(dy) < 1.0 and math.abs(dz) <= 0.35)
 local msg = string.format("lvid: %d\n", lvid) ..
 string.format("gvid: %d\n", gvid) ..
 string.format("pos:%f,%f,%f\n", pos.x, pos.y, pos.z) ..
 string.format("dir:%f,%f,%f\n", dir.x, dir.y, dir.z) ..
 "valid:" .. tostring(valid)
 if cs ~= nil then
 cs:wnd():SetText(msg)
 end
 end

Далі відкриваємо bind_stalker.script і знаходимо функцію actor_binder:update(delta) Напишемо в ній після:

local time = time_global()
 game_stats.update (delta, self.object)

Це:

if t_coord < time then
 t_coord = time + 250
 ім'я_вашого_скрипта.show_coordinates()
 end

250 – це чверть секунди, тобто. чотири рази на секунду оновлюватиметься інформація про координати. Тепер потрібно позначити нашу нову змінну: просто де-небудь поза всякими функціями в цьому ж файлі напишіть:

t_coord=0

Мало не забув, у папці config\ui у файлі, наприклад, "ui_custom_msgs.xml" в кінці перед </header> напишіть:

<cs_debug x="200" y="180" width="600" height="100" complex_mode="1">
 <text font="letterica18" r="240" g="217" b="182" a="255" align="l"/>
</cs_debug>

Всі! Тепер у грі перед вами весь час висвічуються координати!


   
Цитата