• 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.

set Building Facing in game

Status
Not open for further replies.
Level 14
Joined
Jul 26, 2008
Messages
1,009
Alright I have a system that sets the facing of a unit in game. Unfortunately it's not very accurate (I don't think...)

You have to type in face ### twice to get it to work on buildings. Is there a better/easier way to set the facing of a building in game? (It works just fine on regular units)

JASS:
function UnitFacingEnumUnitSelected takes nothing returns nothing
    if IsUnitSelected(GetEnumUnit(), udg_TEMP_Player) then
        if IsUnitType(GetEnumUnit(), UNIT_TYPE_STRUCTURE) then
            call UnitRemoveType(GetEnumUnit(), UNIT_TYPE_STRUCTURE)
            call SetUnitPosition(GetEnumUnit(), GetUnitX(GetEnumUnit()), GetUnitY(GetEnumUnit()))
            call SetUnitFacing(GetEnumUnit(), udg_TEMP_Real)
            call UnitAddType(GetEnumUnit(), UNIT_TYPE_STRUCTURE)
        else
            call SetUnitFacing( GetEnumUnit(), udg_TEMP_Real)
        endif
    endif
endfunction
 
Last edited:
Level 6
Joined
Dec 9, 2007
Messages
208
Pretty sure the standard building facing can be done in Game constants. Keep in mind, that this will occur to all your buildings.
I'll just go check it

Edit: Checked and confirmed. You can change the way buildings are facing in Advance > Gameplay Constants :)

Good luck
-Sinizi
 
Level 14
Joined
Jul 26, 2008
Messages
1,009
Can't, there's a bonus mod system in the game. Would destroy that.

Anyways, it works, the buildings will rotate in game. I'm pretty sure it's accurate, it's just hard to predict the angle you'll be getting because the buildings start out at odd angles. (And doing it this way makes the building immediately face the angle) I thought I saw a functional version in SotDRP. Anyways, I'm thinking that I might be able to do it with a timer, but we'll see. (Problem might be immediately changing back to structure type.)

Biggest problem with it is you have to type it twice. So yeah, it works, it just doesn't work perfectly.

Also while changing it in constants would obviously work, it doesn't do it in game, which is what I specifically in the title asked for right there.
 
Status
Not open for further replies.
Top