| 06-22-2009, 11:57 AM | #1 |
JASS:library HSS initializer Init globals private rect FORCE1 = Rect(0,0,0,0) private rect FORCE2 = Rect(0,0,0,0) private force TEAM1 = CreateForce() private force TEAM2 = CreateForce() private group Testers = CreateGroup() private integer MAXLEVEL = 100 // max level of heroes in your game endglobals function AddPlayerToTeam takes player whichPlayer, force whichForce returns nothing call ForceAddPlayer(whichForce,whichPlayer) endfunction private function AddTesterOrder takes unit u returns nothing call GroupAddUnit(Testers,u) endfunction private function Move takes nothing returns nothing local unit u = GetTriggerUnit() local unit t = GetSoldUnit() if IsPlayerInForce(GetOwningPlayer(t),TEAM1) then call SetUnitX(t,GetRectCenterX(FORCE1)) call SetUnitY(t,GetRectCenterY(FORCE1)) call SetHeroLevel(t,MAXLEVEL,false) call SetUnitMoveSpeed(t,0) call AddTesterOrder(t) elseif IsPlayerInForce(GetOwningPlayer(t),TEAM2) then call SetUnitX(t,GetRectCenterX(FORCE2)) call SetUnitY(t,GetRectCenterY(FORCE2)) call SetHeroLevel(t,MAXLEVEL,false) call SetUnitMoveSpeed(t,0) call AddTesterOrder(t) endif set u = null set t = null endfunction private function BlockCond takes nothing returns boolean return IsUnitInGroup(GetTriggerUnit(),Testers) endfunction private function BLOCK takes nothing returns nothing local unit u = GetTriggerUnit() call PauseUnit(u,true) call IssueImmediateOrder(u,"stop") call PauseUnit(u,false) set u = null endfunction //=========================================================================== private function Init takes nothing returns nothing local trigger t = CreateTrigger() call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_SELL) call TriggerAddAction(t, function Move) set t = CreateTrigger() call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_ISSUED_ORDER) call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER) call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER) call TriggerAddCondition(t,Condition(function BlockCond)) call TriggerAddAction(t, function BLOCK) set FORCE1 = gg_rct_GOOD set FORCE2 = gg_rct_BAD call AddPlayerToTeam(Player(0),TEAM1) endfunction endlibrary JASS:private function BLOCK takes nothing returns nothing local unit u = GetTriggerUnit() call PauseUnit(u,true) call IssueImmediateOrder(u,"stop") call PauseUnit(u,false) set u = null endfunction I suspect this to be the culprit as when I took this out, everything worked fine. |
| 06-22-2009, 12:07 PM | #2 |
trigger loop, disable the trigger catching unit order events before issuing a new order. |
| 06-22-2009, 12:08 PM | #3 |
Alright that worked thanks. |
