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.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top