- Joined
- Jan 5, 2008
- Messages
- 145
My idea is once a unit is attacked from a certain angle another unit will leap towards him and kill him. I did all the math on paper and It all makes sense to me so I assumed I'm doing something wrong with how I have everything set up. Once the unit attacks and the trigger fires I want him to move really fast towards the attacked unit and rise in height once it gets directly on top of the unit it's height will drop to 0 and the attacked unit will die instantly with some blood effects. Right now the attacking unit just teleports around randomly and it looks really wonky.
Attached is what the math as I see it in my head.
Am I doing something wrong? I don't think the math is wrong but I also may have the offset wrong. Also how much more complicated would it be to make the height into an arc? I know you would need an 2d dimension expression with the roots being The point of the Attacked unit and Attacking unit but I would need some advice setting that up.
Attached is what the math as I see it in my head.
Am I doing something wrong? I don't think the math is wrong but I also may have the offset wrong. Also how much more complicated would it be to make the height into an arc? I know you would need an 2d dimension expression with the roots being The point of the Attacked unit and Attacking unit but I would need some advice setting that up.
-
Instant Death
-
Events
- Unit - A unit Is attacked
-
Conditions
- (Unit-type of (Attacking unit)) Equal to Timber Wolf
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- ((Facing of (Attacking unit)) Less than or equal to ((Facing of (Attacked unit)) + 10.00)) and ((Facing of (Attacking unit)) Greater than or equal to ((Facing of (Attacked unit)) - 10.00))
-
Then - Actions
- Set TempInt2 = (Integer((Distance between (Position of (Attacked unit)) and (Position of (Attacking unit)))))
-
For each (Integer A) from 1 to 10, do (Actions)
-
Loop - Actions
- Set TempInt = (Integer A)
- Set TempPoint = (Position of (Attacked unit))
- Set TempPoint2 = (TempPoint offset by ((Real(TempInt2)) - (Real(TempInt))) towards (Degrees((Facing of (Attacked unit)))) degrees)
- Animation - Change (Attacking unit) flying height to ((Current flying height of (Attacking unit)) + (Real(TempInt))) at 0.02
- Sound - Play Wolf1 <gen> at 100.00% volume, located at TempPoint with Z offset 0.00
- Unit - Move (Attacking unit) instantly to TempPoint2
- Wait 0.04 seconds
-
Loop - Actions
- Wait 0.04 seconds
- Unit - Kill (Attacked unit)
- Unit - Move (Attacking unit) instantly to TempPoint
- Animation - Change (Attacking unit) flying height to 0.00 at 0.00
- Special Effect - Create a special effect at (Position of (Attacked unit)) using Objects\Spawnmodels\Human\HumanBlood\HumanBloodKnight.mdl
- Animation - Play (Attacking unit)'s spell slam animation
- Special Effect - Destroy (Last created special effect)
- Custom script: call RemoveLocation(udg_TempPoint)
- Custom script: call RemoveLocation(udg_TempPoint2)
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Events
Attachments
Last edited by a moderator: