• 🏆 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] Goblin landmines - target self, but get exp

Status
Not open for further replies.
Level 21
Joined
Mar 29, 2020
Messages
1,237
hey there,

I'm making a spell where i'd like to have the hero set goblin landmines that the triggering player can't see, and that will target and harm his units, but when they kill enemy units he should still get the experience. any way to do that?
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,539
Try triggering the creation/detonation of the mines.

How you could do it:
1) Create a custom landmine ability that targets a Point.
2) When you cast the spell, create a custom hostile-owned mine at the Point that has X attack range, X being the "Detonation Radius".
3) Link the Casting Player to the Mine using a Unit Indexer. (Player variable)
4) Then create a new Trigger with the Event "A unit is attacked", and check if it's the mine that's attacking.
5) If it is, change the owner of the mine to the Casting Player (reference the Player variable we made earlier)
6) Then pick every unit within X range of the mine, X being the "Explosion AoE", and have the mine damage the picked units.
7) Finally, kill the mine.

This should result in an invisible mine that damages everything around it, friend or foe. It'll also reward exp/bounty to the creator of the mine upon killing enemies.
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,539
It's just a neutral hostile unit that autoattacks nearby enemies. It doesn't have any of the old landmine functionality.

If you don't kill the mine it will sit there attacking things forever.

Also, you may want to adjust it's attack so it launches it's attack immediately (you could toy around with this), but make the damage point have a delay, this way it's destroyed before it's attack ever finishes.

This will result in the attacked unit never getting hit by the autoattack but still setting off the "A unit is attacked" event.

It's essentially an invisible, neutral hostile-owned Serpent Ward, that is triggered to explode when it attacks an enemy.
 
Last edited:
Status
Not open for further replies.
Top