• 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.

[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