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

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
 
Level 4
Joined
Sep 13, 2014
Messages
106
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 http://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.
 
Level 15
Joined
Nov 30, 2007
Messages
1,202
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.
Top