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

Creating themed traps?

Status
Not open for further replies.
Level 7
Joined
Jan 17, 2019
Messages
163
Hello, in my project I'd like to create a variety of traps similar to Goblin Land Mine except they all do different things. For example one of my units should place a bomb visible to friendlies shaped like the "stake" doodad and when a unit passes near they'll get an effect that looks and acts like Crypt Lord's Impale ability. I'd also like to do ones that only debuff the enemy units.

So far all my experiments with the Goblin Land Mine have failed, I feel like I might be trying to do this the hard way. Anyone up for helping me get the ability/trigger started?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
I think there are three approaches for traps.
  1. Use goblin landmine and detect when it dies. Use a damage detection system to rule out fatal damage (trap was killed) so only self destructs should be detected. When it dies from self destruct you search the surrounding area for victims that triggered it and then apply the appropriate themed effect to them.
  2. Periodically poll dummy mine units for victims. Check units nearby and if any are in detonation range kill the mine and apply the appropriate themed effect to the victims.
  3. Register a unit enters range event with dummy mines. Validate the unit which entered range for an appropriate victim. If one is found, detonate and apply the appropriate themed effect. Be aware that unit in range events can only get the entering unit, and not the unit who's range was entered so that must be tracked separately. To prevent leaks either a trigger per mine must be created, or periodically the trigger must be recreated to allow events to be recycled.
 
Status
Not open for further replies.
Top