• 🏆 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!

[Trigger] Make unit face unit/point/angle instantly...

Status
Not open for further replies.
Level 25
Joined
Jun 5, 2008
Messages
2,572
Well i have a problem...
You see in my spells Tempest Dance and Ruinous Onslaught the caster moves fast towards the defined targets, now the problem is when i try to make them face the target, i tried the following:
  • Unit - Make unit face target
  • Unit - Make unit face position of target
  • Unit - Make unit face (angle between position of unit to position of target)
All over 0.00 seconds and even tried 0.01 seconds but it doesn't work.
And yes i tried moving the unit instantly and facing the target/position of target/(angle between position of unit to position of target).
So any ideas?
The user who helps me will get +rep .
 
Level 3
Joined
Aug 19, 2007
Messages
24
Tried this?
  • Unit - Move (Triggering unit) instantly to (Center of (Playable map area)), facing Default building facing (270.0) degrees
Move the unit to where its standing though.

This will issue a stop order since you are using SetUnitPosition.

I don't think that there is a decent way to change a unit's facing instantly without doing that, though. You can use a very small time interval with SetUnitFacingTimed, but that is still not instantaneous (it has a maximum rotation speed)
 
Level 6
Joined
Sep 5, 2007
Messages
264
You could remove and recreate the unit facing in a direction.

There would unforeseen consequences...
EI: Enemy units currently attacking the "turning unit" would temporarily stop, for a moment while they rethink their options. Any units following the "turning unit", would stop following immediately (the unit they were following no longer exists). You'd have to re-assign all the variables associated with the unit, if you use LocalHandleVars, then you're screwed, if a timer is going for the unit at the same time. You have to set the unit's health / mana / items / abilities = lots of stuffing around (easy to do, but still, stuffing around). And other possibilities, that I obviously can't foresee.

You could do:
JASS:
call SetUnitTurnSpeed(unit, 999)
call SetUnitFacingTimed(unit, direction, 0.001)
call SetUnitTurnSpeed(unit, GetUnitDefaultTurnSpeed(unit))

Or possibly the way that Bobo_The_Kodo described: Create a dummy, and use SetUnitLookAt() to make your turn.

Hope that this is useful. :thumbs_up:
 
Level 25
Joined
Jun 5, 2008
Messages
2,572
Okay i already said i tried moving the unit, and yes the unit is stored into a variable, i change it's facing every 0.02 seconds and it ain't efficent enough...
Please tell me there are way's to do that without dummy units....
@Lord_Bones
I will try what you said though...
 
Level 12
Joined
Aug 22, 2008
Messages
911
Hmm. The only type of unit that can't turn even with triggers (although I'm not sure about that) is buidings. Am I right? So technically if you remove the building classifation it should work correctly.
Just in case your unit was a building.
 
Hmm. The only type of unit that can't turn even with triggers (although I'm not sure about that) is buidings. Am I right? So technically if you remove the building classifation it should work correctly.
Just in case your unit was a building.

He doesn't mean he can't get it to turn. He just can't get it to turn instantly.
 
Level 21
Joined
Aug 9, 2006
Messages
2,384
Level 9
Joined
Apr 5, 2008
Messages
529
Well, you're wrong on this one, I bet you updated the facing several times/second.

Back ontopic, I've actually been wondering how to make an unit face an angle instantly lately, perhaps I'll look into it and post my results.

Kingz, your sample doesn't work. Maybe there're some gameplay constants for max turn rate, maybe it's hardcoded into Warcraft.
 
Level 6
Joined
Sep 5, 2007
Messages
264
SetUnitFacing() doesn't set unit facing instantly.

@Redscores: Your system does appear to turn instantly... but, it really doesn't. It's just close enough to fool the eyes. We are after an "instant" turn.

@RolePlaynGamer: There isn't a gameplay constant that caps the turn rate :( I thought that there was, but I can't find it.

Has anyone tried SetUnitFacingTimed() with a negative duration? It's just a thought that I had.
 
Level 3
Joined
Aug 19, 2007
Messages
24
Negative duration has the same effect as a duration of 0, 0.01, or anything else so small that it hits the turn speed cap.

The only way I know to do it involves using SetUnitLookAt and moving whatever unit that it's facing using SetUnitX/Y. That doesn't change the actual facing, just what it appears to be looking at...
 
Level 4
Joined
May 17, 2008
Messages
75
The turn speed limit seems related to the unit's "Art - Orientation interpolation" value. Most units have a value of 0, which is the fastest, and setting it higher forces a slower turn speed.

Unfortunately setting it to a negative value doesn't help, as it appears to default back to 0. The same thing happens with values over 8.

I'm guessing this is the system that forces the turn speed limit, and Blizzard didn't seem to leave any way to bypass it.
 
Status
Not open for further replies.
Top