CoP. Определение координат ГГ на локации — различия между версиями — S.T.A.L.K.E.R. Inside Wiki

CoP. Определение координат ГГ на локации — различия между версиями

Материал из S.T.A.L.K.E.R. Inside Wiki

Перейти к: навигация, поиск
Строка 4: Строка 4:
  
 
Открываем файл '''bind_stalker.script''' любым текстовым редактором (например Notepad++), и ищем в нём строчку, начинающуюся на '''xr_s.on_actor_update(delta)'''. Нашли? Хорошо. Теперь пишем перед этой строчкой следующий код:
 
Открываем файл '''bind_stalker.script''' любым текстовым редактором (например Notepad++), и ищем в нём строчку, начинающуюся на '''xr_s.on_actor_update(delta)'''. Нашли? Хорошо. Теперь пишем перед этой строчкой следующий код:
<code>
+
<code> local hud = get_hud()
if true then
+
local cs = hud:GetCustomStatic("cs_debug")
local hud = get_hud()
+
if self.object:alive() then
local cs = hud:GetCustomStatic("cs_debug" )
+
if not cs then
if cs == nil then
+
cs = hud:AddCustomStatic("cs_debug", true)
hud:AddCustomStatic("cs_debug", true)
+
cs = hud:GetCustomStatic("cs_debug" )
+
 
end
 
end
local lvid, gvid = db.actor:level_vertex_id(), db.actor:game_vertex_id()
+
if cs then
local pos, dir = db.actor: position(), db.actor:direction()
+
local lvid, gvid = self.object:level_vertex_id(), self.object:game_vertex_id()
local pos2 = level.vertex_position(lvid)
+
local pos, dir = self.object:position(), self.object:direction()
local valid = pos2:distance_to(pos) <= 0.7
+
local valid = level.vertex_position(lvid):distance_to(pos) <= 0.7
local msg = string.format("lvid: %d\\n", lvid) ..
+
local msg = string.format("lvid: %d\\ngvid: %d\\npos: %f,%f,%f\\ndir: %f,%f,%f\\nvalid: %s",
string.format("gvid: %d\\n", gvid) ..
+
lvid, gvid, pos.x, pos.y, pos.z, dir.x, dir.y, dir.z, tostring(valid))
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) ..
+
string.format("valid: %s", tostring(valid))
+
if cs ~= nil then
+
 
cs:wnd():TextControl():SetText(msg)
 
cs:wnd():TextControl():SetText(msg)
 
end
 
end
 +
elseif cs then
 +
hud:RemoveCustomStatic("cs_debug")
 
end
 
end
 
</code>
 
</code>

Версия 20:34, 18 апреля 2012

Понадобятся два файла от ЗП: bind_stalker.script и ui_custom_msgs.xml

Создаём в папке с игрой, папку gamedata, в ней создаём папку scripts. Помещаем в папку scripts файл bind_stalker.script от ЗП.

Открываем файл bind_stalker.script любым текстовым редактором (например Notepad++), и ищем в нём строчку, начинающуюся на xr_s.on_actor_update(delta). Нашли? Хорошо. Теперь пишем перед этой строчкой следующий код:

local hud = get_hud()
local cs = hud:GetCustomStatic("cs_debug")
if self.object:alive() then
if not cs then
cs = hud:AddCustomStatic("cs_debug", true)
end
if cs then
local lvid, gvid = self.object:level_vertex_id(), self.object:game_vertex_id()
local pos, dir = self.object:position(), self.object:direction()
local valid = level.vertex_position(lvid):distance_to(pos) <= 0.7
local msg = string.format("lvid: %d\\ngvid: %d\\npos: %f,%f,%f\\ndir: %f,%f,%f\\nvalid: %s",
lvid, gvid, pos.x, pos.y, pos.z, dir.x, dir.y, dir.z, tostring(valid))
cs:wnd():TextControl():SetText(msg)
end
elseif cs then
hud:RemoveCustomStatic("cs_debug")
end

Сохраняем изменения в файле bind_stalker.script.


В ранее созданной папке gamedata, создаём папку configs, потом в папке configs, создаём папку ui. В папке ui помещаем файл ui_custom_msgs.xml

Открываем ui_custom_msgs.xml любым текстовым редактором (например Notepad++), и в самом конце файла пишем следующий код:

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

Сохраняем изменения в файле ui_custom_msgs.xml

Всё готово! Теперь в игре, на игровой интерфейс будет выводится информация с координатами ГГ на локации.

Авторы:

bardak (Оригинальный скрипт), Мортарион (адаптация скрипта к ЧН), bip-bip:) (адаптация изменённого Мортарион'ом скрипта bardak'а, к ЗП), Earthworm-Jim (инструкция по вставке скрипта).

Другие места
LANGUAGE