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

Why isn't this working?!

Status
Not open for further replies.
Level 4
Joined
Apr 23, 2011
Messages
88
I've spent... way too long... trying to get this simple spell to work. Can someone help?

The Spell: Lay Trap

1. A hero gets the level 1 spell, casts it on a point, takes 3 seconds to cast the ability, then a tiny cage is created and also a dummy caster sorceress, both at the targeted point.

Problem 1: The sorceress has the "locust" ability but, for some reason, she's still visible. Why?!

2. Then the sorceress is suppose to cast invisibility on the cage (which is a unit, not a building or doodad).

Problem 2: Sometimes she does; sometimes she chooses not to. Why?!

3. A region that exists in the world editor is suppose to be centered at the target point of Lay Trap.

Problem 3: It never moves from its original location on the map. Why?! (I know this because the sorceress is suppose to ensnare a unit owned by player two when it enters the region and be removed from the game after that, and she will cast sometimes and will always get removed from the game when the unit enters the region where it exists on the map in the world editor.)

4. The sorceress is suppose to cast ensnare on a player two unit when it enters the region.

Problem 4: It almost never casts ensnare. Why?! (It did once.)








Here's are my triggers:


1. Lay Trap

A. Events
Unit - A unit owned by Player 1 (Red) Starts the effect of an ability

B. Conditions
(Ability being cast) Equal to Lay Trap

C. Actions
Region - Center Region 000 <gen> on (Target point of ability being cast)
Unit - Create 1 Trap (1) for Player 1 (Red) at (Target point of ability being cast) facing Default building facing degrees
Set Hunter[4] = (Last created unit)
Unit - Create 1 Dummy casterzz for Player 1 (Red) at (Target point of ability being cast) facing Default building facing degrees
Set Hunter[5] = (Last created unit)
Wait 0.01 seconds
Unit - Order Hunter[5] to Human Sorceress - Invisibility Hunter[4]

2. Enter trap

A. Events
Unit - A unit enters Region 000 <gen>

B. Conditions
(Owner of (Entering unit)) Equal to Player 2 (Blue)

C. Actions
Unit - Order Hunter[5] to Orc Raider - Ensnare (Entering unit)
Wait 0.01 seconds
Unit - Remove Hunter[4] from the game
Unit - Remove Hunter[5] from the game
 
1) You don't have to create a sorceress to cast the invisibility skill, you could just add it in the cage and order it to cast it on itself.

2) You don't need a dummy to cast invisibility, just add the "Permanent invisibility" to the cage (it's passive and triggers self invisibility).

3) A unit that has locust becomes invulnerable and unselectable, it doesn't become invisible. In order to make it invisible, change this unit's model to ".mdx" (type that down, in the Art - Model field, without the quotations).

4) The sorcess is probably acquiring targets to attack, that's why she might be having this kind of behaviour. Go to Sorceress unit in Object Editor and scroll to Combat - Attacks enabled, set it to "None".

5) Waits under 0.272 seconds are inaccurate. There is no reason to use those waits after all. The actions will be performed just fine! ;]

6) Your triggers leak, read a tutorial about it: http://www.hiveworkshop.com/forums/triggers-scripts-269/things-leak-35124/

7) Instead of using a wait before you remove the units, add an expiration timer to them of 2.00 seconds.
 
Level 4
Joined
Apr 23, 2011
Messages
88
Thanks for all the great info, Pharaoh!

1. I changed everything I knew how to and the cage cast the net but the region still did not move.

2. So, I read the leaks thing but I'm not sure what it means really or how it related to my spell.
 
See you order a creation of unit at (Target point of ability being cast). That one is a point, and in programming, it's an "object", which needs to be 'deallocated' (removed), in order to prevent memory space from being taken. Everything you do in the game takes up memory and certain things can be cleaned, to repel lag from the game; that link contains every possible object that can be removed.

You must create a region specifically for this cage, but you will need Jass for that for perfect efficiency. Since you are using basic GUI, you can pick every unit in range of the cage. If there are indeed units nearby, order the cage to ensnare the unit and add an expiration timer to it.
 
Status
Not open for further replies.
Top