Unit Facing

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:
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)
    • 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
      • 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)


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 (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
          • Set unit = No unit


PPS: I know there are major leaks. (I plan on clearing them later on)
 

Hero

─║╣ero─
Reaction score
250
JASS:
call SetUnitFacingTimed( YOURUNITHERE, 0.01 )


Try that. It should be fast enough. Though I'm very rusty in editting warcraft 3. :p

Put that right before the unit's facing angle is changed.
 

hgkjfhfdsj

Active Member
Reaction score
55


>Is there a way to set the unit's facing instantly?
afaik there is no reliable way to set it instantly. one way is to the setunitlookat() which is faster than setunitfacing but requires modification of a bone in the model. your best bet would be on using createunit's default angle, and then make it look like it turned instantly.
 

Hero

─║╣ero─
Reaction score
250


>Is there a way to set the unit's facing instantly?
afaik there is no reliable way to set it instantly. one way is to the setunitlookat() which is faster than setunitfacing but requires modification of a bone in the model. your best bet would be on using createunit's default angle, and then make it look like it turned instantly.

A way I used to over come this would be to use Vexorians's dummy model and attach a special effect to it.
 

feelingparty

New Member
Reaction score
3
Yet another fail:
Now it says: Invalid number of arguments and point at the "else" line.
Here's how it looks like. If anyone has the patience to read it all through I'd be very glad.

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 Shoot Flaming Arrow
          • (Ability being cast) Equal to Fletch Arrow
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Ability being cast) Equal to Fletch Arrow
        • Then - Actions
          • Unit - Create 1 FieldDummy 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
          • Custom script: call SetUnitFacingTimed( bj_lastCreatedUnit, 0.01 )
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Ability being cast) Equal to Shoot Flaming Arrow
        • Then - Actions
          • Unit - Create 1 FlamingArrow 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
          • Special Effect - Create a special effect attached to the overhead of (Last created unit) using Abilities\Spells\Other\BreathOfFire\BreathOfFireDamage.mdl
          • Custom script: call SetUnitFacingTimed( bj_lastCreatedUnit, 0.01 )
        • Else - Actions
          • Do nothing
      • 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 ArrowAttack1 <gen> at 100.00% volume, attached to (Triggering unit)

A way I used to over come this would be to use Vexorians's dummy model and attach a special effect to it.
Can you explain please? Where can I find this unit?
 

Jedi

New Member
Reaction score
63
GUI has that action too, and it is NOT instant.
Trigger:
  • Unit - Make unit facing angle / point / unit
 

Hero

─║╣ero─
Reaction score
250
GUI has that action too, and it is NOT instant.
Trigger:
  • Unit - Make unit facing angle / point / unit

Nothing will ever really be instant. Im hoping it will be faster than the human eye however.

Can you explain please? Where can I find this unit?

It is included in Vexorian's Caster System. (or atleast that was what it was called when I made WC3 maps back in the day). Search WC3Campaigns
 

Tyman2007

Ya Rly >.
Reaction score
74
Trigger:
  • Do nothing

Hey get rid of that action!

:p Why would you want an action that literally does nothing inside your trigger? :p
 

Gummi_Bears

New Member
Reaction score
5
Have you tried:
Trigger:
  • Unit - Create 1 FieldDummy 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 (Target point of ability being cast)) degrees


Similiar to your trigger, cept no angle between two points. Should be same thing.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top