HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Why won't this "Move Trigger" work?

01-28-2005, 09:14 PM#1
oNdizZ
I just don't get it, why wont it work? I've just instead of making 9 move triggers (one for every region) i put all into one. And it won't work :/


The text in red is for the first Region, and then its 8 more for the rest. So for the lazy ones, just look at the first one :D
Code:
Move Training Things
    Events
        Unit - A unit enters TrainMove01 <gen>
        Unit - A unit enters TrainMove02 <gen>
        Unit - A unit enters TrainMove03 <gen>
        Unit - A unit enters TrainMove04 <gen>
        Unit - A unit enters TrainMove05 <gen>
        Unit - A unit enters TrainMove06 <gen>
        Unit - A unit enters TrainMove07 <gen>
        Unit - A unit enters TrainMove08 <gen>
        Unit - A unit enters TrainMove09 <gen>
    Conditions
        (Unit-type of (Entering unit)) Equal to Footman
    Actions
        For each (Integer A) from 1 to 9, do (Actions)
            Loop - Actions
                Set TrainingMoveTempGroup[(Integer A)] = (Units in TrainingMoveRect[(Integer A)]((Unit-type of (Matching unit)) Equal to Footman))
        [color=Red]If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Entering unit) is in TrainingMoveTempGroup[1]) Equal to True
            Then - Actions
                Set TrainingTempPoint = (Center of TrainMove02 <gen>)
                Unit - Order (Entering unit) to Move To TrainingTempPoint
                Custom script: call RemoveLocation( udg_TrainingTempPoint )
            Else - Actions[/color]
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Entering unit) is in TrainingMoveTempGroup[2]) Equal to True
            Then - Actions
                Set TrainingTempPoint = (Center of TrainMove03 <gen>)
                Unit - Order (Entering unit) to Move To TrainingTempPoint
                Custom script: call RemoveLocation( udg_TrainingTempPoint )
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Entering unit) is in TrainingMoveTempGroup[3]) Equal to True
            Then - Actions
                Set TrainingTempPoint = (Center of TrainMove04 <gen>)
                Unit - Order (Entering unit) to Move To TrainingTempPoint
                Custom script: call RemoveLocation( udg_TrainingTempPoint )
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Entering unit) is in TrainingMoveTempGroup[4]) Equal to True
            Then - Actions
                Set TrainingTempPoint = (Center of TrainMove05 <gen>)
                Unit - Order (Entering unit) to Move To TrainingTempPoint
                Custom script: call RemoveLocation( udg_TrainingTempPoint )
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Entering unit) is in TrainingMoveTempGroup[5]) Equal to True
            Then - Actions
                Set TrainingTempPoint = (Center of TrainMove06 <gen>)
                Unit - Order (Entering unit) to Move To TrainingTempPoint
                Custom script: call RemoveLocation( udg_TrainingTempPoint )
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Entering unit) is in TrainingMoveTempGroup[6]) Equal to True
            Then - Actions
                Set TrainingTempPoint = (Center of TrainMove07 <gen>)
                Unit - Order (Entering unit) to Move To TrainingTempPoint
                Custom script: call RemoveLocation( udg_TrainingTempPoint )
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Entering unit) is in TrainingMoveTempGroup[7]) Equal to True
            Then - Actions
                Set TrainingTempPoint = (Center of TrainMove08 <gen>)
                Unit - Order (Entering unit) to Move To TrainingTempPoint
                Custom script: call RemoveLocation( udg_TrainingTempPoint )
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Entering unit) is in TrainingMoveTempGroup[8]) Equal to True
            Then - Actions
                Set TrainingTempPoint = (Center of TrainMove09 <gen>)
                Unit - Order (Entering unit) to Move To TrainingTempPoint
                Custom script: call RemoveLocation( udg_TrainingTempPoint )
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Entering unit) is in TrainingMoveTempGroup[9]) Equal to True
            Then - Actions
                Set TrainingTempPoint = (Center of TrainMove01 <gen>)
                Unit - Order (Entering unit) to Move To TrainingTempPoint
                Custom script: call RemoveLocation( udg_TrainingTempPoint )
            Else - Actions
        For each (Integer A) from 1 to 9, do (Actions)
            Loop - Actions
                Custom script: call DestroyGroup( udg_TrainingMoveTempGroup[GetForLoopIndexA()] )
01-28-2005, 11:27 PM#2
iNfraNe
It does not work because when a unit enters a region, it is not yet in the region. Besides, why do it this hard way ;)

There is a fairly easy way, if you dont use the units custom value (else you must use game cache but thatll require jass).

But there isnt a big chance u use its custom value so here it goes:

Make a region array and put the regions in it for how he must walk.

Then:
Code:
Events:
unit enters region 1
unit enters region 2
etc
Actions
unit set custom value = custom value +1
unit move 2 RegionArray[unit custom value]