- Joined
- Feb 22, 2013
- Messages
- 161
JASS:
function BlueEntered takes nothing returns boolean
return ( GetEnteringUnit() == udg_Paladin )
endfunction
function PurpleEntered takes nothing returns boolean
return ( GetEnteringUnit() == udg_Warrior )
endfunction
function YellowEntered takes nothing returns boolean
return ( GetEnteringUnit() == udg_Mage )
endfunction
function LightBlueEntered takes nothing returns boolean
return ( GetEnteringUnit() == udg_Priest )
endfunction
function BlueIsThere takes nothing returns boolean
return ( GetRectMinX(gg_rct_Ambush_Trigger) <= GetUnitX(udg_Paladin)) and (GetUnitX(udg_Paladin) <= GetRectMaxX(gg_rct_Ambush_Trigger)) and (GetRectMinY(gg_rct_Ambush_Trigger) <= GetUnitY(udg_Paladin)) and (GetUnitY(udg_Paladin) <= GetRectMaxY(gg_rct_Ambush_Trigger))
endfunction
function PurpleIsThere takes nothing returns boolean
return ( GetRectMinX(gg_rct_Ambush_Trigger) <= GetUnitX(udg_Warrior)) and (GetUnitX(udg_Warrior) <= GetRectMaxX(gg_rct_Ambush_Trigger)) and (GetRectMinY(gg_rct_Ambush_Trigger) <= GetUnitY(udg_Warrior)) and (GetUnitY(udg_Warrior) <= GetRectMaxY(gg_rct_Ambush_Trigger))
endfunction
function YellowIsThere takes nothing returns boolean
return ( GetRectMinX(gg_rct_Ambush_Trigger) <= GetUnitX(udg_Mage)) and (GetUnitX(udg_Mage) <= GetRectMaxX(gg_rct_Ambush_Trigger)) and (GetRectMinY(gg_rct_Ambush_Trigger) <= GetUnitY(udg_Mage)) and (GetUnitY(udg_Mage) <= GetRectMaxY(gg_rct_Ambush_Trigger))
endfunction
function LightBlueIsThere takes nothing returns boolean
return ( GetRectMinX(gg_rct_Ambush_Trigger) <= GetUnitX(udg_Priest)) and (GetUnitX(udg_Priest) <= GetRectMaxX(gg_rct_Ambush_Trigger)) and (GetRectMinY(gg_rct_Ambush_Trigger) <= GetUnitY(udg_Priest)) and (GetUnitY(udg_Priest) <= GetRectMaxY(gg_rct_Ambush_Trigger))
endfunction
function Ambush_Trigger_Conditions takes nothing returns boolean
if ( not BlueEntered() or PurpleEntered() or YellowEntered() or LightBlueEntered() ) then
return false
endif
return true
endfunction
function Ambush_Trigger_Actions takes nothing returns nothing
if ( BlueIsThere() and PurpleIsThere() and YellowIsThere() and LightBlueIsThere() ) then
call DoNothing()
else
if ( IsPlayerInForce(GetLocalPlayer(), udg_UserGroup) ) then
call DisplayTextToPlayer(GetLocalPlayer(), 0.00, 0.00, "All heroes must be within the area to proceed.")
endif
endif
endfunction
//===========================================================================
function InitTrig_Ambush_Trigger takes nothing returns nothing
local region rectRegion = CreateRegion()
set gg_trg_Ambush_Trigger = CreateTrigger( )
call TriggerAddCondition(gg_trg_Ambush_Trigger, Condition(function Ambush_Trigger_Conditions))
call TriggerAddAction( gg_trg_Ambush_Trigger, function Ambush_Trigger_Actions )
call RegionAddRect(rectRegion, gg_rct_Ambush_Trigger)
call TriggerRegisterEnterRegion(gg_trg_Ambush_Trigger, rectRegion, null)
endfunction
Now the problem is, is that in the Ambush_Trigger_Conditions, do the ors work? Because in-game however, blue will enter the region fine and activate the game text message in the actions, but any other player wont activate the message action in actions... Help is much appreciated