Deadly Paradox
New Member
- Reaction score
- 0
I'm converting a trigger a friend made for teleporting "choosers" around the skill picking area. He used regions to detect when the choosers entered circles of power. It feels really clunky to use, though. Is there any better way?
EDIT: I've been trying to avoid BJ functions. Is TriggerRegisterEnterRectSimple() okay to use?
JASS:
scope Movement initializer Init
globals
private real ToCustomSkillsX = 0
private real ToCustomSkillsY = 0
private real ToCustomTavernsX = 0
private real ToCustomTavernsY = 0
endglobals
private function MoveToCustomSkills takes nothing returns boolean
local unit u = GetTriggerUnit()
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Human\\MassTeleport\\MassTeleportTarget.mdl", GetUnitX(u), GetUnitY(u)))
call SetUnitPosition(u, ToCustomSkillsX, ToCustomSkillsY)
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Human\\MassTeleport\\MassTeleportTarget.mdl", GetUnitX(u), GetUnitY(u)))
if (GetOwningPlayer(u) == GetLocalPlayer()) then
call PanCameraTo(ToCustomSkillsX, ToCustomSkillsY)
endif
set u = null
return false
endfunction
private function MoveToCustomTaverns takes nothing returns boolean
local unit u = GetTriggerUnit()
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Human\\MassTeleport\\MassTeleportTarget.mdl", GetUnitX(u), GetUnitY(u)))
call SetUnitPosition(u, ToCustomTavernsX, ToCustomTavernsY)
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Human\\MassTeleport\\MassTeleportTarget.mdl", GetUnitX(u), GetUnitY(u)))
if (GetOwningPlayer(u) == GetLocalPlayer()) then
call PanCameraTo(ToCustomTavernsX, ToCustomTavernsY)
endif
set u = null
return false
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
set ToCustomTavernsX = GetRectCenterX(gg_rct_ToCustomTaverns)
set ToCustomTavernsY = GetRectCenterY(gg_rct_ToCustomTaverns)
call TriggerAddCondition(t, Condition(function MoveToCustomTaverns))
call TriggerRegisterEnterRectSimple(t, gg_rct_EnterCustomTaverns)
set t = CreateTrigger()
set ToCustomSkillsX = GetRectCenterX(gg_rct_ToCustomSkills)
set ToCustomSkillsY = GetRectCenterY(gg_rct_ToCustomSkills)
call TriggerAddCondition(t, Condition(function MoveToCustomSkills))
call TriggerRegisterEnterRectSimple(t, gg_rct_LeaveCustomTaverns)
endfunction
endscope
EDIT: I've been trying to avoid BJ functions. Is TriggerRegisterEnterRectSimple() okay to use?