XGM Forum
Сайт - Статьи - Проекты - Ресурсы - Блоги

Форуме в режиме ТОЛЬКО ЧТЕНИЕ. Вы можете задать вопросы в Q/A на сайте, либо создать свой проект или ресурс.
Вернуться   XGM Forum > Warcraft> Академия: форум для вопросов> Jass
Ник
Пароль
Войти через VK в один клик
Сайт использует только имя.

Ответ
 
TmaRT

offline
Опыт: 1,360
Активность:
Трекабл система
Я хотел начучится трекабля и нашел вот эту систему! она нормальнно работает если дистанция между трекаблями равна 64(см. тригер), а стоить мне уменьшить её до 32 и тригер перестает работать вовсе, почему и как это сделать подскажите плз!
!
» (costom code)

function HandleToInt takes handle h returns integer
return h
return 0
endfunction
function IntToHandle takes integer i returns handle
return i
return null
endfunction
function LocalVars takes nothing returns gamecache
return InitGameCache("test.w3v")
endfunction

function SetHandleHandle takes handle subject, string name, handle value

returns nothing
if value==null then
call

FlushStoredInteger(LocalVars(),I2S(HandleToInt(subject)),name)
else
call StoreInteger(LocalVars(), I2S(HandleToInt(subject)), name,

HandleToInt(value))
endif
endfunction

function SetHandleInt takes handle subject, string name, integer value

returns nothing
if value==0 then
call

FlushStoredInteger(LocalVars(),I2S(HandleToInt(subject)),name)
else
call StoreInteger(LocalVars(), I2S(HandleToInt(subject)), name,

value)
endif
endfunction

function SetHandleReal takes handle subject, string name, real value

returns nothing
if value==0 then
call FlushStoredReal(LocalVars(), I2S(HandleToInt(subject)),

name)
else
call StoreReal(LocalVars(), I2S(HandleToInt(subject)), name,

value)
endif
endfunction

function SetHandleString takes handle subject, string name, string value

returns nothing
if ( value == null or value == "" ) then
call FlushStoredString(LocalVars(), I2S(HandleToInt(subject)),

name)
else
call StoreString(LocalVars(), I2S(HandleToInt(subject)), name,

value)
endif
endfunction

function GetHandleHandle takes handle subject, string name returns handle
return IntToHandle(GetStoredInteger(LocalVars(),

I2S(HandleToInt(subject)), name))
endfunction
function GetHandleInt takes handle subject, string name returns integer
return GetStoredInteger(LocalVars(), I2S(HandleToInt(subject)), name)
endfunction
function GetHandleReal takes handle subject, string name returns real
return GetStoredReal(LocalVars(), I2S(HandleToInt(subject)), name)
endfunction
function GetHandleString takes handle subject, string name returns string
return GetStoredString(LocalVars(), I2S(HandleToInt(subject)), name)
endfunction

function FlushHandleLocals takes handle subject returns nothing
call FlushStoredMission(LocalVars(), I2S(HandleToInt(subject)) )
endfunction



function GetTrackableX takes trackable tc returns real
return GetHandleReal(tc, "x")
endfunction
function GetTrackableY takes trackable tc returns real
return GetHandleReal(tc, "y")
endfunction
function GetTrackablePath takes trackable tc returns string
return GetHandleString(tc, "path")
endfunction
function GetTrackablePlayer takes trackable tc returns player
return Player(GetHandleInt(tc, "player"))
endfunction

function NewTrackable takes string path, real x, real y, force

visiblePlayers, trigger trackEvent, trigger hitEvent returns nothing
local trackable tc
local integer i = 0
local string model
loop
exitwhen i > 11
set model = ""
if ( IsPlayerInForce(Player(i), visiblePlayers) and

GetPlayerController(Player(i)) == MAP_CONTROL_USER ) then
if ( GetLocalPlayer() == Player(i) ) then
set model = path
endif
set tc = CreateTrackable(model, x, y, 0)
call SetHandleReal(tc, "x", x)
call SetHandleReal(tc, "y", y)
call SetHandleString(tc, "path", path)
call SetHandleInt(tc, "player", i)
if ( trackEvent != null ) then
call TriggerRegisterTrackableTrackEvent(trackEvent, tc)
endif
if ( hitEvent != null ) then
call TriggerRegisterTrackableHitEvent(hitEvent, tc)
endif
endif
set i = i + 1
endloop
endfunction



» Тригер

function TrackableTrack takes nothing returns nothing
local real x = GetTrackableX(GetTriggeringTrackable())
local real y = GetTrackableY(GetTriggeringTrackable())
local location loc = Location(x,y)
call SetUnitFacingToFaceLocTimed(udg_Tower, loc, 0.5)
call DisplayTextToForce( GetPlayersAll(), ( "Навелась мышка" ) )
//move mause
endfunction

function TrackableHit takes nothing returns nothing
local real x = GetTrackableX(GetTriggeringTrackable())
local real y = GetTrackableY(GetTriggeringTrackable())

call DisplayTextToForce( GetPlayersAll(), ( "Мышь клик" ) )
//click
endfunction

function Trig_Init_Trackables_Actions takes nothing returns nothing
local trigger hit = CreateTrigger()
local trigger track = CreateTrigger()
local real x = 0
local real y = GetRectMinY(gg_rct_area) + 32 //было 64
local real maxY = GetRectMaxY(gg_rct_area)
local real maxX = GetRectMaxX(gg_rct_area)
loop
exitwhen y > maxY - 32//было 64
set x = GetRectMinX(gg_rct_area) +32//было 64
loop
exitwhen x > maxX - 32//было 64
call NewTrackable("units\\nightelf\\Wisp\\Wisp.mdl", x, y, GetPlayersAll(), track, hit)
set x = x + 64//было 128
endloop
set y = y + 64 //было 128
endloop
call TriggerAddAction(hit, function TrackableHit)
call TriggerAddAction(track, function TrackableTrack)
endfunction

//=======================================================================

====
function InitTrig_Init_Trackables takes nothing returns nothing
set gg_trg_Init_Trackables = CreateTrigger( )
call TriggerAddAction( gg_trg_Init_Trackables, function

Trig_Init_Trackables_Actions )
endfunction


TmaRT добавил:
Кстати система работает так, указываешь там регион и он полностью его должен заложить трекаблями растояние между ними 32х32 (см тригер, подчеркнутый жирным это поля где я редоктировал)
Старый 09.06.2009, 14:53
agentex

offline
Опыт: 34,834
Активность:
Цитата:
Я хотел начучится трекабля

лол

ну я так думаю что трекеблы наезжают друг на друга при такой маленькой дистанции, хотя быть может дело в движке
Старый 09.06.2009, 14:54
TmaRT

offline
Опыт: 1,360
Активность:
agentexДа я с трэкаблями еще не работал, не я использовал маленьку модель 2х2, так что на друг друга они не как не наезжают) движок работает нормально вроде

TmaRT добавил:
Мне по зарез надо это система
Старый 09.06.2009, 15:04
Ответ

Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск

Ваши права в разделе
Вы не можете создавать темы
Вы не можете отвечать на сообщения
Вы не можете прикреплять файлы
Вы можете скачивать файлы

BB-коды Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход



Часовой пояс GMT +3, время: 18:56.