HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Flaw with recreating Rally Point with triggers?

10-22-2003, 11:04 PM#1
Panto
Greetings.

I made three triggers to emulate the action of going to a rally point for units that are spawned into the game.

They work as intended. Although I can't seem to copy the "move to target, follow target, attack if enemies get close" behavior that rally points do as of TFT, I'm satisfied with how they work.

However, if a player is controlling a computer ally (who has no AI running), units that the computer spawns will run to the waypoint, and then turn around and run back to their starting position.

Since they've actually been ordered to move, this doesn't seem to be a situation of AI - Ignore Guard Position. I'm guessing that some aspect of my triggers is causing the units to behave differently if the player setting the fake rally point isn't their original owner.

So, please take a look at these triggers and see if you can spot something that I've missed.
Code:
Rally Point for point
    Events
        Unit - A unit Is issued an order targeting a point
    Conditions
        ((Issued order) Equal to (Order(smart))) or ((Issued order) Equal to (Order(setrally)))
        ((Ordered unit) is A structure) Equal to True
    Actions
        Set pointArrayRallyPoint[(Player number of (Owner of (Ordered unit)))] = (Target point of issued order)
        Set booleanArrayRallyPoint[(Player number of (Owner of (Ordered unit)))] = True
        Set booleanArrayRallyUnit[(Player number of (Owner of (Ordered unit)))] = False
Code:
Rally Point for unit
    Events
        Unit - A unit Is issued an order targeting an object
    Conditions
        ((Issued order) Equal to (Order(smart))) or ((Issued order) Equal to (Order(setrally)))
        ((Ordered unit) is A structure) Equal to True
    Actions
        Set booleanArrayRallyUnit[(Player number of (Owner of (Ordered unit)))] = True
        Set unitArrayRallyUnit[(Player number of (Owner of (Ordered unit)))] = (Target unit of issued order)
        -------- Disable if the target is the player's townhall --------
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Target unit of issued order) Equal to unitArrayTownHall[(Player number of (Owner of (Ordered unit)))]
            Then - Actions
                Set booleanArrayRallyPoint[(Player number of (Owner of (Ordered unit)))] = False
            Else - Actions
                Set booleanArrayRallyPoint[(Player number of (Owner of (Ordered unit)))] = True
Code:
Unit Dies with Rally
    Events
        Unit - A unit Dies
    Conditions
        (Dying unit) Equal to unitArrayRallyUnit[(Player number of (Owner of (Dying unit)))]
        booleanArrayRallyUnit[(Player number of (Owner of (Dying unit)))] Equal to True
    Actions
        Set booleanArrayRallyPoint[(Player number of (Owner of (Dying unit)))] = False
        Set booleanArrayRallyUnit[(Player number of (Owner of (Dying unit)))] = False
EDIT: I noticed that the last trigger didn't quite perform up to expectations if the rally point was set on a unit, and then set on a location, and then the unit died. Fixed.
10-22-2003, 11:26 PM#2
Grater
Um the AI guard position is where the unit will return to.
To me it does sound like a problem with AI guard position, have you tried using the ignore guard position trigger?
10-22-2003, 11:28 PM#3
Panto
Ah! But Guard Position applies to when a unit is standing and starts moving to pursue an enemy.

These units are specifically ordered to move.
10-22-2003, 11:59 PM#4
Grater
Just tell me you tried the Ignore guard position trigger and it didn't work.

Anyway, here are my findings from a little test map:

When an AI controlled unit is issued an order by a player via share unit control, the unit ignores it's guard position.

When an AI controlled unit is issued an order via a trigger, it will (try to) return to it's guard position.

gg?
10-23-2003, 12:08 AM#5
Panto
Hm, good test. I wonder if there's a way to have it both ways?

I don't actually want the units to ignore their guard positions, normally, but I don't want them to run home, either.
10-23-2003, 12:19 AM#6
Grater
The guard position is not to do with the AI that normal players units get... it's for overriding the order-units-with-trigger behaivour, if you make the unit ignore it's guard position, it will still only chase enemy units a limited distance. The trigger is under "AI" which is a good clue that it's for AI players, not for unit AI.


Heres my experience with making neutral hostile units do exactly what I want. (units owned by neutral players always ignore the "ignore guard position" trigger)

What I did, was write a trigger that catches when an "attacking creep" is issued a MOVE order, the only MOVE order creeps get is the one to make them return to their guard position, I then issue the creep a new ATTACK-MOVE order, which immediately broke the creeps desire to return to it's home. The only problem was, it also pretty much broke the entire units AI meaning that the unit would happily stay still while being catapulted to death, or chase an enemy unit literally forever - depending on it's aquisitation range.

Luckily for normal AI players you only need to use the AI - Ignore units guard position, and be done with it.
10-23-2003, 04:46 AM#7
Panto
So, I added the "AI - Ignore Unit's Guard Position" immediately after creating each unit, but it didn't solve the problem.
In summary:
Quote:
Unit - Create 1 unittypeSpawn for (Picked player) at (Center of regionStart) facing (Position of Castle 002 <gen>)
AI - Ignore (Last created unit)'s guard position
Unit - Order (Last created unit) to Attack-Move To pointArrayRallyPoint[(Player number of (Picked player))]
However, the units still went to the designated point, and then immediately turned around and went home.
10-23-2003, 05:00 AM#8
Grater
That sounds odd, because for me in a simple test map the AI - Ignore guard position trigger works fine.

I also seem to recall with another map that I needed to tell units to ignore guard position multiple times before they obeyed.

It's also possible that the AI is slipping an extra order in with the attack-move command, because a trigger I wrote to display orders given showed a number of <empty string> orders given to units on creation, moving etc. Because this order doesn't convert to a string, I dont know what it is. It might be something to do with guard position.

1st thing to try:
Move the "ignore" action to after the "attack-move" action, thus causing it to override any "extra" orders given by the AI.
2nd thing to try:
Use the "ignore" action more than once.
10-23-2003, 05:12 AM#9
Panto
Moving the Ignore after the order to attack-move didn't help. In fact, now the units that I don't manually move out of the base don't attack-move at all, and the ones that I do move out of the base return as soon as they reach where I move them to.

How do you recommend doing multiple ignores? Just slap down three in a row, or so?
10-23-2003, 05:14 AM#10
Panto
Perhaps it's best if I include the trigger that tells the unit to move in here, for reference.
Code:
Spawn tier 1
    Events
        Time - Every 13.00 seconds of game time
    Conditions
    Actions
        Player Group - Pick every player in playergroupArraySpawn[1] and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        intArraySpawned[(Player number of (Picked player))] Less than or equal to 34
                    Then - Actions
                        Unit - Create 1 unittypeArraySpawn[(Player number of (Picked player))] for (Picked player) at (Center of regionArrayStart[(Player number of (Picked player))]) facing (Position of Fae Toadstool 0012 <gen>)
                        AI - Ignore (Last created unit)'s guard position
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                booleanArrayRallyUnit[(Player number of (Picked player))] Equal to False
                                booleanArrayRallyPoint[(Player number of (Picked player))] Equal to True
                            Then - Actions
                                Unit - Order (Last created unit) to Attack-Move To pointArrayRallyPoint[(Player number of (Picked player))]
                            Else - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                booleanArrayRallyUnit[(Player number of (Picked player))] Equal to True
                                booleanArrayRallyPoint[(Player number of (Picked player))] Equal to True
                            Then - Actions
                                Unit - Order (Last created unit) to Attack-Move To (Position of unitArrayRallyUnit[(Player number of (Picked player))])
                            Else - Actions
                    Else - Actions
10-23-2003, 11:04 PM#11
Panto
Hm, no matter where I'm putting the "AI - Ignore Guard Position" action in the trigger, it isn't fixing the computer's behavior.
10-24-2003, 05:14 AM#12
Panto
Okay, I added the following
Quote:
Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
Loop - Actions
AI - Ignore (Picked unit)'s guard position
into the trigger that spawns the units, right after the move order.

It seems to stop the units that are told to move from ever returning to their creation point automatically. However, it also stops units from following the triggered move command. They never attempt to go to the pseudo rally point at all.

I need the best of both worlds. I can't sacrifice the functionality of the faux-rallypoint trigger in order to gain the ignore guard position behavior.

So, where can I place this action so that it won't stop the units from moving via the spawn trigger?