• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Solved] Pick units within region but check contains the caster

Level 17
Joined
Jun 2, 2009
Messages
1,141
Hello everyone. I have created spell but i have to check something extra.
Spell works in 2 ways. X range of target point of ability being cast contains the caster or not.
Example: You are casting Blizzard and enemies takes damage. But if your caster into the region, i wand to add another action.

  • Unit Group - Pick every unit in (Units within 350.00 of TempPoint matching (((Matching unit) belongs to an enemy of (Owner of Blood Mage 0076 <gen>)) Equal to True)) and do (Actions)
    • Loop - Actions
      • bla bla bla...
Maybe i am asking easy question but i am tired now. I cannot think properly.

Update: Ok it seems i found it but i believe this trigger will not gonna work properly. I can see "Then" text but i cannot see "Else" text when cast it on myself or ground. I will check this when i woke.

  • Events
    • Time - BloodStrikeTimer expires
  • Conditions
  • Actions
    • Set TempGroup = (Units within 350.00 of TempPointBloodstrike)
    • Special Effect - Create a special effect at TempPointBloodstrike using war3mapImported\Flamestrike Blood I.mdx
    • Unit Group - Pick every unit in TempGroup and do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • ((Picked unit) belongs to an enemy of (Owner of HeroOoO[17])) Equal to True
            • ((Picked unit) is alive) Equal to True
            • ((Picked unit) is in NNN) Equal to True
          • Then - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Blood Mage 0009 <gen> is in TempGroup) Equal to True
              • Then - Actions
                • Unit - Cause HeroOoO[17] to damage (Picked unit), dealing 500.00 damage of attack type Spells and damage type Magic
                • Game - Display to (All players) for 1.00 seconds the text: Then
              • Else - Actions
                • Game - Display to (All players) for 1.00 seconds the text: else
                • Unit - Cause HeroOoO[17] to damage (Picked unit), dealing 500.00 damage of attack type Spells and damage type Magic
          • Else - Actions
    • Custom script: call RemoveLocation(udg_TempPointBloodstrike)
Then is not works at the moment.
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,567
Checking if a Unit is in a Unit Group requires the game to Loop over that Unit Group which you're already doing in the first place.

Instead, check if the Blood Mage is in the Unit Group first, then decide what to do based on that:
  • Events
    • Time - BloodStrikeTimer expires
  • Conditions
  • Actions
    • Set TempGroup = (Units within 350.00 of TempPointBloodstrike)
    • Special Effect - Create a special effect at TempPointBloodstrike using war3mapImported\Flamestrike Blood I.mdx
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Blood Mage 0009 <gen> is in TempGroup) Equal to True
      • Then - Actions
        • Unit Group - Pick every unit in TempGroup and do (Actions)
          • Loop - Actions
      • Else - Actions
        • Unit Group - Pick every unit in TempGroup and do (Actions)
          • Loop - Actions
    • Custom script: call RemoveLocation(udg_TempPointBloodstrike)
 
Top