I searched for a JASS system/code here that allows teleportation of units from place to place (like a gate-way) but couldn't find any, if anyone can direct me to it, I'd be thankful.
If not, can anyone of the JASS gurus check if there is anything wrong with this trigger then ? its purpose is what the title says
If not, can anyone of the JASS gurus check if there is anything wrong with this trigger then ? its purpose is what the title says
JASS:
function Warps_Actions takes nothing returns nothing
//from 0 to 2 because there are 3 regions that transport back and forth (3 entrances and 3 exits)
set iLoop[1] = 0
set iLoopEnd[1] = 2
loop
exitwhen iLoop[1] > iLoopEnd[1]
//if on entering side
if RectContainsUnit( Entrance[iLoop[1]], GetEnteringUnit() ) then
//Camera adjustments and teleportation
call IssueImmediateOrderBJ( GetEnteringUnit(), "stop" )
call SetUserControlForceOff( bj_FORCE_PLAYER[0] )
call SetCameraTargetControllerNoZForPlayer( Player(0), GetEnteringUnit(), 0, 0, false )
call SetUnitPositionLocFacingBJ( GetEnteringUnit(), Point[iLoop[1]], 90.00 )
call TriggerSleepAction( 0.50 )
call SetCameraBoundsToRectForPlayerBJ( Player(0), Visibility[iLoop[1]] )
call TriggerSleepAction( 0.50 )
call ResetToGameCameraForPlayer( Player(0), 1.00 )
call SetUserControlForceOn( bj_FORCE_PLAYER[0] )
call CreateFogModifierRectBJ( true, Player(0), FOG_OF_WAR_VISIBLE, Visibility[iLoop[1]] )
//if on exiting side
elseif RectContainsUnit( Exit[iLoop[1]], GetEnteringUnit() ) then
//Camera adjustments and teleportation
call SetUserControlForceOff( bj_FORCE_PLAYER[0] )
call SetCameraTargetControllerNoZForPlayer( Player(0), GetEnteringUnit(), 0, 0, false )
call SetUnitPositionLocFacingLocBJ( GetEnteringUnit(), Another_Point[iLoop[1]], Direction[iLoop[1]] )
call TriggerSleepAction( 0.50 )
call SetCameraBoundsToRectForPlayerBJ( Player(0), GetPlayableMapRect() )
call TriggerSleepAction( 0.50 )
call ResetToGameCameraForPlayer( Player(0), 1.00 )
call SetUserControlForceOn( bj_FORCE_PLAYER[0] )
endif
set iLoop[1] = iLoop[1] + 1
endloop
endfunction
//===========================================================================
function InitTrig_iWarp takes nothing returns nothing
local trigger iWarps = CreateTrigger( )
//== Trigger Variables ==//
// Points
set Point[0] = Location(-5960, 1493)
set Point[1] = Location(-5380, -7730)
set Point[2] = Location(-7560, -4500)
// Other Points
set Another_Point[0] = Location(-2230,-2663)
set Another_Point[1] = Location(-4307,-2652)
set Another_Point[2] = Location(-3430,-1341)
// Directions
set Direction[0] = GetDestructableLoc(gg_dest_LTlt_0801)
set Direction[1] = GetDestructableLoc(gg_dest_DTlv_8311)
set Direction[2] = GetDestructableLoc(gg_dest_LTlt_6603)
// Exits
set Exit[0] = gg_rct_Mardenhole_Keep
set Exit[1] = gg_rct_Tirion_House
set Exit[2] = gg_rct_Stable
// Entrances
set Entrance[0] = gg_rct_Mardenhole_Keep_Entrance
set Entrance[1] = gg_rct_Tirion_House_Entrance
set Entrance[2] = gg_rct_Stable_Entrance
// Visiblity
set Visibility[0] = gg_rct_Keep_Visibility
set Visibility[1] = gg_rct_House_Visibility
set Visibility[2] = gg_rct_Stable_Visibility
//===================//
call TriggerRegisterEnterRectSimple( iWarps, Entrance[0] )
call TriggerRegisterEnterRectSimple( iWarps, Entrance[1] )
call TriggerRegisterEnterRectSimple( iWarps, Entrance[2] )
call TriggerRegisterEnterRectSimple( iWarps, Exit[0] )
call TriggerRegisterEnterRectSimple( iWarps, Exit[1] )
call TriggerRegisterEnterRectSimple( iWarps, Exit[2] )
call TriggerAddAction( iWarps, function Warps_Actions )
endfunction