• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Creating a unit facing the same angle as another unit

Status
Not open for further replies.
Level 2
Joined
Feb 17, 2008
Messages
10
Basically, I am trying to do what the title says, but it is not working.

I have a trigger whose goal is to create a unit that is facing the same direction as an already existing unit. I have tried variables and etc, I even defined an angle for them to face (90 degrees) but every time they always face to the right (zero degrees)

Is there something that I have to preset or define before they will obey?

Any ideas are appreciated
 
Level 3
Joined
Feb 23, 2010
Messages
73
  • Actions
    • Unit - Create 1 (Unit-Type) for (Player) at (SpawnLocation) Facing (Facing of (OriginalUnit))
that action is found under units / create units facing angle.

easy-peasy
 
Level 2
Joined
Feb 17, 2008
Messages
10
  • Actions
    • Unit - Create 1 (Unit-Type) for (Player) at (SpawnLocation) Facing (Facing of (OriginalUnit))
that action is found under units / create units facing angle.

easy-peasy

Thats exactly what I'm doing, but they do not listen. I know where the triggers are, but the units themselves are not obeying. They wont even listen if I do something like

Unit - Create 1 (Unit-Type) for (Player) at (SpawnLocation) Facing 90.00 degrees

I have no idea what is wrong. And this is help with world editor is it not?

Thanks for the suggestion though

EDIT: They are always facing 0 degrees no matter what
 
Last edited:
Level 2
Joined
Feb 17, 2008
Messages
10
post your map

Im not too comfortable with posting the map since it is almost finished and I just encountered this error now, although I will post the trigger



It is producing an effect similar to the Hellfire Torch in Diablo II, the dragonhawk riders are simply dummy units that cause damage to surrounding ones via immolation

Im just confused as to why even when I specify an angle measure in the trigger, the units still dont respond in game
 
Level 8
Joined
Apr 30, 2009
Messages
338
he just has to delete the wait 0.01 line

The reason is the wait system sucks in WC3, and any wait time below 0.26 seconds automatically is executed as a 0.26 second wait in-game. Your 0.01 wait is actually 0.26. During this time, any event on the map where a unit is attacked will change your "Attacking Unit" for the rest of the trigger. Effectively a 0.0...01 wait is executed between every line of a trigger automatically, so you don't need to add it.
 
Level 8
Joined
Apr 30, 2009
Messages
338
ok try this, make a new variable temp_real

add this line before all actions in your trigger:

set temp_real = facing angle of attacking unit

then use "temp real" instead of calling the facing function when you create the dummy units.

Also if this trigger is executing multiple times, that 3 second wait is gonna fuck you up too. If you have another trigger related to this one that runs during the 3 second wait, then post it too and we can try to help you not use the 3-second wait.
 
Level 2
Joined
Feb 17, 2008
Messages
10
I did already try that

I do have another trigger that THIS one effects and if this trigger is called again then they cancel out and it just runs this one again. The 3 second wait is not the problem, I've seen it run fine.

The problem is that no matter what I do, whenever I use the "Create unit facing angle" action, the unit is ALWAYS facing 0 degrees, even if a preset angle is specified.

I'm honestly considering storing all my maps and reinstalling Warcraft III because I think my world editor is just boned
 
Level 3
Joined
Feb 23, 2010
Messages
73
ok i just tested an identical trigger on a dummy map, and it worked fine. so you need to send me the map if you want to fix it, or atleast want me to help. the trigger is not the problem. although you dhousl fix the memory leaks in it, they will lag up your game fast.
 
Level 8
Joined
Apr 30, 2009
Messages
338
Ok I just realized something about "unit is attacked" registers when a unit's attack animation begins, meaning it isn't always facing it's target. People can abuse this in DotA to deal backstab damage from the front with stealth assassin!

So do this instead, to make sure the angle is between the 2 units:

  • Torch 1
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Attacking unit) has an item of type Claws of Attack +15) Equal to True
      • ((Triggering unit) belongs to an ally of (Owner of (Attacking unit))) Equal to False
    • Actions
      • Set temp_unit = (Attacking unit)
      • Set temp_point = (Position of (Attacking unit))
      • Set temp_point2 = (Position of (Triggering unit))
      • Set temp_real = (Angle from temp_point to temp_point2)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 100) Less than or equal to 25
        • Then - Actions
          • For each (Integer A) from 1 to 5, do (Actions)
            • Loop - Actions
              • Unit - Create 1 Dragonhawk Rider for (Owner of temp_unit) at temp_point facing temp_real degrees
              • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
              • Unit Group - Add (Last created unit) to temp_group
          • Custom script: call RemoveLocation(udg_temp_point)
          • Custom script: call RemoveLocation(udg_temp_point2)
          • Trigger - Turn off (This trigger)
          • Wait 3.00 seconds
          • Unit Group - Remove all units of temp_group from temp_group
          • Trigger - Turn on (This trigger)
          • Set temp_unit = No unit
        • Else - Actions
 
Level 2
Joined
Feb 17, 2008
Messages
10
I created a point with a variable and just used a different action that made them face the point, and that seems to have solved the problem

Weird stuff, thanks for the help though +rep
 
Status
Not open for further replies.
Top