Making a Unit Cast an Ability on Every Unit Near Every Unit in a Unit Group

Azrooh

New Member
Reaction score
5
...The title's a bit of a mouthful. But hopefully these triggers will explain it:


Trigger:
  • Plague
    • Events
      • Time - Every 0.25 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area) matching (((Matching unit) has buff Coughing Plague) Equal to True)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is in PlagueGroup) Not equal to True
            • Then - Actions
              • Unit Group - Add (Picked unit) to PlagueGroup
            • Else - Actions
      • Unit Group - Pick every unit in PlagueGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is in PlagueGroup) Equal to True
            • Then - Actions
              • Region - Center PlagueIncubationRegion <gen> on (Position of (Picked unit))
            • Else - Actions



Trigger:
  • Plague 2
    • Events
      • Time - Every 0.25 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in PlagueIncubationRegion <gen> matching (((Matching unit) is in PlagueGroup) Not equal to True)) and do (Actions)
        • Loop - Actions
          • Set DiseasePoint = (Position of (Picked unit))
          • Unit - Create 1 PlagueDummy 5 for Neutral Extra at (Center of (Playable map area)) facing Default building facing degrees
          • Unit - Order (Last created unit) to Neutral - Parasite (Picked unit)
          • EGUI Leak - Remove DiseasePoint
          • Unit - Remove (Last created unit) from the game



What I'm trying to do here is cause a dummy to cast Parasite on every unit that's near a unit in the unit group PlagueGroup.
This trigger doesn't work, but I think I'm on the right track. How would I fix it?
 

jedi8955

New Member
Reaction score
4
Well, I see one issue with the Region. The way you have it set up, it moves the region around a lot without anything actually happening.

I would suggest that instead of moving a region, you have them give a buff to each other unit within x meters, then check for the buff.

Try these triggers:

Trigger:
  • Plague
    • Events
    • Time - Every 1 seconds of game time
      • Comment: Every .25 seconds is overkill and might lead to lag. I'd dial it back to 1 or 2 seconds.
    • Conditions
    • Actions
    • Unit Group - Pick every unit in (Units in (Playable map area) matching (((Matching unit) has buff Coughing Plague) Equal to True)) and do (Actions)
    • Loop - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
    • ((Picked unit) is in PlagueGroup) Not equal to True
    • Then - Actions
    • Unit Group - Add (Picked unit) to PlagueGroup
    • Else - Actions
    • Unit Group - Pick every unit in PlagueGroup and do (Actions)
    • Loop - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • ((Picked unit) is in PlagueGroup) Equal to True
    • Then - Actions
      • Player - Enable Spellbook for (Owner of (Picked Unit)
      • Unit - Set level of Plague Spreading for (Picked Unit) to 2
      • Player - Disable Spellbook for (Owner of (Picked Unit)
        • Comment: Plague Spreading is a simple Aura ability based off of Devotion Aura. Make sure to set it to +0 armor. The spell book is to hide the icon from the unit. Set up Plague Spreading to have 2 levels and have it give a unique buff at level 2 and nothing at level 1. Stick the Plague Spreading in the Spellbook and give the spellbook to every single unit. Put a Player - Disable Spellbook for each player in your initialization trigger.
    • Else - Actions
    • Do Nothing


Now for the actual parasite trigger:

Trigger:
  • Plague 2
    • Events
    • Time - Every 1 seconds of game time
    • Conditions
    • Actions
    • Unit Group - Pick every unit in (Units in (Playable map area) matching (((Matching unit) has buff SpreadingPlagueBuff [Comment: Put the unique buff from the aura here) Equal to True)) and do (Actions)
    • Loop - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • ((Picked unit) is in PlagueGroup) Equal to False
      • Then - Actions
        • Set DiseasePoint = (Position of (Picked unit))
        • Unit - Create 1 PlagueDummy 5 for Neutral Extra at (Center of (DiseasePoint)) facing Default building facing degrees [Comment: You had it at the Center of Playable Map Area, fixed to be at the plagued unit.]
        • Unit - Order (Last created unit) to Neutral - Parasite (Picked unit)
        • EGUI Leak - Remove DiseasePoint
        • Unit - Remove (Last created unit) from the game
      • Else - Actions
        • Do Nothing


Lastly, we need a new trigger that handles if a unit loses Coughing Plague.

Trigger:
  • Events
    • Time - Every 1 seconds of game time
    • Conditions
    • Actions
    • Unit Group - Pick every unit in (PlagueGroup) and do (Actions)
    • Loop - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • ((Picked unit) has buff matching Coughing Plague) Equal to False
      • Then - Actions
        • Remove (Picked Unit) from (PlagueGroup)
      • Else - Actions
        • Do Nothing


That should handle all the group stuff for ya.
 

Azrooh

New Member
Reaction score
5
The entire point of casting the spell is the buff. It's just a dummy spell.
What I'm stuck on is getting the spell to cast on everyone so they get the buff.


E: I see how that works. Would there be a way to 'time' the buff, so it expires?

E2: I posted before you finished it. Thanks!
 
General chit-chat
Help Users

      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