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

Change default facing of a building

Status
Not open for further replies.
Level 3
Joined
Jun 19, 2017
Messages
19
Hello :)

Sorry if there are already similar threads. All those I found are a bit different to my problem.

I'd like to make the workers to be able to build horizontal, vertical, 45° and 135° turned fences.
So I modified the art properties of 4 unused buildings to make them look like one of the fences of the doodad list.
The thing is that as a doodad, it is easy to turn them in the editor.
But as a building (in the game) they are only built horizontal by the workers.

Does any one know a way to change their facing angle?

Thanks.
 
Level 11
Joined
Nov 23, 2013
Messages
665
You may make triggers like this:

  • Your_Trigger
    • Events
      • Unit - A unit Finishes Construction
    • Conditions
      • (Unit-type of (Constructed structure)) Equals {Fence_Angle_X}
    • Actions
      • Set Loc_Building = (Position of (Constructed structure))
      • Unit - Remove (Constructed structure) from the game
      • Unit - Create 1 {Fence_Angle_X} for (Owner of (Constructed structure)) at Loc_Building facing X degrees
      • Custom script: call RemoveLocation(udg_Loc_Building)
The main problem of this sort of trigger occurs when you order your builder to start building, when you choose its location: the green pre-placement thing will display your unit with its default angle.

You may also edit the models, rotate them with the angle you want, and import the rotated models back into your map. Although if your fences have animations, it might mess it up. Once I tried to edit a model with animations, and just translating the model wreaked chaos in the animations, and I'm no expert in modelling, so...

There must be more sophisticated ways to achieve what you're looking for, but that could be a start.
 
Last edited:
Level 3
Joined
Jun 19, 2017
Messages
19
Thanks for the answer.

I found War 3 model editor v1.07 editor and tried with it, even if I'm not a good friend of 3D modelling programs.
The longest was to find the right fence model in all the folders ;-)
And then: select all... rotate... save as... import with World edit...
It seems to work so far. The green pre-placement as well. Nice!

But there is one little thing I am a bit worried about:

I created and imported custom icons (.blp files) for the same map no long ago (with a tutorial on this website).
To import them, the tutorial told to change the path of the .blp files in the import manager.

Example:
ReplaceableTextures\CommandButtons\BTN_grb.blp
instead of:
war3mapImported\BTN_grb.blp

Did not really understand why... Nevermind.

With the 3D model the automaticly generated path is the same than for the icons:
war3mapImported\Village_Fenceshort_V.mdx

Is there a modification needed as well?
 
Level 11
Joined
Nov 23, 2013
Messages
665
I created and imported custom icons (.blp files) for the same map no long ago (with a tutorial on this website).
To import them, the tutorial told to change the path of the .blp files in the import manager.

Example:
ReplaceableTextures\CommandButtons\BTNgrb.blp
instead of:
war3mapImported\BTNgrb.blp

Did not really understand why... Nevermind.
It's important to do so for icons. Setting the path of the icon will tell the game how it may use it.
When you import an icon, most of the time, you need at least 2 icons:
  • One with BTN, which is used for standard view of the icon.
  • The other one with DISBTN (which stands for Disabled Button), which is used for various reasons: when a unit hasn't unlocked the ability, when the game is paused...
And you need to set the right path. For example:
  • ReplaceableTextures\CommandButtons\BTNgrb.blp
  • ReplaceableTextures\CommandButtonsDisabled\DISBTNgrb.blp
If you don't, you will get a flashy green icon instead of your icon.
When you assign an custom icon to a unit, you just choose your BTN icon in the field Art - Icon - Normal (and Art - Icon - Research if your unit is a hero). If you imported a DISBTN icon as well, and set the right path for it, the game will automatically know that it must use it as a disabled icon.

Depending on what your icon is used for, you may want to use more paths:
  • ATC - ReplaceableTextures\CommandButtons\ : Autocasting icon. For icons with golden things in each of the four corners, used for spells with autocasting (like priests' heal)
  • DISATC - ReplaceableTextures\CommandButtonsDisabled\ : Disabled autocasting icon for the latter
  • BTN - ReplaceableTextures\CommandButtons\ : Regular button.
  • DISBTN - ReplaceableTextures\CommandButtonsDisabled\ : Disabled regular button.
  • PAS - ReplaceableTextures\CommandButtons\ Disabled : for icons with no frame. Used for passive spells (like Critical Strike)
  • DISPAS - ReplaceableTextures\CommandButtonsDisabled\ : Disabled passive button for the latter
I hope I'm not too confusing... :cconf:

Loopy24 said:
With the 3D model the automaticly generated path is the same than for the icons:
war3mapImported\Village_Fenceshort_V.mdx

Is there a modification needed as well?
As far as I know, it is not compulsory to modify the path for .mdx files. However, I would recommand to remove the war3mapImported\ part:
  • It's useless
  • When you're in the object editor or in the import manager, it's easier to find an imported file by just pressing its first letter (for example, press F and you'll reach the files whose first letter is F). If you keep the default path, all files will start with a W... Comes in quite handy when you have a lot of imported files.
  • There was a thread recently, pointing a problem when using imported files within a map (war3mapImported\) and imported files within a campaign war3campImported\. Someone was having troubles because of these paths. I suppose it's less confusing when removing the unnecessary part of the path.
At least that's my point of view, perhaps some people will differ on this point.

Also, always remember to save your map/campaign after you have imported a model, and before doing anything else (sometimes you might have to restart WE as well).

Good luck with your project. :csmile:
 
Level 13
Joined
May 10, 2009
Messages
868
Here's something interesting: You can actually order a structure to face a certain angle, but the problem is that warcraft 3 does not update its appearance. You can force it to be updated by hiding and showing such structure after a while, because they turn as slow as any other unit.

  • Events
    • Unit - A unit Finishes construction
  • Conditions
    • (Unit-type of (Constructed structure)) Equal to Farm
  • Actions
    • Custom script: local unit structure = GetConstructedStructure()
    • Unit - Make (Constructed structure) face (Random real number between 0.00 and 359.00) over 0.00 seconds
    • Wait 1.00 seconds
    • Custom script: set udg_helperUnit = structure
    • Unit - Hide helperUnit
    • Unit - Unhide helperUnit
    • Custom script: set structure = null
Untitled-1.png


Even though, your solution is better for your situation, because players will always see the default facing angle while in "ghost form" (before confirming the building location). Also, the structures in my case will face the new angle all of a sudden.
 
Level 3
Joined
Jun 19, 2017
Messages
19
The other one with DISBTN (which stands for Disabled Button), which is used for various reasons: when a unit hasn't unlocked the ability, when the game is paused...
Yes :) At the begining I wanted to import only one icon and had green buttons when the game paused LOL

I hope I'm not too confusing... :cconf:
Not at all. Perfectly understood :)

  • I suppose it's less confusing when removing the unnecessary part of the path.
At least that's my point of view, perhaps some people will differ on this point.
I totally agree.

Also, always remember to save your map/campaign after you have imported a model, and before doing anything else (sometimes you might have to restart WE as well).
Thanks for the tip. I had little problems at the begining.
Like: Why are icons visible in the game but not in the editor? LOL
->restart the editor to "refresh" you i**** LOL

Good luck with your project. :csmile:
Soon finished I hope... Maybe 3 or 4 adds and modifications + testing for difficulty ajustment.

A older version (called loopy) is uploaded on the partner website Epic War. Just in case someone is interested.
But the "final version" will be much better.
I think that I tried to submit it here, but only full english maps were allowed if my memory is good. And mine is in french. But for a tower defence it's not so important.

Thank you again for your time and help!
Cheers
 
Level 3
Joined
Jun 19, 2017
Messages
19
Even though, your solution is better for your situation, because players will always see the default facing angle while in "ghost form" (before confirming the building location). Also, the structures in my case will face the new angle all of a sudden.

Seems to be a nice solution, maybe for creating a random facing of the buildings in a deathmatch.

If I understand right, the triggers called "Custom script" are made with the JASS language...?

Could be very interesting, but I really don't want to learn JASS for 2 reasons:
-Doing only one map.
-Programming is unhealthy: bad sleeping... hours and hours sitting on a chair... burning eyes ( I did a bit of HTML, CSS, Autoit and C++ Qt). NEVER AGAIN :)
 
Level 13
Joined
May 10, 2009
Messages
868
You're basically writing things directly into JASS when dealing with "custom script actions".

Well, as long as GUI is capable of attending to your needs, it's fine. Burning eyes? You'd better check your monitor settings.
 
Status
Not open for further replies.
Top