HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Manual Attacking

05-01-2004, 02:06 AM#1
Aznwhore
I guess there was proly a thread about this b4 but i can't seem to find it anymore...
anyways, i created a trigger where the player selects a unit and the player's own unit attacks it

however, i need an expansion to that trigger...
i need the unit to attack ONLY when the unit is selected, meaning i don't want it to walk off on its own to attack someone
05-01-2004, 06:22 AM#2
Deathperception
You can use this as your event

Find (Player - Selection Event)

in the World Editor

After using that as the event you can use (Event Response - Triggering Unit) to refer to the unit being selected.

This is one of the few ways to do this without using WE Unlimited like I do. :D
05-01-2004, 08:12 AM#3
RED-Death
or you can make everyone allied.
05-01-2004, 02:20 PM#4
Shimrra
To do this, you need to first give the unit to a player that is allied with the enemies, but the enemies aren't allied with it. This way it won't attack them, you can't mess with it, and they will still attack it. Afterwards, try this trigger to make the unit attack:

Code:
Trigger 1
    Events
        Player - <HumanPlayer> Selects a unit
    Conditions
        (Owner of (Triggering unit)) Equal to <EnemyPlayer>
    Actions
        Set <UnitVariable> = (Triggering unit)
        Unit - Order <AttackingUnit> to Attack UnitVariable

Also, use this trigger to make the unit stop attacking:

Code:
Trigger 2
    Events
        Player - <HumanPlayer> Deselects a unit
    Conditions
        (Triggering unit) Equal to UnitVariable
    Actions
        Unit - <AttackUnit> to Stop
        Set UnitVariable = No unit

If you still want to be able to control the unit, then set it so the enemies are allied with you, but not you with them. Then use the same triggers as above, but with this one as well:

Code:
Trigger 3
    Events
        Unit - A unit owned by <HumanPlayer> Is issued an order targeting an object
    Conditions
        (Issued order) Equal to (Order(attack))
    Actions
        Unit - Order <AttackUnit> to Stop

I hope this is what you were looking for!

-Shimrra
05-03-2004, 11:53 AM#5
Aznwhore
alright, thx, ill get working on this asap