Здравствуйте, люди, мне понадобилась одна работа внутри триггера с камерой.
Нужно чтоб при наведении камеры на какого-либо юнита с помощью спелла без наведения цели (мгновенного действия) в точке камеры юнит !!погибал!!!

Принятый ответ

LordDracula:
всё, пошаманил чуть чуть с моим способом через кеш и заработало
globals
    gamecache udg_cache = InitGameCache("gamecache")
endglobals



function Trig_camera_Conditions takes nothing returns boolean
    if (GetSpellAbilityId() != 'AOws') then
        return false
    endif
    return true
endfunction

function SyncReal takes player p, real val returns real
	if (GetLocalPlayer() == p) then
		call StoreReal(udg_cache, "", "", val)
	endif
	call TriggerSyncStart()
	if (GetLocalPlayer() == p) then
		call SyncStoredReal(udg_cache, "", "")
	endif
	call TriggerSleepAction(2.)
	call TriggerSyncReady()
	return GetStoredReal(udg_cache, "", "")
endfunction

function GetPlayerCameraX takes player p returns real
	if (GetLocalPlayer() == p) then
		return GetCameraTargetPositionX()
	endif
	return 0.
endfunction

function GetPlayerCameraY takes player p returns real
	if (GetLocalPlayer() == p) then
		return GetCameraTargetPositionY()
	endif
	return 0.
endfunction

function Trig_camera_KillUnits takes nothing returns nothing
    call KillUnit( GetEnumUnit() )
endfunction

function Trig_camera_Actions takes nothing returns nothing
    local real x
    local real y
    local rect r
    local group g
    local player p = GetOwningPlayer(GetTriggerUnit())
    set x = GetPlayerCameraX(p)
    set y = GetPlayerCameraY(p)
    set x = SyncReal(GetOwningPlayer(GetTriggerUnit()),x)
    set y = SyncReal(GetOwningPlayer(GetTriggerUnit()),y)
    set r = Rect( x - 500.00*0.5, y - 500.00*0.5, x + 500.00*0.5, y + 500.00*0.5 )
    set g = GetUnitsInRectMatching(r, null)
    call ForGroup(g, function Trig_camera_KillUnits)
    call DestroyGroup(g)
    call RemoveRect(r)
    set g = null
    set r = null
    set x = 0
    set y = 0
endfunction

//===========================================================================
function InitTrig_camera takes nothing returns nothing
    set gg_trg_camera = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_camera, EVENT_PLAYER_UNIT_SPELL_CHANNEL )
    call TriggerAddCondition( gg_trg_camera, Condition( function Trig_camera_Conditions ) )
    call TriggerAddAction( gg_trg_camera, function Trig_camera_Actions )
endfunction
Загруженные файлы
`
ОЖИДАНИЕ РЕКЛАМЫ...
0
18
6 лет назад
Отредактирован Hodor
0
globals
    gamecache udg_cache = InitGameCache("gamecache")
endglobals



function Trig_camera_Conditions takes nothing returns boolean
    if (GetSpellAbilityId() != 'AOws') then
        return false
    endif
    return true
endfunction

function SyncReal takes player p, real val returns real
	if (GetLocalPlayer() == p) then
		call StoreReal(udg_cache, "", "", val)
	endif
	call TriggerSyncStart()
	if (GetLocalPlayer() == p) then
		call SyncStoredReal(udg_cache, "", "")
	endif
	call TriggerSleepAction(2.)
	call TriggerSyncReady()
	return GetStoredReal(udg_cache, "", "")
endfunction

function Trig_camera_KillUnits takes nothing returns nothing
    call KillUnit( GetEnumUnit() )
endfunction
function Trig_camera_Actions takes nothing returns nothing
    local real x
    local real y
    local rect r
    local group g
    if (GetLocalPlayer()==GetOwningPlayer(GetTriggerUnit())) then
        set x = GetCameraTargetPositionX()
        set y = GetCameraTargetPositionY()
    endif
    set x = SyncReal(GetOwningPlayer(GetTriggerUnit()),x)
    set y = SyncReal(GetOwningPlayer(GetTriggerUnit()),y)
    set r = Rect( x - 500.00*0.5, y - 500.00*0.5, x + 500.00*0.5, y + 500.00*0.5 )
    set g = GetUnitsInRectMatching(r, null)
    call ForGroup(g, function Trig_camera_KillUnits)
    call DestroyGroup(g)
    call RemoveRect(r)
    set g = null
    set r = null
    set x = 0
    set y = 0
endfunction

//===========================================================================
function InitTrig_camera takes nothing returns nothing
    set gg_trg_camera = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_camera, EVENT_PLAYER_UNIT_SPELL_CHANNEL )
    call TriggerAddCondition( gg_trg_camera, Condition( function Trig_camera_Conditions ) )
    call TriggerAddAction( gg_trg_camera, function Trig_camera_Actions )
endfunction
Там где 'AOws' - это равкод нужной тебе абилки.
Там где 500 это радиус от центра камеры кастующего игрока в котором помрут юниты (он не круглый, а квадратный, но и так сойдет)
бери cameraMap3 (внизу в комментариях)
обязательно на десинхрон потестируй, я не уверен насчет работоспособности этой наработки
Загруженные файлы
0
21
6 лет назад
0
FabulousTiger, а для чего нужна функция SyncReal( )?
0
18
6 лет назад
0
ScopteRectuS:
FabulousTiger, а для чего нужна функция SyncReal( )?
синхронизировать координаты камеры кастующего игрока
0
21
6 лет назад
0
	if (GetLocalPlayer()==GetOwningPlayer(GetTriggerUnit())) then
        set p = GetCameraTargetPositionLoc()
    endif
0
18
6 лет назад
0
ScopteRectuS:
	if (GetLocalPlayer()==GetOwningPlayer(GetTriggerUnit())) then
        set p = GetCameraTargetPositionLoc()
    endif
а блин, точка это же наследник хендла. Походу надо переделать под GetCameraTargetPositionX() и GetCameraTargetPositionY()
0
21
6 лет назад
0
FabulousTiger:
ScopteRectuS:
FabulousTiger, а для чего нужна функция SyncReal( )?
синхронизировать координаты камеры кастующего игрока
FabulousTiger:
ScopteRectuS:
FabulousTiger, а для чего нужна функция SyncReal( )?
синхронизировать координаты камеры кастующего игрока
А с чем они синхронизируются? Сори за глупый вопрос, никогда не работал с кешем.
0
18
6 лет назад
Отредактирован Hodor
0
ScopteRectuS:
FabulousTiger:
ScopteRectuS:
FabulousTiger, а для чего нужна функция SyncReal( )?
синхронизировать координаты камеры кастующего игрока
FabulousTiger:
ScopteRectuS:
FabulousTiger, а для чего нужна функция SyncReal( )?
синхронизировать координаты камеры кастующего игрока
А с чем они синхронизируются? Сори за глупый вопрос, никогда не работал с кешем.
ScopteRectuS:
FabulousTiger:
ScopteRectuS:
FabulousTiger, а для чего нужна функция SyncReal( )?
синхронизировать координаты камеры кастующего игрока
FabulousTiger:
ScopteRectuS:
FabulousTiger, а для чего нужна функция SyncReal( )?
синхронизировать координаты камеры кастующего игрока
А с чем они синхронизируются? Сори за глупый вопрос, никогда не работал с кешем.
реальные координат камеры синхронизируются у каждого игрока, я же их доставал через GetLocalPlayer()
Тупо получилось))))) 100 раз успел отредактить, короче убрал работу с точкой, теперь не должно вызывать десинхрон.
блин, всё таки десинхрон есть. Ща буду пытаться чинить
Загруженные файлы
0
10
6 лет назад
0
FabulousTiger:
Попробуй этот код, вроде не должен десихронить
globals
    camerasetup theCam = CreateCameraSetup()
endglobals


function Trig_camera_Conditions takes nothing returns boolean
    if (GetSpellAbilityId() != 'AOws') then
        return false
    endif
    return true
endfunction


function Trig_camera_KillUnits takes nothing returns nothing
    call KillUnit( GetEnumUnit() )
endfunction
function Trig_camera_Actions takes nothing returns nothing
    local group g = CreateGroup()
    local real x
    local real y
    local rect r
    if (GetLocalPlayer()==GetOwningPlayer(GetTriggerUnit())) then
        set x = GetCameraTargetPositionX()
        set y = GetCameraTargetPositionY()
    endif
    call CameraSetupSetDestPosition(theCam,x,y,0)
    set x = CameraSetupGetDestPositionX(theCam)
    set y = CameraSetupGetDestPositionY(theCam)
    set r = Rect( x - 500.00*0.5, y - 500.00*0.5, x + 500.00*0.5, y + 500.00*0.5 )
    call GroupEnumUnitsInRect(g, r, null)
    call ForGroup(g, function Trig_camera_KillUnits)
    call DestroyGroup(g)
    call RemoveRect(r)
    set g = null
    set r = null
    set x = 0
    set y = 0
endfunction

//===========================================================================
function InitTrig_camera takes nothing returns nothing
    set gg_trg_camera = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_camera, EVENT_PLAYER_UNIT_SPELL_CHANNEL )
    call TriggerAddCondition( gg_trg_camera, Condition( function Trig_camera_Conditions ) )
    call TriggerAddAction( gg_trg_camera, function Trig_camera_Actions )
endfunction
0
18
6 лет назад
0
LordDracula:
тестить уже не с кем)) Идея с обьектом камеры интересная, обязательно потестирую как найду с кем тестить.
0
10
6 лет назад
0
FabulousTiger:
если через гарену, могу помочь. напиши в личку
0
18
6 лет назад
Отредактирован Hodor
0
LordDracula:
всё, пошаманил чуть чуть с моим способом через кеш и заработало
globals
    gamecache udg_cache = InitGameCache("gamecache")
endglobals



function Trig_camera_Conditions takes nothing returns boolean
    if (GetSpellAbilityId() != 'AOws') then
        return false
    endif
    return true
endfunction

function SyncReal takes player p, real val returns real
	if (GetLocalPlayer() == p) then
		call StoreReal(udg_cache, "", "", val)
	endif
	call TriggerSyncStart()
	if (GetLocalPlayer() == p) then
		call SyncStoredReal(udg_cache, "", "")
	endif
	call TriggerSleepAction(2.)
	call TriggerSyncReady()
	return GetStoredReal(udg_cache, "", "")
endfunction

function GetPlayerCameraX takes player p returns real
	if (GetLocalPlayer() == p) then
		return GetCameraTargetPositionX()
	endif
	return 0.
endfunction

function GetPlayerCameraY takes player p returns real
	if (GetLocalPlayer() == p) then
		return GetCameraTargetPositionY()
	endif
	return 0.
endfunction

function Trig_camera_KillUnits takes nothing returns nothing
    call KillUnit( GetEnumUnit() )
endfunction

function Trig_camera_Actions takes nothing returns nothing
    local real x
    local real y
    local rect r
    local group g
    local player p = GetOwningPlayer(GetTriggerUnit())
    set x = GetPlayerCameraX(p)
    set y = GetPlayerCameraY(p)
    set x = SyncReal(GetOwningPlayer(GetTriggerUnit()),x)
    set y = SyncReal(GetOwningPlayer(GetTriggerUnit()),y)
    set r = Rect( x - 500.00*0.5, y - 500.00*0.5, x + 500.00*0.5, y + 500.00*0.5 )
    set g = GetUnitsInRectMatching(r, null)
    call ForGroup(g, function Trig_camera_KillUnits)
    call DestroyGroup(g)
    call RemoveRect(r)
    set g = null
    set r = null
    set x = 0
    set y = 0
endfunction

//===========================================================================
function InitTrig_camera takes nothing returns nothing
    set gg_trg_camera = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_camera, EVENT_PLAYER_UNIT_SPELL_CHANNEL )
    call TriggerAddCondition( gg_trg_camera, Condition( function Trig_camera_Conditions ) )
    call TriggerAddAction( gg_trg_camera, function Trig_camera_Actions )
endfunction
Загруженные файлы
Принятый ответ
Чтобы оставить комментарий, пожалуйста, войдите на сайт.