- Joined
- Mar 29, 2012
- Messages
- 542
I was making a spell named 'Tornado' but i got a problem...
The caster start the ability, and it spawns a big tornado. The tornado will pick all enemies in range to be spin around the tornado, but it's not happens (I test it by adding a special effect)
I am new using hashtables (switch from indexing to hashtables)
The caster start the ability, and it spawns a big tornado. The tornado will pick all enemies in range to be spin around the tornado, but it's not happens (I test it by adding a special effect)
-
T Configuration
-
Events
- Map initialization
- Conditions
-
Actions
- Set T_Ability = Tornado
- Set T_Dummy_Type = Dummy
- Set T_Max_Distance[1] = 1500.00
- Set T_Max_Distance[2] = 1500.00
- Set T_Max_Distance[3] = 1500.00
- Set T_Speed[1] = 20.00
- Set T_Speed[2] = 20.00
- Set T_Speed[3] = 20.00
- Set T_Damage[1] = 50.00
- Set T_Damage[2] = 60.00
- Set T_Damage[3] = 70.00
- Set T_AoE[1] = 300.00
- Set T_AoE[2] = 300.00
- Set T_AoE[3] = 300.00
- Set T_Scale[1] = 200.00
- Set T_Scale[2] = 200.00
- Set T_Scale[3] = 200.00
- Set T_Max_Height[1] = 400.00
- Set T_Max_Height[2] = 400.00
- Set T_Max_Height[3] = 400.00
- Set T_Fly_Speed[1] = 10.00
- Set T_Fly_Speed[2] = 10.00
- Set T_Fly_Speed[3] = 10.00
- Set T_Pull_Speed[1] = 25.00
- Set T_Pull_Speed[2] = 25.00
- Set T_Pull_Speed[3] = 25.00
- Set T_Gravity_Speed[1] = 2.00
- Set T_Gravity_Speed[2] = 2.00
- Set T_Gravity_Speed[3] = 2.00
- Set T_Model = Abilities\Spells\Other\Tornado\TornadoElementalSmall.mdl
- Set T_Target_Effect = Abilities\Spells\Other\Tornado\Tornado_Target.mdl
- Set T_Attack_Type = Normal
- Set T_Damage_Type = Normal
- Set T_Interval = 0.03
- -------- =========================================================================== --------
- Hashtable - Create a hashtable
- Set T_Hashtable = (Last created hashtable)
- Trigger - Add to T Loop <gen> the event (Time - Every T_Interval seconds of game time)
- Custom script: set udg_Harvester = CreateUnit(Player(15), 'hpea', 0, 0, 0)
- Custom script: call ShowUnit(udg_Harvester, false)
- Custom script: set udg_Harvest_Order = "harvest"
-
Events
-
T Cast
-
Events
- Unit - A unit Starts the effect of an ability
-
Conditions
- (Ability being cast) Equal to T_Ability
-
Actions
- Set T_Unit[1] = (Triggering unit)
- Set T_Owner = (Triggering player)
- Set TempLoc = (Position of T_Unit[1])
- Set TempLoc2 = (Target point of ability being cast)
- Set T_Real[1] = 0.00
- Set T_Real[2] = (Angle from TempLoc to TempLoc2)
- Set T_Level = (Level of T_Ability for T_Unit[1])
- Custom script: call RemoveLocation(udg_TempLoc2)
- Set TempLoc2 = (TempLoc offset by 50.00 towards T_Real[2] degrees)
- Custom script: set udg_T_Unit[2] = CreateUnitAtLoc(udg_T_Owner, udg_T_Dummy_Type, udg_TempLoc2, udg_T_Real[2])
- Special Effect - Create a special effect attached to the origin of T_Unit[2] using T_Model
- Animation - Change T_Unit[2]'s size to (T_Scale[T_Level]%, T_Scale[T_Level]%, T_Scale[T_Level]%) of its original size
- Custom script: set udg_T_Handle_Id = GetHandleId(udg_T_Unit[2])
- Hashtable - Save Handle OfT_Owner as (Key owner) of T_Handle_Id in T_Hashtable
- Hashtable - Save T_Real[1] as (Key distance) of T_Handle_Id in T_Hashtable
- Hashtable - Save T_Real[2] as (Key angle) of T_Handle_Id in T_Hashtable
- Hashtable - Save T_Level as (Key level) of T_Handle_Id in T_Hashtable
- Custom script: call RemoveLocation(udg_TempLoc)
- Custom script: call RemoveLocation(udg_TempLoc2)
- Unit Group - Add T_Unit[2] to T_Dummy_Group
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (T Loop <gen> is on) Equal to False
-
Then - Actions
- Trigger - Turn on T Loop <gen>
- Else - Actions
-
If - Conditions
-
Events
-
T Loop
- Events
- Conditions
-
Actions
-
Unit Group - Pick every unit in T_Dummy_Group and do (Actions)
-
Loop - Actions
- Set T_Unit[1] = (Picked unit)
- Custom script: set udg_T_Handle_Id = GetHandleId(udg_T_Unit[1])
- Set T_Owner = (Load (Key owner) of T_Handle_Id in T_Hashtable)
- Set T_Real[1] = (Load (Key distance) of T_Handle_Id from T_Hashtable)
- Set T_Level = (Load (Key level) of T_Handle_Id from T_Hashtable)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- T_Real[1] Less than T_Max_Distance[T_Level]
-
Then - Actions
- Set T_Real[2] = (Load (Key angle) of T_Handle_Id from T_Hashtable)
- Custom script: set udg_T_Real[3] = GetUnitX(udg_T_Unit[1])
- Custom script: set udg_T_Real[4] = GetUnitY(udg_T_Unit[1])
- Custom script: set udg_T_Real[5] = udg_T_Real[2] * bj_DEGTORAD
- Custom script: call SetUnitX(udg_T_Unit[1], udg_T_Real[3] + udg_T_Speed[udg_T_Level] * Cos(udg_T_Real[5]))
- Custom script: call SetUnitY(udg_T_Unit[1], udg_T_Real[4] + udg_T_Speed[udg_T_Level] * Sin(udg_T_Real[5]))
- Hashtable - Save (T_Real[1] + T_Speed[T_Level]) as (Key distance) of T_Handle_Id in T_Hashtable
- Set TempLoc = (Position of T_Unit[1])
- Custom script: set bj_wantDestroyGroup = true
-
Unit Group - Pick every unit in (Units within T_AoE[T_Level] of TempLoc) and do (Actions)
-
Loop - Actions
- Set T_Unit[2] = (Picked unit)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
And - All (Conditions) are true
-
Conditions
- (T_Unit[2] is dead) Equal to False
- (T_Unit[2] belongs to an ally of T_Owner) Equal to False
- (T_Unit[2] is A ground unit) Equal to True
- (T_Unit[2] is A flying unit) Equal to True
- (T_Unit[2] is Magic Immune) Equal to False
-
Conditions
-
And - All (Conditions) are true
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (T_Unit[2] is A structure) Equal to True
-
Then - Actions
- Unit - Cause T_Unit[1] to damage T_Unit[2], dealing T_Damage[T_Level] damage of attack type T_Attack_Type and damage type T_Damage_Type
-
Else - Actions
- Custom script: set udg_T_Handle_Id = GetHandleId(udg_T_Unit[2])
- Hashtable - Save Handle OfT_Unit[1] as (Key core) of T_Handle_Id in T_Hashtable
- Hashtable - Save Handle OfT_Owner as (Key owner) of T_Handle_Id in T_Hashtable
- Hashtable - Save T_Level as (Key level) of T_Handle_Id in T_Hashtable
- Unit Group - Add T_Unit[2] to T_Target_Group
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Else - Actions
-
If - Conditions
-
Loop - Actions
- Custom script: call RemoveLocation(udg_TempLoc)
-
Else - Actions
- Unit - Kill T_Unit[1]
-
If - Conditions
-
Loop - Actions
-
Unit Group - Pick every unit in T_Target_Group and do (Actions)
- Loop - Actions
-
Unit Group - Pick every unit in T_Dummy_Group and do (Actions)
Last edited: