- Joined
- Apr 19, 2011
- Messages
- 447
Hi.
I have a serious problem right now. I'm trying to make my very first spell. I've read some tutorials about hashtables, but I still don't know very well how to use them...
First, I'll explain what the spell should do. It's for a hero called "Gnoll Explorer". The spell's name is Evanescence, and if the hero uses it, it will teleport with fast speed above the enemies and will fall on them, inflicting damage.
Before showing the triggers, I'll explain a few things about the map, and the variables used:
- In the map, Player 12 is the user, and Player 11 is the enemy. The Gnoll Explorer is a Player 12's unit.
- In one of the triggers, I create a unit called "Gnoll Explorer (Evanescence)". This is some kind of dummy unit. It has the same model as the Gnoll Explorer, with 0 collision, and with flying movement, with default flying height of 500.
- Evanescence: Hashtable variable
- Evanescence_Vector: Integer array
- Evanescence_Damage: Integer array
- Remaining_Jumps: Integer variable
- LEAK: Point variable
- GroupLEAK: Unit group variable
The "Evanescence Start" trigger runs fine. However, the "Evanescence Loop" trigger does absolutely nothing. In-game, the hero disappears with a special effect, and after 3 second it reappears again, without doing damage to anything.
As I said before, this is the first time I try to make stuff with hashtables and handles IDs, I'm a NOOB with this things.
I'll be extremely grateful if you help me fix this spell. Also, I'll really appreciate that someone helps me find and fix any leak around the triggers.
Thanks in advance.
Regards
I have a serious problem right now. I'm trying to make my very first spell. I've read some tutorials about hashtables, but I still don't know very well how to use them...
First, I'll explain what the spell should do. It's for a hero called "Gnoll Explorer". The spell's name is Evanescence, and if the hero uses it, it will teleport with fast speed above the enemies and will fall on them, inflicting damage.
Before showing the triggers, I'll explain a few things about the map, and the variables used:
- In the map, Player 12 is the user, and Player 11 is the enemy. The Gnoll Explorer is a Player 12's unit.
- In one of the triggers, I create a unit called "Gnoll Explorer (Evanescence)". This is some kind of dummy unit. It has the same model as the Gnoll Explorer, with 0 collision, and with flying movement, with default flying height of 500.
- Evanescence: Hashtable variable
- Evanescence_Vector: Integer array
- Evanescence_Damage: Integer array
- Remaining_Jumps: Integer variable
- LEAK: Point variable
- GroupLEAK: Unit group variable
-
Settings
-
Events
- Map initialization
- Conditions
-
Actions
- -------- Here I create the hashtable --------
- Hashtable - Create a hashtable
- Set Evanescence = (Last created hashtable)
- -------- Here I set the number of enemies he hero will fall on per level --------
- Set Evanescence_Vector[1] = 3
- Set Evanescence_Vector[2] = 5
- Set Evanescence_Vector[3] = 7
- -------- Here I set the damage dealt with each attack per level --------
- Set Evanescence_Damage[1] = 85
- Set Evanescence_Damage[2] = 125
- Set Evanescence_Damage[3] = 175
-
Events
-
Start Evanescence
-
Events
- Unit - A unit Starts the effect of an ability
-
Conditions
- (Unit-type of (Triggering unit)) Equal to Gnoll Explorer
- (Ability being cast) Equal to Evanescence
-
Actions
- -------- Here I save the number of attacks, the damage, and the target unit in the hashtable --------
- Hashtable - Save Evanescence_Vector[(Level of Evanescence for (Triggering unit))] as 0 of (Key (Triggering unit)) in Evanescence
- Hashtable - Save Evanescence_Damage[(Level of Evanescencia for (Triggering unit))] as 4 of (Key (Triggering unit)) in Evanescence
- Hashtable - Save Handle Of(Target unit of ability being cast) as 1 of (Key (Triggering unit)) in (Last created hashtable)
- -------- Here I add the hero to an unit group, I wil use it in the next trigger --------
- Unit group - Add (Triggering unit) to Ability_Evanescence
- -------- Graphical stuff --------
- Unit - Hide (Triggering unit)
- Set LEAK = (Position of (Triggering unit))
- Special effect - Create a special effect at LEAK using war3mapImported\BlackBlink.mdx
- Special effect - Destroy (Last created special effect)
- Custom script: call RemoveLocation(udg_LEAK)
-
Events
-
Evanescence Loop
-
Events
- Time - Every 2.00 seconds of game time
- Conditions
-
Actions
-
Unit group - Pick every unit in Ability_Evanescence and do (Actions)
-
Loop - Actons
- Set Remaining_Jumps = (Load 0 of (Key (Picked unit)) from Evanescence)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- Remaining_Jumps Igual a 0
-
Then - Actions
- -------- If all the attacks have been used, the unit returns to normal state --------
- Unit Group - Remove (Picked unit) from Ability_Evanescence
- Unit - Unhide (Picked unit)
-
Other - Action
- -------- I update the number of attacks left. I also play a sound, and create the dummy unit at the position of the target --------
- Sound - Stop Evanescence <gen> Immediately
- Set Remaining_Jumps = (Remaining_Jumps - 1)
- Hashtable - Save Remaining_Jumps as 0 of (Key (Picked unit)) in Evanescence
- Set LEAK = (Position of (Load 1 of (Key (Picked unit)) in Evanescence))
- Unit - Create 1 Gnoll Explorer (Evanescence) for Player 12 (brown) at LEAK facing 270.00 degrees
- Custom script: call RemoveLocation(udg_LEAK)
- Sound - Play Evanescence <gen> at 100.00% volume, attached to (Last created unit)
- -------- I store the dummy unit in the hashtable --------
- Hashtable - Save Handle Of(Last created unit) as 2 of (Key (Picked unit)) in Evanescence
- -------- I create a special effect on the dummy unit, and store it in the hashtable as well --------
- Special effect - Create a special effect attached to the chest of (Last created unit) using war3mapImported\BlackBlink.mdx
- Hashtable - Save Handle Of(Last created special effect) as 3 of (Key (Picked unit)) in Evanescence
- -------- I make the unit fall, and wait until it reaches the ground --------
- Animation - Change (Last created unit) flying height to 0.00 at 500.00
- Wait 1.00 seconds
- -------- I create a special effect at the position of the target --------
- Set LEAK = (Position of (Load 1 of (Key (Picked unit)) in Evanescence))
- Special effect - Create a special effect at LEAK using Abilities\Spells\Orc\WarStomp\WarStompCaster.mdl
- Special effect - Destroy (Last created special effect)
- Custom script: call RemoveLocation(udg_LEAK)
- -------- I remove the dummy unit and the special effect attached to it --------
- Special effect - Destroy (Load 3 of (Key (Picked unit)) in Evanescence)
- Unit - Remove (Load 2 of (Key (Picked unit)) in Evanescence) from the game
- -------- I set a region around the target --------
- Set LEAK = (Position of (Load 1 of (Key (Picked unit)) in Evanescence))
- Set GroupLEAK = (Units in (Region centered at LEAK with size (800.00, 800.00)) owned by Player 11 (dark green))
- Custom script: call RemoveLocation(udg_LEAK)
- -------- I damage the target --------
- Unit - Set life of (Load 1 of (Key (Picked unit)) in Evanescence) to ((Life of (Load 1 of (Key (Picked unit)) in Evanescence)) - (Load 4 of (Key (Picked unit)) from Evanescence))
- -------- I set a new random target for the next attack --------
- Hashtable - Save Handle Of(Random unit from GroupLEAK) as 1 of (Key (Picked unit)) in (Last created hashtable)
- Custom script: call DestroyGroup(udg_GroupLEAK)
-
If - Conditions
-
Loop - Actons
-
Unit group - Pick every unit in Ability_Evanescence and do (Actions)
-
Events
As I said before, this is the first time I try to make stuff with hashtables and handles IDs, I'm a NOOB with this things.
I'll be extremely grateful if you help me fix this spell. Also, I'll really appreciate that someone helps me find and fix any leak around the triggers.
Thanks in advance.
Regards