Not sure if this is where I need to post... I don't need help making the trigger, I've already finished it, and it works the way I want it to, I'm just not sure how efficient it is. I've checked it using the LeakCheck resource, but since this is my first JASS trigger I wanted to be certain.
Basically, multiple teleports go to the same room. That room has one exit, and it will always return the unit to its original starting point. Since I have no idea how to use the tables, I used a loop function and had each entrance be a separate trigger. Example below:
I've tested, and it works with as many different "in" portals as I want to use, so that's not an issue.
Again this is my first JASS trigger, so I'm just looking for constructive criticism.
Thanks all,
Zypo88
P.S.
Here's an example map if what I said was confusing at all.
Basically, multiple teleports go to the same room. That room has one exit, and it will always return the unit to its original starting point. Since I have no idea how to use the tables, I used a loop function and had each entrance be a separate trigger. Example below:
JASS:
function Trig_Portal_Store_11_Conditions takes nothing returns boolean
if ( not ( IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) == true ) ) then
return false
endif
return true
endfunction
function Trig_Portal_Store_11_Actions takes nothing returns nothing
local unit LOTRTELEPORT
set LOTRTELEPORT = GetTriggerUnit()
call SetUnitPositionLoc( LOTRTELEPORT, GetRectCenter(gg_rct_Room10) )
call PanCameraToTimedLocForPlayer( GetOwningPlayer(LOTRTELEPORT), GetUnitLoc(LOTRTELEPORT), 0.60 )
call AttachSoundToUnitBJ(udg_Shop, LOTRTELEPORT)
call SetSoundVolumeBJ(udg_Shop, 100)
call PlaySoundBJ(udg_Shop)
loop
exitwhen ( RectContainsUnit(gg_rct_Out10, LOTRTELEPORT) == true )
call TriggerSleepAction(RMaxBJ(bj_WAIT_FOR_COND_MIN_INTERVAL, 0.25))
endloop
call SetUnitPositionLoc( LOTRTELEPORT, GetRectCenter(gg_rct_Out11) )
call PanCameraToTimedLocForPlayer( GetOwningPlayer(LOTRTELEPORT), GetUnitLoc(LOTRTELEPORT), 0.60 )
endfunction
//===========================================================================
function InitTrig_Portal_Store_11 takes nothing returns nothing
set gg_trg_Portal_Store_11 = CreateTrigger( )
call TriggerRegisterEnterRectSimple( gg_trg_Portal_Store_11, gg_rct_In11 )
call TriggerAddCondition( gg_trg_Portal_Store_11, Condition( function Trig_Portal_Store_11_Conditions ) )
call TriggerAddAction( gg_trg_Portal_Store_11, function Trig_Portal_Store_11_Actions )
endfunction
I've tested, and it works with as many different "in" portals as I want to use, so that's not an issue.
Again this is my first JASS trigger, so I'm just looking for constructive criticism.
Thanks all,
Zypo88
P.S.
Here's an example map if what I said was confusing at all.