• 🏆 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!

Unit type specific mine

Status
Not open for further replies.
I need a a goblin mine to be triggered only by mechanical units and have the target AOE shown when choosing where to place it. IE when attempting to place it in deep water it should trigger an error message.

I've been struggling with this for some time and can't seem to find a solution. I've tried using various dummy spells and altering what targets the AOE damage upon death spell has.
 
Level 6
Joined
May 11, 2010
Messages
236
Urgh, I got it working but I can't have more than 1 mine working at a time. I'm trying to work out how. Hopefully someone will help before I figure it out.
 
Level 5
Joined
Sep 1, 2010
Messages
168
It's easy
You'll need a dummy spell that shows your aoe (like silence) to place, then a condition check upon starts casting an ability (here you'll stop the unit if impossible and show error message) you conditions.
Another trigger that fires when 'unit starts effect of an ability' which creates you mine dummy unit and uses the action - event - "a unit matching (your condition) comes within (your aoe) of last created unit" to another trigger.
That last trigger only has action code: pick every unit of unit type (your mine) in (your aoe) around triggering unit
-kill picked unit
-damage triggering unit for (whatever damage)

(just an explanation above, no acutal coding, no leak removal)
If you want to use hashtables instead, you could create a mine group and check like every 0.1 seconds:
pick every unit in minegroup
-set currentmine =picked unit
if(a unit matching (your condition) is within (your aoe) of current mine
-damage all units matching (your condition) within (your oae) of currentmine for damage xyz
remove currentmine from minegroup
-kill currentmine

The latter deals damage to all units to all units matching your condition, the earlier only to the triggering unit - depends on what you want to achieve with your mine, though i believe that the 2nd version is a) better and b) if you want effect a) youcan achieve it too.
 
Status
Not open for further replies.
Top