How to create buildable and viable walls, gates and switchable lantern posts

Level 14
Joined
Sep 6, 2015
Messages
580

How to create buildable and viable walls, gates and switchable lantern posts


This is a detailed tutorial on how to create buildable and viable walls, gates and switchable lantern posts. There are numerous ways and numerous variations of doing this. I am going to show you one of the simpler ways to do this. The complexity of doing this can vary between the models used for the walls, gates and lantern posts. The models which I will be using in this tutorial are: WoodWall for walls and gates (all four angle variations (note that the angles are listed wrong in the model names - 45° version is actually 135°, and 135° version is 45°), and the base Post Lantern doodad model for lantern posts (it can be turned on and off). There are many other models which can be used, but certain models require different handling techniques.

The wall segments that we will create will have proper pathing and construction pathing maps, proper collision size, and will fit together with other wall segments. They will additionally be able to be lowered and raised to let units pass and to serve as a gate. It will all behave and look realistic and be bug-free. The Lantern Posts that we'll create will be able to be turned on and off (their light), behave and look realistic and be bug-free with proper collision size, pathing and construction pathing maps. Look at the screenshots hereinafter at the end of the tutorial post if you want to see how everything will look.


*If you are looking for a more intricate and complex wall and gate system, then take a look at this: Castle Defence map.


Creating wall segments

After you've imported the models you want to use, it's time to create the buildings using them. First, we are going to create one out of four wall segments (four angles of the wall - 0, 90, 135 and 45 degrees (remember that this model has the 135 and 45 degrees listed wrong - 135 is 45 and 45 is 135)) - the horizontal one. To do this, I'd chosen the Farm building and changed its properties in the object editor. The most important things to be pointed out here are:

- Change the Art - Model to the imported wall model
- Change the Art - Shadow Texture to Stone Wall (Horizontal) <Base>, ... etc. destructible shadow
- Change the Pathing - Pathing map to the pathing map of the same destructible as written here above

You can additionally change Art - Scaling Value if your wall segments don't fit well with each other or have gaps in-between. Then, you can change anything else you want and you have to change there, test the wall segment in game, and make any additional tweaks.

Now that you have your first wall segment tested and done, make three additional copies of it in the object editor, for three additional angles of the wall, or only one more copy, if you want only the vertical angle and not the two diagonal ones. After that, change the shadow texture and the pathing map of the additional wall segments to the same destructible ones as with the first wall segment, just with the tags (Vertical), (Diagonal 1) and (Diagonal 2) instead of the (Horizontal) one. Make any additional changes you want and test all the wall segments before proceeding.

You now have all wall segments set and ready to go. If you don't want to (know how) create gates for them or lantern posts, the tutorial for you ends here.


Creating gates

Now that you have your custom wall segment buildings, it's time to put some gates, if you want them to fully enclose an area, but still have an exit. For this, we won't be creating gate buildings, but we will use the wall segments, although you can tinker with gates if you want. We will add the abilities to the wall segments which can be used to open them or close them.

First, we will need activated abilities which do nothing and don't need a target. For this, I used the Roar (Neutral Hostile) ability, set it to do nothing, and renamed it to Lower (the gate). Then I copied it and renamed the new ability Raise (the gate). You need to create one of each of these two abilities for each wall segment angle you are using (4 of both abilities here (or 2 if you don't use the diagonal wall segment angles)). After doing this, set anything in the spells as you wish, and then we need to create two additional changed copies of each wall segment for these abilities to work properly.

The first copy will be used when the gate is Lowered and it will be sunk into the ground with only some upper parts which can be seen, because we want it to look as if it's lowered so units can pass. For this, we will have to change the new copy of the wall segment to these values of its properties:

- Art - Elevation - Sample Points: 0
- Art - Elevation - Sample Radius: 0
- Art - Shadow Texture: None
- Movement - Height: -120
- Movement - Height Minimum: -120
- Movement - Type: Fly
- Pathing - Collision Size: 0
- Pathing - Pathing Map: None
- Pathing - Placement Requires: None
- Add Gost (Visible) ability to Abilities - Normal

Note that the value -120 fits well with this model (negative values sink the building), but other wall models may need another values. After you've done and tested this, make any other changes you want and your lowered wall segment is ready.

Now that we have a normal and a lowered version of the wall segment, we also have to create one more version of the same model when it's raised, since if we don't do this, the wall segment will move when its being Raised if any units are standing on it when its lowered, since its pathing is blocked by that unit then. It's simple to create this third instance of the same wall segment. First, copy the normal (not lowered) wall segment of the same angle again. Then change this in its object editor properties:

- Set Pathing - Placement Requires to nothing (uncheck everything)

And that's it. You now have three instances of the same wall segment, but only for one of its angles. Do the same thing with the other angles of the wall segment too.

Now that you have three instances of each angle of the wall segments, 12 instances in total (or 6 if you didn't make the diagonal ones), and the Lower and Raise abilities created, put the Raise ability to the lowered wall segment instances, and put the Lower ability to the original and raised wall segment instances.

Here we come to the last part needed for the gates to be functional and work well - the triggers. Here are the triggers that you will need:

This one Lowers the wall segment and plays an adequate sound:

  • Lower 0
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • (Ability being cast) Equal to Lower
          • Or - Any (Conditions) are true
            • Conditions
              • (Unit-type of (Triggering unit)) Equal to Palisade 0
              • (Unit-type of (Triggering unit)) Equal to Palisade 0R
    • Actions
      • Sound - Play Lever <gen> at 100.00% volume, attached to (Triggering unit)
      • Unit - Replace (Triggering unit) with a Palisade 0L using The old unit's relative life and mana
This one Raises the gate and plays the adequate sound:

  • Raise 0
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • (Ability being cast) Equal to Raise
          • Or - Any (Conditions) are true
            • Conditions
              • (Unit-type of (Triggering unit)) Equal to Palisade 0L
    • Actions
      • Sound - Play Lever <gen> at 100.00% volume, attached to (Triggering unit)
      • Unit - Replace (Triggering unit) with a Palisade 0R using The old unit's relative life and mana
To add the sound, you have to find the "Lever" sound in the sound editor, right click it and click Use As Sound. It will then appear in the menu of the Sound - Play trigger action as a variable.

Note also that you need to create one of each of these two triggers for each wall segment angle you are using (4 of both triggers here (or 2 if you don't use the diagonal wall segment angles)) with the appropriate different copied spells entered for each wall segment angle trigger and appropriate different lowered and raised angle versions of the wall segments put into the triggers.

After you've completed all of this, just add the four original wall segment angle buildings (not the raised or lowered versions) to the build menu of some worker, and you're ready to go! Remember to test it thoroughly to be sure that everything works.

If you don't want to (know how) create switchable Lantern Posts the tutorial for you ends here.


Creating switchable lantern posts

Lantern post is the third, and the last, special building that we will cover in this tutorial. For this we will use the aforementioned Post Lantern doodad model, the light of which can be turned on and off.

First, you will have to create a new custom unit. I based it on a wall segment we created before, but it can be based on Farm or any other building you want. Then, you can change its properties. Here are the most important pointed out, the other ones you can change as you will:

- Change Art - Death Time to 0.1 second (this is because the lantern model doesn't have the death animation)
- Change the Art - Model to the Post Lantern <Variation 1> or <Variation 2> doodad
- Change the Art - Shadow Texture to Cage <Base>
- Change Combat - Death Type to Can't raise, Does not decay
- Change the Pathing - Pathing Map to Barrel <Base>, ... etc. as it fits the model

After you've changed anything you wanted there, it's time to create the abilities which will control the turning on/off of the lantern light. I've based the ability used for turning on the light on the Raise ability I used for raising the wall segments (it is based on the Roar (Neutral Hostile) which was changed to do nothing). However, the ability for turning off the light has to be based on another ability, since if both abilities that are based on the same spell are on the unit at the same time, activating one of them will activate both, and the spells won't work properly. I based my ability for turning off the light on Howl of Terror (Neutral Hostile) and set it to do nothing, like the previous one, since these abilities are only there for the triggers to do the switching of the light and for it to look as if it was an ability. After this, you can change anything else in the spells as you wish.

After you've created the lantern post and the Light (turn on (the lantern)) and Extinguish (turn off (the lantern)) abilities, we can create the triggers needed to turn the lantern light on and off:

This trigger turns the lantern light off (and removes the aura-like spell that I've decided to add to it):

  • Extinguish
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Extinguish
    • Actions
      • Animation - Play (Triggering unit)'s death animation
      • Unit - Remove Cozy Atmosphere from (Triggering unit)
This trigger turns the lantern light on (and adds the aura-like spell that I've added to it, after it has been removed):

  • Light
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Light
    • Actions
      • Animation - Play (Triggering unit)'s stand animation
      • Unit - Add Cozy Atmosphere to (Triggering unit)
You can additionally use these two triggers paired with two such switching spells to manipulate animations of any other doodad, destructible or unit (the doodads and destructibles just need their respective animation trigger actions). You can find the string names of all the animations of any unit or doodad at the preview screen to the left when you put the doodad or unit on the map and select it. Use the left and right arrows to change between the animations. This can also be used to preview all of the doodad's or unit's animations to see how they look.

And that's it! The only thing left to do is to test all of this you've created thoroughly, fix any bugs and make any additional changes you want to make.


The end result should look something like this:

WC3ScrnShot_071916_215608_02.jpg
WC3ScrnShot_072016_130417_02.jpg
WC3ScrnShot_072016_124454_01.jpg
WC3ScrnShot_071916_215922_03.jpg
WC3ScrnShot_072016_115719_01.jpg
WC3ScrnShot_072016_115749_02.jpg
WC3ScrnShot_072016_124344_01.jpg

Enjoy!

Here's the test map in the attachment:
 

Attachments

  • SystemTest.w3x
    91 KB · Views: 99
Last edited:
Level 14
Joined
Sep 6, 2015
Messages
580
I've removed all the redundant and unnecessary text size tags, and added the test map. That is my test map for everything, so it also contains many other things that can be useful too. The wall system isn't finished completely in it, but it has all the necessary components.

Edit: Reworked the tutorial. Simplified and fixed the system. The test map now contains the complete system, and only that.
 
Last edited:
Level 14
Joined
Sep 6, 2015
Messages
580
Beautiful. :)

Approved!
Thanks.
Nice tutorial, I think it may help beginners a lot! Good job! Maybe you can add, how to rotate buildings.
Thank you. I don't know how to rotate buildings. I have an idea how it could be probably done, but I've never done it in practice, so I'll leave that tutorial for someone else to create.
 
Top