| 10-03-2004, 03:11 PM | #1 |
Im working on a spell that will stuns and damages all units facing the point you cast the ability. So i based the spell of Cluster rockets (to have a splash effect and a projectile with arc), and then made a trigger to check where the units was facing. The trigger uses Lord Vexorians caster system, so the "customtext" part orders a hidden caster to cast stormbolt on (picked unit). The 2 variables (Unitvar1 and Unitvar) are just used in the caster system; ignore them. Code:
Flashbang
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Flashbang
Actions
Set UnitVar = Invisible Dummy 0175 <gen>
Unit Group - Pick every unit in (Units within 400.00 of (Target point of ability being cast) matching ((((Matching unit) is Mechanical) Equal to False) and (((Facing of (Matching unit)) Greater than or equal to ((Angle from (Position of (Matching unit)) to (Target point of ability being cas and do (Actions)
Loop - Actions
Set UnitVar2 = (Picked unit)
Custom script: call CasterCastAbility( GetOwningPlayer(udg_UnitVar), 'A01K', "thunderbolt", udg_UnitVar2, true)So what happens is that it stuns some units but not all. So far i have seen no logic at all in what units get stunned; however those i have seen stunned has been facing the target point. But still only 1 or 2 units get stunned, and some units facing directly on the target does not get stunned. Question is: Why does not all facing the flashbang get stunned? Whats wrong? |
| 10-03-2004, 08:00 PM | #2 |
Might it be because you are using "Greater than or Equal to" instead of just "Equal to"? Im just kinda shooting in the dark here. |
| 10-03-2004, 09:00 PM | #3 |
Oh well you guessed totally wrong then xD What the trigger does is first checking if the units facing is greater than the angle between the unit and the target - 90 (meaning: if the unit is not facing more than 90degrees to the left of the target) and then the same but with +90 (if the unit is not facing less than 90degrees to the right of the target) and if both conditions are true it should be stunned. So if the unit is watching the target (with a 180degree vision) it should be stunned. |
| 10-03-2004, 09:00 PM | #4 |
You say that the facing angle must be greater than the angle between two points. In reality, it would have to be greater than the facing angle between the points minus a certain margin and at the same time smaller than the same angle plus the same margin. The margin determines how off can the facing of the unit be for it to work. Additional conditions may be required at edge situations, where the angles are close to -180/+180, and are therefore according to the upper equations far far apart, but in reality they are very close. |
| 10-03-2004, 09:21 PM | #5 | |
Quote:
|
| 10-03-2004, 10:31 PM | #6 |
Right now your trigger just checks if the angle is greater than the angle between the two. It doesn't check any ranges. That might be your problem. So right now, it will take if the facing of the targeted unit is anywhere from the angle the unit is facing around counterclockwise, to 0 degrees, or east. |
| 10-05-2004, 08:09 PM | #7 |
Omg sorry thats the wrong trigger heh... Anitarf just said the trigger i had; the check had a minus and plus on both sides when comparing so it should check the angle. Ill post it as soon as i have time, cant right now. That comes from a disabled old version from the trigger i had; in the new one it uses Anitarf's "system" and use those as conditions instead of addons to he "pick every unit matching conditions" conditions. |
| 10-05-2004, 08:27 PM | #8 |
Just hoping I can help you more, here's a c&p of a part of a backstab trigger from my arena; it uses an integer (could be a real, but I had an integer variable already made) to store the angle between two points (in my case it is the positions of two units, in your case it is the position of checking unit and the target point of the spell), and then compares that angle with the facing angle of the unit that is being attacked. In my case, if the attacking unit is within a 90 degree arc behind the attacked unit (+/- 45), the backstab occurs. I have done substantial testing in varied conditions/angles of attack and it worked correctly. Code:
Set TempPoint1 = (Position of (Attacking unit))
Set TempPoint2 = (Position of (Attacked unit))
Set TempInteger = (Integer((Angle from TempPoint1 to TempPoint2)))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Or - Any (Conditions) are true
Conditions
And - All (Conditions) are true
Conditions
((Facing of (Attacked unit)) - (Real(TempInteger))) Greater than or equal to -45.00
((Facing of (Attacked unit)) - (Real(TempInteger))) Less than or equal to 45.00
((Facing of (Attacked unit)) - (Real(TempInteger))) Less than or equal to -315.00
((Facing of (Attacked unit)) - (Real(TempInteger))) Greater than or equal to 315.00
Then - Actions
Unit - Create 1 Dummy (Backstab) for (Owner of (Attacking unit)) at TempPoint1 facing (Real(TempInteger)) degrees
Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
Unit - Order (Last created unit) to Attack Once (Attacked unit)
Unit - Remove Shadowstalk buff from (attacking unit)
Game - Display to (All players) the text: BACKSTAAAB!!!
Else - Actions
Game - Display to (All players) the text: Your quest FAILD!
Custom script: call RemoveLocation( udg_TempPoint1 )
Custom script: call RemoveLocation( udg_TempPoint2 )oh, and one more thing, the two point variables should be destroyed before you use them again to avoid memory leaks. The variable that stores target point of your flashbanger can be destroyed at the end of trigger, the variable that stores the position of the unit must be destroyed in the loop that goes through all units in range, before it is set to the position of the next unit. |
| 10-06-2004, 02:38 PM | #9 |
Thanks alot, i will create a new trigger based on yours and hopefully that will work :) Thanks for taking the time! |
