feelingparty
New Member
- Reaction score
- 3
I have the following problem: A unit must be created upon casting an Ability facing the target point of the ability. However the unit is created facing ((the target point) -/+ 90) and is then turned towards the desired location witch looks ugly because I'm trying to create a "shoot arrow" ability and the "arrow" always spawns in a strange way.
The Question: Is there a way to set the unit's facing instantly?
P.S. I searched and found a thread with a similar question but none of the given solutions worked for me so I decided to create my own thread.
Here's the Trigger:
And the Second Trigger (which, I think, isn't that important)
PPS: I know there are major leaks. (I plan on clearing them later on)
The Question: Is there a way to set the unit's facing instantly?
P.S. I searched and found a thread with a similar question but none of the given solutions worked for me so I decided to create my own thread.
Here's the Trigger:
Trigger:
- Arrow Fire
- Events
- Unit - A unit Starts the effect of an ability
- Conditions
- Or - Any (Conditions) are true
- Conditions
- (Ability being cast) Equal to Unknown (A003)
- (Ability being cast) Equal to Unknown (A000)
- Conditions
- Or - Any (Conditions) are true
- Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (Ability being cast) Equal to Unknown (A000)
- Then - Actions
- Unit - Create 1 for (Triggering player) at ((Position of (Triggering unit)) offset by 100.00 towards (Angle from (Position of (Triggering unit)) to (Target point of ability being cast)) degrees) facing (Angle from (Position of (Triggering unit)) to (Target point of ability being cast)) degrees
- Else - Actions
- If - Conditions
- Hashtable - Save (Angle from (Position of (Triggering unit)) to (Target point of ability being cast)) as 4 of (Key (Last created unit)) in hasharrows
- Hashtable - Save ATRIBspeed[(Player number of (Triggering player))] as 3 of (Key (Last created unit)) in hasharrows
- Hashtable - Save ATRIBdistance[(Player number of (Triggering player))] as 2 of (Key (Last created unit)) in hasharrows
- Hashtable - Save (ATRIBattack[(Player number of (Triggering player))] x ATRIBattMultip[(Player number of (Triggering player))]) as 5 of (Key (Last created unit)) in hasharrows
- Unit Group - Add (Last created unit) to Arrows
- Sound - Play gg_snd_ArrowAttack1 at 100.00% volume, attached to (Triggering unit)
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Events
And the Second Trigger (which, I think, isn't that important)
Trigger:
- Move Proj
- Events
- Time - Every 0.02 seconds of game time
- Conditions
- Actions
- Unit Group - Pick every unit in Arrows and do (Actions)
- Loop - Actions
- Unit Group - Pick every unit in (Units within 70.00 of (Position of (Picked unit))) and do (Actions)
- Loop - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (Unit-type of (Picked unit)) Not equal to FieldDummy
- (Unit-type of (Picked unit)) Not equal to FlamingArrow
- ((Picked unit) is dead) Equal to False
- Then - Actions
- Set unit = (Picked unit)
- Else - Actions
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Loop - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (Load 2 of (Key (Picked unit)) from hasharrows) Greater than or equal to 0.00
- ((Picked unit) is alive) Equal to True
- unit Equal to No unit
- Then - Actions
- Unit - Move (Picked unit) instantly to ((Position of (Picked unit)) offset by (Load 3 of (Key (Picked unit)) from hasharrows) towards (Load 4 of (Key (Picked unit)) from hasharrows) degrees)
- Hashtable - Save ((Load 2 of (Key (Picked unit)) from hasharrows) - (Load 3 of (Key (Picked unit)) from hasharrows)) as 2 of (Key (Picked unit)) in hasharrows
- Else - Actions
- Unit - Cause (Picked unit) to damage unit, dealing (Load 5 of (Key (Picked unit)) from hasharrows) damage of attack type Spells and damage type Normal
- Unit - Remove (Picked unit) from the game
- If - Conditions
- Set unit = No unit
- Unit Group - Pick every unit in (Units within 70.00 of (Position of (Picked unit))) and do (Actions)
- Loop - Actions
- Unit Group - Pick every unit in Arrows and do (Actions)
- Events
PPS: I know there are major leaks. (I plan on clearing them later on)