1. Choose the best Old Gods themed skin at the Texturing Contest #29 - Poll!
    Dismiss Notice
  2. Melee Mapping Contest #2 - Poll is up! Vote for the best competitive 1v1 map!
    Dismiss Notice
  3. Please help test custom maps and more on the latest PTR!
    Dismiss Notice
  4. Evolution complete! Make Darwin proud and go vote in the Techtree Contest #12 - Poll.
    Dismiss Notice
  5. Icon Contest #17 - Results are out! Step by to congratulate our winners!
    Dismiss Notice
  6. We've created the Staff Job Openings thread. We're currently in need of icon, video production, and social/multimedia positions to be filled. Thank you!
    Dismiss Notice

How To Rotate Buildable Structure With Trigger?

Discussion in 'World Editor Help Zone' started by warcraftmodding123, Aug 13, 2018.

  1. warcraftmodding123

    warcraftmodding123

    Joined:
    Feb 20, 2016
    Messages:
    224
    Resources:
    0
    Resources:
    0
    How do I make a buildable structure be built in a certain angle using a trigger?
     
  2. Dat-C3

    Dat-C3

    Joined:
    Mar 15, 2012
    Messages:
    2,431
    Resources:
    10
    Models:
    1
    Maps:
    5
    Spells:
    3
    Tutorials:
    1
    Resources:
    10
    Either "Unit - Move (Triggering unit) instantly to (Center of (Playable map area)), facing Default building facing degrees" or "Unit - Move (Triggering unit) instantly to (Center of (Playable map area)), facing (Position of (Triggering unit))" can be used for this and also they allow for instant turning for anything without 'Amov' aka the movement ability.

    Unsure if these work but you could try
    "Actions
    Unit - Make No unit face No unit over 0.00 seconds
    Unit - Make No unit face (Center of (Playable map area)) over 0.00 seconds
    Unit - Make No unit face Default building facing over 0.00 seconds"
    as well.
     
  3. Pyrogasm

    Pyrogasm

    Joined:
    Feb 27, 2007
    Messages:
    1,567
    Resources:
    0
    Resources:
    0
    If you need it to change for all buildings for the whole map you can edit Gameplay Constants. My best guess is the second value is for NE Ancient-based buildings that can uproot and move, but I'm unsure. If I'm correct then you could potentially have 2 different default facings based on what race they are.
    • Building Facing Angle (degrees)
    • Building Facing Angle, Rooted (degrees)
    @Dat-C3 that does not work for buildings without a movement type and base speed > 0; if you test you'll find they don't turn to face when ordered or when moved + facing via triggers. To get the facing action to work we build on this old thread with no replies:
    1. In the OE, set the building's movement type to "foot" or anything other than none
    2. In the OE, set the building's speed base to 1 (you do not have to change the other move speed values, they can stay at 0)
    3. Remove the 'Amov' (move) ability from the buildings with triggers whenever they are created (this can only be done with JASS or custom scripts, Move doesn't show up in the GUI ability list)
    4. Order them to face any point or unit at will, they will do it instantly as Dat-C3 described
    Trigger to do this:
    • Catch
      • Events
        • Unit - A unit enters (Playable map area)
      • Conditions
        • Unit-type of (triggering unit) equal to YOUR_BUILDING
      • Actions
        • Custom script: call UnitRemoveAbility(GetTriggerUnit(), 'Amov')
        • Unit - Make (Triggering Unit) face WHATEVER_FACING over 0.00 seconds


    OE screenshot:
    move.png
     
  4. warcraftmodding123

    warcraftmodding123

    Joined:
    Feb 20, 2016
    Messages:
    224
    Resources:
    0
    Resources:
    0
    Trigger worked but when going to build the structure it shows in the default angle, when I start building the structure will turn around to the angle given in the trigger. It looks a bit odd and inconsistent with the same type of structure from other faction. Maybe I should have them be separate models. I tried editing with 3DS MAX (and mdx importer exporter plugin), rotated it but it didnt change the rotation in game and doesnt load the textures.
     
  5. Pyrogasm

    Pyrogasm

    Joined:
    Feb 27, 2007
    Messages:
    1,567
    Resources:
    0
    Resources:
    0
    Just did more testing and the two values of default building orientation are indeed applied based on whether the building has the ancient classification or not. So change the appropriate constant, make all your rotated towers ancients, and make all of your regular towers not ancients. See below for other imperfect solutions.

    If you want to edit the models, this is probably a good method to look into.

    The UI will always show the building orientation at Default Building Facing when you're choosing where to place the building. There's no way around that except changing the value of that constant, which will affect all buildings on the map. You can get an instant rotation by removing the unit and making a new one with the right facing, but if you do that when construction begins it'll bork the building of the thing (except for for humans) so that is not an option. If you do it when construction finishes it will look weird because the model birth animation shows it being built in the 'wrong' orientation and it flips when it's complete. Here's a trigger that does that:

    • Rotate
      • Events
        • Unit - A unit Finishes construction
      • Conditions
      • Actions
        • Custom script: call BJDebugMsg("spawn")
        • Set tp = (Position of (Triggering unit))
        • Set ut = (Unit-type of (Triggering unit))
        • Set pl = (Owner of (Triggering unit))
        • Unit - Remove (Triggering unit) from the game
        • Unit - Create 1 ut for pl at tp facing 90.00 degrees
        • Custom script: call UnitRemoveAbility(bj_lastCreatedUnit,'Amov')
        • Custom script: call RemoveLocation(udg_tp)


    There's no perfect solution here besides model edits; you're going to have to live with a subpar implementation of this because there really isn't another way without replacing on construct start AND getting the construction itself to re-start. There's no trigger action that will make a unit begin constructing after you've already created it. Why specifically do you want some buildings to have a different rotation?
     
  6. warcraftmodding123

    warcraftmodding123

    Joined:
    Feb 20, 2016
    Messages:
    224
    Resources:
    0
    Resources:
    0
    Downloaded this wall Wall (Wood)
    I want to have angles: horizonal, vertical, diagonal 1 and diagonal 2. But this only comes with one .mdx and not an .mdx for each angle.
     
  7. Pyrogasm

    Pyrogasm

    Joined:
    Feb 27, 2007
    Messages:
    1,567
    Resources:
    0
    Resources:
    0
    Editing the model's rotation is going to be your easiest solution without resorting to triggers, then. 4 models for 4 different versions of the wall.
     
  8. warcraftmodding123

    warcraftmodding123

    Joined:
    Feb 20, 2016
    Messages:
    224
    Resources:
    0
    Resources:
    0
    Ya seems so. Do you know what's the best software for doing this?
    Do you also know why rotating it in 3DS Max doesn't actually rotate it, or why it has no textures when I import it to 3DS Max? I assume it's cause it uses WC3 textures but when I place it in WE it has no textures.
     
  9. Pyrogasm

    Pyrogasm

    Joined:
    Feb 27, 2007
    Messages:
    1,567
    Resources:
    0
    Resources:
    0
    It likely uses in-game textures that 3dsMax can't see, but they should work in-game. Did you try restarting your editor after importing? It could be an issue introduced by the new CASC filestructure that replaced .mpqs in 1.30.


    I have next to 0 modeling experience so I can't help with the rotation. I would imagine that you simply rotated the view of the model, not the model itself. There could be a bone in the model that determines facing.
     
  10. warcraftmodding123

    warcraftmodding123

    Joined:
    Feb 20, 2016
    Messages:
    224
    Resources:
    0
    Resources:
    0
    I did try restarting but the still no textures. I'm also noob to modeling so I don't know how I could fix this and didn't see any bone. I have an idea of a workaround but I prefer fixing this problem through modeling. Anyways thanks for attempting to find a solution to this.

    Update: Good news everyone! I found out how to rotate in War3ModelEditor Problem solved!
     
    Last edited: Aug 16, 2018