• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Spell] Spells that trap units inside an area?

Status
Not open for further replies.
Level 25
Joined
Jul 10, 2006
Messages
3,315
Right, so I went and made it MUI. Used Bribe's GUI Unit Indexer.

Ability is based on Healing Ward.

When the ward is summoned, record its position and the units near it.
  • Ward Cast
    • Events
      • Game - UnitIndexEvent becomes Equal to 1.00
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of UDexUnits[UDex]) Equal to Healing Ward
        • Then - Actions
          • Set TrapPoint[UDex] = (Position of UDexUnits[UDex])
          • Set TrapGroup[UDex] = (Units within 300.00 of TrapPoint[UDex] matching (((Matching unit) is dead) Equal to False))
          • Unit Group - Add UDexUnits[UDex] to Traps
        • Else - Actions
10 times a second, check the distance between each ward and each unit associated with each ward.
  • Ward Loop
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Traps and do (Actions)
        • Loop - Actions
          • Set key = (Custom value of (Picked unit))
          • Unit Group - Add all units of TrapGroup[key] to loopGroup
          • For each (Integer loopUnitid) from 1 to (Number of units in loopGroup), do (Actions)
            • Loop - Actions
              • Set loopUnit = (Random unit from loopGroup)
              • Unit Group - Remove loopUnit from loopGroup
              • Set tempLoc = (Position of loopUnit)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Distance between TrapPoint[key] and tempLoc) Greater than 300.00
                • Then - Actions
                  • Set tempLoc2 = (TrapPoint[key] offset by 285.00 towards (Angle from TrapPoint[key] to tempLoc) degrees)
                  • Unit - Move loopUnit instantly to tempLoc2
                  • Custom script: call RemoveLocation(udg_tempLoc2)
                • Else - Actions
              • Custom script: call RemoveLocation(udg_tempLoc)


Note that:
You still need a trigger that removes the wards from the unit group "Traps", and then nulls the variables registered to it.
Doesn't account for units that enter the range; you'll have to make another trigger that adds them to the "TrapGroup".
 

Attachments

  • trap001.w3x
    22.2 KB · Views: 58
Level 4
Joined
Aug 26, 2012
Messages
123
Well, I have an idea, a crazy idea... But maybe it works or just inspire...
(Hey, just give out the idea!
This is his idea...:
  • Events
    • Time - Every 0.10 seconds of game time
  • Conditions
    • Number of units in (unit-type group (ward)) not equal to 0
  • Actions
    • Unit Group - Pick every unit in (unit-type group (ward)) and do actions
      • Actions
        • Set The_Ward = Picked unit //You can use locals...
        • Unit Group - Pick every unit in ((units within (the_distance) of (The_Ward) matching (Picked unit equal to enemy of The_Ward)) and do actions
          • Actions
            • Unit - Move (picked unit) instantly to (position of (The_Ward))
Well, that's HIS idea, so don't blame me if it won't work, and don't 100% trust the trigger!)
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
Well, I have an idea, a crazy idea... But maybe it works or just inspire...
(Hey, just give out the idea!
This is his idea...:
  • Events
    • Time - Every 0.10 seconds of game time
  • Conditions
    • Number of units in (unit-type group (ward)) not equal to 0
  • Actions
    • Unit Group - Pick every unit in (unit-type group (ward)) and do actions
      • Actions
        • Set The_Ward = Picked unit //You can use locals...
        • Unit Group - Pick every unit in ((units within (the_distance) of (The_Ward) matching (Picked unit equal to enemy of The_Ward)) and do actions
          • Actions
            • Unit - Move (picked unit) instantly to (position of (The_Ward))
Well, that's HIS idea, so don't blame me if it won't work, and don't 100% trust the trigger!)

You're picking units... in a picking units. please don't
 
Level 4
Joined
Aug 26, 2012
Messages
123
rulerofiron said:
You're picking units... in a picking units. please don't
Yeah, I know, sorry about that...
That's why I call it crazy idea... never tried! lol
(So, he's declaring that he's crazy, huh? that's true...
he's the man with nothing to do, so he's just crazy-ing triggers...)
 
Status
Not open for further replies.
Top