HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Help with a trigger

02-21-2004, 03:37 AM#1
LunarCrisis
Hi there, I haven't been here in a while (I havent been playing W3 in a while...) but I'm really having trouble with an action in one of my triggers:

Code:
movement
    Events
        Time - Every 1.00 seconds of game time
    Conditions
    Actions
        For each (Integer A) from 1 to 8, do (Actions)
            Loop - Actions
                For each (Integer B) from 1 to 8, do (Actions)
                    Loop - Actions
                        Game - Display to (All players) for 2.00 seconds the text: searching squares
                        [color=red]Unit Group - Pick every unit in (Units in Grid[(Integer(((String((Integer A))) + (String((Integer B))))))] owned by Player 12 (Brown)) and do (Actions)[/color] 
                            Loop - Actions
                                Game - Display to (All players) for 5.00 seconds the text: unit picked
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        Or - Any (Conditions) are true
                                            Conditions
                                                (Unit-type of (Random unit from (Units in Grid[(Integer(((String(((Integer A) + 1))) + (String(((Integer B) + 0))))))] owned by Neutral Passive))) Equal to Empty Square
                                                (Unit-type of (Random unit from (Units in Grid[(Integer(((String(((Integer A) + -1))) + (String(((Integer B) + 0))))))] owned by Neutral Passive))) Equal to Empty Square
                                                (Unit-type of (Random unit from (Units in Grid[(Integer(((String(((Integer A) + 0))) + (String(((Integer B) + 1))))))] owned by Neutral Passive))) Equal to Empty Square
                                                (Unit-type of (Random unit from (Units in Grid[(Integer(((String(((Integer A) + 0))) + (String(((Integer B) + -1))))))] owned by Neutral Passive))) Equal to Empty Square
                                    Then - Actions
                                        Set Displacement[1] = 0
                                        Set Displacement[2] = 0
                                        Set Displacement[(Random integer number between 1 and 2)] = (((Random integer number between 1 and 2) x 2) - 3)
                                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            If - Conditions
                                                (Unit-type of (Random unit from (Units in Grid[(Integer(((String(((Integer A) + Displacement[1]))) + (String(((Integer B) + Displacement[2]))))))] owned by Neutral Passive))) Equal to Empty Square
                                            Then - Actions
                                                Unit - Order (Picked unit) to Move To (Random point in Grid[(Integer(((String((Integer A))) + (String((Integer B))))))])
                                            Else - Actions
                                                Unit - Move (Triggering unit) instantly to (Position of (Triggering unit)), facing (Center of Grid[(Integer(((String(((Integer A) + Displacement[1]))) + (String(((Integer B) + Displacement[2]))))))])
                                    Else - Actions


The red one is the first action it doesn't seem to get past. You should probably download the map to see more info.
Any help at all would be appreciated.
Thx in advance.
02-21-2004, 06:37 AM#2
GaDDeN
It would be much easier if u spent some time writing down what the trigger does.
02-21-2004, 01:32 PM#3
LunarCrisis
right... sorry. I'll try to explain it.
I have a grid of locations I made with another trigger (their numbered in game if you wanna see their arrangement) labbelled from grid[11] to grid[88] (with [xy] coordinates). This trigger picks each one, then picks all units in the location and does some actions with them (this part is less important because it isn't getting this far anyways). I know the action in red is not working properly because the text message that is the first action displaying "unit picked" within it doesn't display whereas the text message searching squares" right before it does display (when I have that display action enabled that is)

I can't seem to figure out what is wrong. I have units of the proper ownership in the map, but it doesn't seem to be finding them.

Oh and in case you want the other trigger (the one which makes the locations) without downloading the map, here it is:

Code:
Initialize
    Events
        Map initialization
    Conditions
    Actions
        Game - Set the time of day to 12.00
        Game - Turn the day/night cycle Off
        [color=green]-------- making grid --------
        For each (Integer A) from 1 to 8, do (Actions)
            Loop - Actions
                For each (Integer B) from 1 to 8, do (Actions)
                    Loop - Actions
                        Game - Display to (All players) for 5.00 seconds the text: making location
                        Set Grid[(Integer(((String((Integer A))) + (String((Integer B))))))] = (Region((-640.00 + (128.00 x (Real((Integer A))))), (-640.00 + (128.00 x (Real((Integer B))))), (-512.00 + (128.00 x (Real((Integer A))))), (-640.00 + (128.00 x (Real((Integer B)))))))
                        Floating Text - Create floating text that reads ((String((Integer A))) + (String((Integer B)))) at (Center of Grid[(Integer(((String((Integer A))) + (String((Integer B))))))]) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency[/color] 
        Visibility - Create an initially Enabled visibility modifier for Player 1 (Red) emitting Visibility across (Region(-512.00, -512.00, 512.00, 512.00))
        Camera - Apply Camera 001 <gen> for Player 1 (Red) over 0.00 seconds
        Camera - Apply Camera 001 <gen> for Player 1 (Red) over 2.00 seconds

As far as I can see, this trigger makes the locations properly because when I look in game the floating text appears in the right place.