Solu9
You can change this now in User CP.
- Reaction score
- 216
I have been hesitating with using hashtables in my triggers but I thought the time had come to do so now. I wanted to start with something simple and thus I created a target point spell with a unit missile.
Triggers:
Now everything works like I want it to except the direction of the missile. It always travels to the center of the map. I know it has something to do with a point not set properly and in this case it kinda must be the hashtable.
It's probably really simple but I can't see what I am doing wrong.
Triggers:
Trigger:
- Bone Spear Ini
- Events
- Map initialization
- Conditions
- Actions
- Hashtable - Create a hashtable
- Set Hash_BoneSpear = (Last created hashtable)
- Set Real_BoneSpear_Speed = 50.00
- Events
Trigger:
- Bone Spear Cast
- Events
- Unit - A unit Starts the effect of an ability
- Conditions
- (Ability being cast) Equal to Bone Spear (Necromancer)
- Actions
- Hashtable - Save Handle Of(Target point of ability being cast) as 0 of (Key (Triggering player)) in Hash_BoneSpear
- Set Point_BoneSpear_Create = (Position of (Triggering unit))
- Set Point_BoneSpear_StartFacePoint = (Target point of ability being cast)
- Unit - Create 1 Dummy Unit Bone Spear for (Owner of (Triggering unit)) at Point_BoneSpear_Create facing Point_BoneSpear_StartFacePoint
- Unit - Turn collision for (Last created unit) Off
- Unit - Pause (Last created unit)
- Unit Group - Add (Last created unit) to UnitGroup_BoneSpear
- Custom script: call RemoveLocation(udg_Point_BoneSpear_Create)
- Custom script: call RemoveLocation(udg_Point_BoneSpear_StartFacePoint)
- Events
Trigger:
- Bone Spear Travel Copy Copy
- Events
- Time - Every 0.05 seconds of game time
- Conditions
- Actions
- Unit Group - Pick every unit in UnitGroup_BoneSpear and do (Actions)
- Loop - Actions
- Set Point_BoneSpear_End = (Load 0 of (Key (Owner of (Picked unit))) in Hash_BoneSpear)
- Set Point_BoneSpear_Caster = (Position of (Picked unit))
- Set Real_BoneSpear_Travel = (Distance between Point_BoneSpear_Caster and Point_BoneSpear_End)
- Set Real_BoneSpear_Angle = (Angle from Point_BoneSpear_Caster to Point_BoneSpear_End)
- Custom script: call RemoveLocation(udg_Point_BoneSpear_Caster)
- Custom script: call RemoveLocation(udg_Point_BoneSpear_End)
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- Real_BoneSpear_Travel Greater than (Real_BoneSpear_Speed x 1.50)
- Then - Actions
- Set Point_BoneSpear_Caster = ((Position of (Picked unit)) offset by Real_BoneSpear_Speed towards Real_BoneSpear_Angle degrees)
- Unit - Move (Picked unit) instantly to Point_BoneSpear_Caster
- Custom script: call RemoveLocation(udg_Point_BoneSpear_Caster)
- Else - Actions
- Unit Group - Remove (Picked unit) from UnitGroup_BoneSpear
- Hashtable - Clear all child hashtables of child (Key (Target point of ability being cast)) in Hash_BoneSpear
- Unit - Remove (Picked unit) from the game
- If - Conditions
- Loop - Actions
- Unit Group - Pick every unit in UnitGroup_BoneSpear and do (Actions)
- Events
Now everything works like I want it to except the direction of the missile. It always travels to the center of the map. I know it has something to do with a point not set properly and in this case it kinda must be the hashtable.
It's probably really simple but I can't see what I am doing wrong.