Removing an Ability from all units in a localized area

SGT Vejito

New Member
Reaction score
9
I'm trying to track down a way to remove an ability from a particular unit I have in a map I am creating.

Basicly here is what I want to happen:

there are 5 units, 4 of them are unit A and the fifth is unit B. Unit B gives an aura that provides 100% evasion for every Unit A until Unit B dies, at which point all Unit A's lose the 100% evasion.

I have coded the 100% evasion into an ability, incase that helps.

One of the problems (maybe) with this code is I only want it to remove the abilities from the unit A's equal to the colour of the Unit B that died, not sure if that changes how to do it or not.

Here is the code I was able to think up, but it's messing somewhere, and I think I know where...

Trigger:
  • Events
    • Unit - A unit Dies
    • Conditions
    • And - All (Conditions) are true
    • (Unit type of (Dying unit) Equal to Unit B
    • (RedPlayArea <gen> contains (Dying unit)) Equal to True
    • (Owner of (Dying unit)) Equal to Player 12 (Brown)
    • Actions
    • For each (Integer A) from 1 to 5, do (Unit - Remove Evasion from (Random unit from (Units in RedPlayArea <gen> matching (((Unit-type of (Triggering Unit) Equal to Unit A) and ((Owner of (Triggering unit)) Equal to Player 12 (Brown))))



I think it's messing on the tail end of the actions, where I've specified Triggering Unit twice, but I have no idea what else to put in its place, nothing seems to fit properly.

Huge thanks to anyone that can help me riddle this out, if you need any other information I'd be happy to provide what I can find out.
 

jig7c

Stop reading me...-statement
Reaction score
123
Events
Unit - A unit Dies
Conditions
And - All (Conditions) are true
(Unit type of (Dying unit) Equal to Unit B
(RedPlayArea <gen> contains (Dying unit)) Equal to True
(Owner of (Dying unit)) Equal to Player 12 (Brown)
Actions
set TempGroup = all units in Units @
pick all units in tempgroup and do actions
remove evasion from picked unit
call destroygroup(udg_tempgroup)
 

SGT Vejito

New Member
Reaction score
9
I've put that trigger into the game and it appears to be working properly, thanks a lot for the help Jig.
 

jig7c

Stop reading me...-statement
Reaction score
123
no problem, just make sure the evasion you are removing is your custom skill...

just give +rep in the right corner of the post if you think members deserve it...
 

SGT Vejito

New Member
Reaction score
9
It looks like i've run into a small snag with this trigger again.

Here's the trigger I made:

Trigger:
  • Events
    • Unit- A Unit Dies
    • Conditions
    • And - All (Conditions) are true
    • (Unit-type of Dying unit)) Equal to Unit B
    • (RedPlayArea &lt;gen&gt; Contains (Dying unit)) Equal to True
    • Owner of (Dying unit)) Equal to Player 12 (brown)
    • Actions
    • Set &lt;Unit Group Variable&gt; = (Units owned by player 12 (Brown) of type Unit A)
    • Unit Group - Pick every unit in &lt;Unit Group Variable&gt; and do (Unit - Remove Evasion from (Picked unit))


The trigger works fine now, when a unit B dies it removes evasion from every unit A, which is also the snag.

The snag I'm running into is it is picking all Unit A's on the map, and removing evasion from them. I need the trigger to only select units in a specific region if possible.

Again, any help would be greatly appreciated.

EDIT: looking at my earlier request I noticed I didn't write that I needed it to only select units from a specific region to remove the ability, so my bad on wasting effort.
 

SGT Vejito

New Member
Reaction score
9
insert self fulfilling bump here

I've still no idea on this trigger, can't puzzle out how exactly to get it working.
 

elmstfreddie

The Finglonger
Reaction score
203
Why not just have a unit group variable with an array, then a unit variable with an array.

Unit[1] = the first unit B guy,
UnitGroup[1] = the 5 units A to go with the first unit B guy
Unit[2] = the second unit B guy
UnitGroup[2] = the next 5 units A to go with the second unit B guy

Etc.

Oh, then for the trigger, just have the event a unit dies, then a loop in actions, and an if/then/else in the loop. If dying unit = unit[integer a], then pick every unit in unitgroup[integer a] and remove the ability.
 

SGT Vejito

New Member
Reaction score
9
Awesome, that worked out perfectly, each group recorded properly when spawned (24 of them total... a lot of triggers :) )

They all lose their abilities separately, and from my initial tests everything works properly.


Thanks a ton for the help Elmst.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top