HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Is there an easier way? Please help me out!

01-12-2004, 06:52 PM#1
Milkman
Now, what I'm after is to detect wheater a unit is in a region that have been moved there after the unit stopped moving. There are 4 players and when It's i.e. player 1's turn units that are on the same square as his marker will be moved to the starting position.

Now the trigger I'm using right now is this:
Actions
For each (Integer A) from 1 to 16, do (Actions)
Loop - Actions
Rect - Center Regions[(Integer A)] on (Position of PlayerUnits[(Integer A)])
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Or - Any (Conditions) are true
Conditions
(Regions[1] contains PlayerUnits[5]) Equal to True
(Regions[2] contains PlayerUnits[5]) Equal to True
(Regions[3] contains PlayerUnits[5]) Equal to True
(Regions[4] contains PlayerUnits[5]) Equal to True
Then - Actions
Else - Actions

Now, this isn't the whole trigger since I'll have to add in a bunch of other IF's and all that but what I'm wanting an improvment of is the (Regions[1] contains PlayerUnits[5]) Equal to True) part. There must be a better way then this, via a loop or something. Thanks in advance!
01-12-2004, 08:55 PM#2
th15
Use For loop integer A to #

Using that you'll only need one if block that'll look something like this:

If Cond: Region[For loop integer A] contains Player[5] units
do: Move all units to Region[For loop integer A]
01-14-2004, 08:05 PM#3
Milkman
Thanks man but shortly after posting this i found out how to do it myself; For anyone who cares or searches for this kinda stuff sometime i will post the trigger:


Actions
For each (Integer A) from 1 to 16, do (Actions)
Loop - Actions
Rect - Center Regions[(Integer A)] on (Position of PlayerUnits[(Integer A)])
For each (Integer A) from 1 to 4, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Regions[(Integer A)] contains (Entering unit)) Equal to True) and ((Owner of (Triggering unit)) Not equal to Player 5 (Yellow))
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Owner of (Triggering unit)) Equal to Player 6 (Orange)
Then - Actions
Unit - Move (Triggering unit) instantly to (Center of Player 2 Bo <gen>)
Else - Actions
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Regions[(Integer A)] contains (Entering unit)) Equal to True) and ((Owner of (Triggering unit)) Not equal to Player 5 (Yellow))
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Owner of (Triggering unit)) Equal to Player 7 (Green)
Then - Actions
Unit - Move (Triggering unit) instantly to (Center of Player 3 Bo <gen>)
Else - Actions
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Regions[(Integer A)] contains (Entering unit)) Equal to True) and ((Owner of (Triggering unit)) Not equal to Player 5 (Yellow))
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Owner of (Triggering unit)) Equal to Player 8 (Pink)
Then - Actions
Unit - Move (Triggering unit) instantly to (Center of Player 4 Bo <gen>)
Else - Actions
Else - Actions
For each (Integer A) from 5 to 8, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Regions[(Integer A)] contains (Entering unit)) Equal to True) and ((Owner of (Triggering unit)) Not equal to Player 6 (Orange))
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Owner of (Triggering unit)) Equal to Player 5 (Yellow)
Then - Actions
Unit - Move (Triggering unit) instantly to (Center of Player 1 Bo <gen>)
Else - Actions
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Regions[(Integer A)] contains (Entering unit)) Equal to True) and ((Owner of (Triggering unit)) Not equal to Player 6 (Orange))
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Owner of (Triggering unit)) Equal to Player 7 (Green)
Then - Actions
Unit - Move (Triggering unit) instantly to (Center of Player 3 Bo <gen>)
Else - Actions
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Regions[(Integer A)] contains (Entering unit)) Equal to True) and ((Owner of (Triggering unit)) Not equal to Player 6 (Orange))
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Owner of (Triggering unit)) Equal to Player 8 (Pink)
Then - Actions
Unit - Move (Triggering unit) instantly to (Center of Player 4 Bo <gen>)
Else - Actions
Else - Actions
For each (Integer A) from 9 to 12, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Regions[(Integer A)] contains (Entering unit)) Equal to True) and ((Owner of (Triggering unit)) Not equal to Player 7 (Green))
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Owner of (Triggering unit)) Equal to Player 5 (Yellow)
Then - Actions
Unit - Move (Triggering unit) instantly to (Center of Player 1 Bo <gen>)
Else - Actions
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Regions[(Integer A)] contains (Entering unit)) Equal to True) and ((Owner of (Triggering unit)) Not equal to Player 7 (Green))
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Owner of (Triggering unit)) Equal to Player 6 (Orange)
Then - Actions
Unit - Move (Triggering unit) instantly to (Center of Player 2 Bo <gen>)
Else - Actions
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Regions[(Integer A)] contains (Entering unit)) Equal to True) and ((Owner of (Triggering unit)) Not equal to Player 7 (Green))
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Owner of (Triggering unit)) Equal to Player 8 (Pink)
Then - Actions
Unit - Move (Triggering unit) instantly to (Center of Player 4 Bo <gen>)
Else - Actions
Else - Actions
For each (Integer A) from 13 to 16, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Regions[(Integer A)] contains (Entering unit)) Equal to True) and ((Owner of (Triggering unit)) Not equal to Player 8 (Pink))
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Owner of (Triggering unit)) Equal to Player 5 (Yellow)
Then - Actions
Unit - Move (Triggering unit) instantly to (Center of Player 1 Bo <gen>)
Else - Actions
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Regions[(Integer A)] contains (Entering unit)) Equal to True) and ((Owner of (Triggering unit)) Not equal to Player 8 (Pink))
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Owner of (Triggering unit)) Equal to Player 6 (Orange)
Then - Actions
Unit - Move (Triggering unit) instantly to (Center of Player 2 Bo <gen>)
Else - Actions
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Regions[(Integer A)] contains (Entering unit)) Equal to True) and ((Owner of (Triggering unit)) Not equal to Player 8 (Pink))
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Owner of (Triggering unit)) Equal to Player 7 (Green)
Then - Actions
Unit - Move (Triggering unit) instantly to (Center of Player 3 Bo <gen>)
Else - Actions
Else - Actions


Quite annoying to make.