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

Constant Rotation

Status
Not open for further replies.
So I have this building that can rotate and stuff but what I need is for it to constantly keep spining (slowly, like, if you play sc2, the Shrike Turret on the bunker), and logically, it should be feasible with triggers. But whatever I try, the thing just stands still. When I right-click, it gladly faces the point I click, but it doesn't respond to triggers.

Anyone has a solution?
 
Level 12
Joined
Apr 16, 2010
Messages
584
You used this trigger:
  • Unit - Make "Unit" face Default building facing (270.0) over 0.00 seconds
If so then the problem must be in Object Editor, with current unit/building
If you don't know how to make it rotate with triggers I'll post trigger here.
Edit: here you go a trigger that rotates a Unit to some angle, it will rotate if unit is not moving.
  • Trigger
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Set Real = (Real + 1.00)
      • Unit - Make Unit face Real over 0.00 seconds
 
Level 13
Joined
May 11, 2008
Messages
1,198
i think the building might need 1 movement speed if you want it rotated manually. otherwise, i don't see how you can't rotate it by adjusting the facingreal of the unit.

save the facing real of the building and add one to it then set that as the new facing real. same way you would rotate a unit, right? units with zero movement speed also cannot rotate manually, btw. you can't even trigger a unit to have zero movement speed, the minimum will be 1, or some higher number in your gameplay constants.

  • Untitled Trigger 010
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Set realfacing = (realfacing + 1.00)
      • Unit - Make Well of Life 0055 <gen> face realfacing over 0.10 seconds
it would seem this would require the unit can be rotated manually. you have to set the building's max min and base movementspeed all to 1. then it can rotate as you please via the above trigger.

i'm curious to know if there's another function which would rotate a building(maybe there isn't). but anyway a building can't really move anywhere without movement speed greater than one, so it's a solution that fits.

just keep in mind if you really wanted a building rotating like the turret, that building was a model that had rotation for part of it, not the entire building was rotating, just about half of it was. so you might want to speak to a modeling animator about that.(i don't know shrike turret sc2 but i remember missile turret sc1, assuming rotation mechanic is same)

now this next bit actually works even if the building doesn't have movement speed, but it leaks like crazy and i don't remember exactly how that would work for cleaning a point in gui.
  • Untitled Trigger 010
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Set realfacing = ((Facing of Well of Life 0055 <gen>) + 1.00)
      • Set pointbuilding = (Position of Well of Life 0055 <gen>)
      • Unit - Move Well of Life 0055 <gen> instantly to pointbuilding, facing realfacing degrees
it seems there is a difference in the functions
one does use
SetUnitFacingTimed
and the other uses
SetUnitFacing
one can theorize that the first one needs a movement speed to work with, but the second one does not. but this is incorrect.
it's a funny thing, but it seems if a unit is incapable of minimal movement, it cannot rotate. because apparently you can rotate it if you move it to nowhere but where it already is first, and then rotate it. doesn't really make sense to me, but there you have it.
as far as i know you'll need to either make a bunch of point variables and clean the leaks from them, or just simply make all the buildings move at 1ms.
 
Last edited:
When I right-click, it gladly faces the point I click, but it doesn't respond to triggers.

My building CAN rotate. It's just not responding to triggers. I managed to get one rotating, but it was a pre-placed unit and everything was specific. When I need is something which works for any such buildings that finish construction. Tried using Hashtables, but that's been malfunctioning of late. Dunno why.
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Since you say you can rotate the building by making it right-click a certain point.
Why not let the trigger order the building to right-click a specific point for you?

  • Actions
    • Set Angle = (Angle + 5.00)
    • Set Loc1 = (Position of Unit)
    • Set Loc2 = (Loc1 offset by 100.00 towards Angle degrees)
    • Unit - Order Unit to Move To Loc2
    • Custom script: call RemoveLocation(udg_Loc1)
    • Custom script: call RemoveLocation(udg_Loc2)
 
I tried that. Sadly, it doesn't work :(
It would also mean that the building is constantly being given the order to face said point and would stop to face that point the moment it has something to train/research/etc.

Also, wouldn't using a global variable for the angle make every single one of those buildings face the same direction at all times? If you have a hashtable solution for me, I'm all ears, lol :D
 
Level 13
Joined
May 11, 2008
Messages
1,198
I tried that. Sadly, it doesn't work :(
It would also mean that the building is constantly being given the order to face said point and would stop to face that point the moment it has something to train/research/etc.

Also, wouldn't using a global variable for the angle make every single one of those buildings face the same direction at all times? If you have a hashtable solution for me, I'm all ears, lol :D

if you're worried about a global real and using this on lots of buildings then just use a real array. each time a building is built, you can make the facing of that building be a new real variable in the array. this is what arrays are for.
 
Status
Not open for further replies.
Top