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

[JASS] Request for JASS critique

Status
Not open for further replies.
Level 2
Joined
May 1, 2006
Messages
4
Hi :)

I'm new to JASS, and I recently completed my first major function using JASS. I'm looking for evaluations of it so I can improve techniques.

Repel Trap Demo

The map itself is simple enough - a single hero that has the "Repel Trap" ability which will repel an enemy hero that comes near it. (Essentially it is DotA Tiny's Toss in the form of a trap.)

The trap repel (toss) is in the direction that your hero faces at the time when he plants the trap.

At levels 1 and 2 you're allowed one instance of the trap, at levels 3 and 4 you're allowed two. (Making it possible to have trap-chains).

The implementation is *supposed* to be fully multi-instantiable and leak-free.

What I think is interesting is the way I've handled trap-and-timer instantiation. Instead of creating/destroying traps as they get planted or activated, I recycle them, using the same units as trap and the same timers to check for trap activation. Traps also have an "age" associated with them, allowing me to replace the oldest trap with a new one when the ability is activated.
 
Level 2
Joined
May 1, 2006
Messages
4
UPDATE :)

The link is updated with the newest version of the demo map. Fixed a bug when destroying your own trap, some minor optimizations, added tree destruction to ensure the ability can't be used to trap enemy heroes inside trees.
 
Status
Not open for further replies.
Top