• Check out the results of the Techtree Contest #19!
  • Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

Can't rotate buildings without replacing them

Status
Not open for further replies.
Level 15
Joined
Nov 30, 2007
Messages
1,202
Method 1 works, but method 2 for some reason doesn't, you can't rotate buildings or whats up?


JASS:
function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
    local unit u = gg_unit_hhou_0006
    local real x = GetUnitX(u)
    local real y = GetUnitY(u)
  
    call BJDebugMsg("Rotate")
  
    // Method 1
    //call RemoveUnit(u)
    //set u = CreateUnit(Player(0), 'hhou', x, y, 0)
  
    // Method 2
    call SetUnitPosition(u, x, y)
    call SetUnitFacing(u, 0)
endfunction

//===========================================================================
function InitTrig_Untitled_Trigger_001 takes nothing returns nothing
    set gg_trg_Untitled_Trigger_001 = CreateTrigger(  )
    call TriggerRegisterTimerEventSingle( gg_trg_Untitled_Trigger_001, 5 )
    call TriggerAddAction( gg_trg_Untitled_Trigger_001, function Trig_Untitled_Trigger_001_Actions )
endfunction
 
I'm pretty sure that SetUnitFacing doesn't actually force the unit to face a certain direction, it just orders the unit to face that direction. You can test this by calling it on an ordinary unit. It won't turn instantly, it will turn there over time. This is independent of the unit's turn speed. However, since a building cannot turn by itself, it just doesn't work.

I haven't really read this, but https://www.hiveworkshop.com/threads/tower-turning-tutorial.33448. There are certain buildings that CAN turn, the night elf ancients. So maybe you can add root to your building, and it will turn.
 
Thank you. It solves one problem but creates another in my case. The building has a invisible platform placed under it when it's created. This doesn't effect the building normally but with this rotation trick the building flies over the ground.

I'll just stick with the replacing option.

JASS:
    local unit u = gg_unit_hhou_0006
    local real x = GetUnitX(u)
    local real y = GetUnitY(u)
    local destructable d
    call RemoveUnit(u)
    set u = CreateUnit(Player(0), 'hhou', x, y, 0.)
    set d = CreateDestructable('B003', x, y, 0, 1., 0)
 
Last edited:
Status
Not open for further replies.
Back
Top