Dark Messiah: Breakable Shelves

From Valve Developer Community
(Redirected from Breakable Shelves)
Jump to: navigation, search
DMMaMBreakableShelf.jpg

Dark Messiah of Might and Magic An excellent gameplay tool in Dark Messiah, breakable shelves add a lot of immersion to any level. Though they are not necessarily difficult to produce, it does take many steps.

Creating your shelf

Setting up

A 320x320x256 room.

Start off with a good size room, preferably with a floor size of 320 by 320, and a ceiling with a height of 256. Textures and aesthetics are not the pivotal to this tutorial, feel free to use whatever textures or design variations you would like.

Making supports

The func_breakable's values.

The support beams (the ones the player will kick to break) are a good place to start. Make one support, 16 by 16 in length and width, then 122 in height. Afterwards, select the beam and press Ctrl+T, then select "func_breakable" as the class.

Change these values:

  • "Name" should be set as "platform_support"
  • "Disable Shadows" should be set to "Yes"
  • "Strength" should be set to 1
  • "Material Type" should be set to "Wood"

Also, make sure nothing is check under the "Flags" tab. These changes will allow the player to break the support using only one hit in game.

Two 16x16x112 func_breakable beams.

Shift+click and drag the support to another spot to create a duplicate. For now, place the two pillars 144 units apart, and 104 units away from the wall, and make sure they both have the same name value.

Starting the shelf

Two 16x128x8 beams.

Create two new beams, 8 units tall, 16 units wide, and 128 units long, then Shift+click and create a second.

Note.pngNote:Do not make these beams func_breakables!
Both upper planks clipped.

Next up, use the Clipping tool to clip the two upper boards exactly as shown.

Both upper planks clipped.

Finally, select the two small pieces closest to the wall, and press Ctrl+T to make them func_details.

Creating the platform

The 4 planks which make up the platform.

Now, create/duplicate four new planks, each 4 units tall, 24 units wide, and 244 units long. Spread these planks out along the top of the shelf, as shown.

The NPCClip.

Make 2 brushes the same height and length as the previous planks, with the texture "tools/toolsnpcclip," and adjust their positions and widths so that they each cover half the total surface area of the platform.

The two func_physboxes.

Once the NPCClip is in place, select the two planks and NPCClip piece closest to the wall, as well as the middle two sections of the upper beam, then press Ctrl+T. Change the entity's class to "func_physbox".

Func_physbox flags.

Change the following flags and values:

  • Change the name of the physbox closest to the wall "platform_rear"
  • Change the name of the physbox closest to the supports "platform_front"
  • Change "Material Type" to "Wood", and "Disable Shadows" to "Yes" in both entities
  • Check "NPC Collision" and "Motion Disabled" in both entities flag tabs

Adding hinges

Phys_hinges.

Create two phys_hinges, and name them "platform_hinge_a" and "platform_hinge_b." Align them on opposite sides, bottom center on the func_details.

  • Set the "Entity 1" value on both hinges to "platform_rear"

This will keep the back part of the shelf attached to the wall. The basic shelf is now complete, but we still need objects on top, NPC compatibility, and the logic to make it work.

Physics Objects

Add some objects!

Some prop_physics on the shelf.

This tutorial does not cover the creation of physics props. Once you have created some, place them around the edges of the shelf. Make sure the objects are in a position where they will not fall once affected by gravity.

Adding env_physexplosions

The env_physexplosions.
Note.pngNote:Even if you do not need props on your shelf, these env_physexplosions are necessary in order for the shelves to fall properly!

Create an "env_physexplosion" entity and name it "platform_explosion"

  • Change the magnitude value to 40.

Now Shift+click and create as many duplicates as needed, then place them in locations relevant to your props (or just above the shelf).

NPC compatibility

Link controllers

The link_controllers.

In order to keep NPC's away from the sides of the shelf before it collapses, two link controllers are needed. Start by placing an "info_node_mm_link_controller" entity. Name it "platform_link_controller"

  • Change the "Mins" value to -16 -64 -64
  • Change the "Maxs" value to 16 64 64

Now place them at the sides of the shelf such that they block off any pathway through.

Ragdoll trigger

Ragdoll trigger.

To make sure NPCs underneath the falling shelf become ragdoll, a trigger is needed. Create a brush with the "tools/toolstrigger" roughly covers the area beneath the "platform_front" physbox. Select this brush and press Ctrl+T, then change its class to "trigger_multiple"

  • Name the trigger "platform_ragdoll"
  • Set "Start Disabled" to yes
Output for "platform_ragdoll"
  • In the outputs tab, add a new output named "OnTrigger", that targets entities name "!activator", via the input "FallInRagdoll", with a parameter override of 2

Filter

Pick any spot nearby and create a "filter_activator_name"

  • Name it "platform_filtername"
  • Set the "Filter Name" value as "platform_rear"

Bringing it all together

Setup the logic_relay

Once again, pick any nearby spot and create a "logic_relay" entity.

  • Name the entity "platform_relay"
  • Check the flag "Only trigger once"

Add outputs to the support beams

Output for both "platform_support" beams

For both of the two "func_brekable" beams:

  • In the outputs tab, add a new output named "OnBreak", that targets entities name "platform_relay", via the input "Trigger"

Big step: Outputs for the relay

"platform_relay" outputs

Go back to "platform_relay" and add all of these outputs:

  • Output named "OnTrigger", that targets entities named "platform_support", via the input "Break"
  • Output named "OnTrigger", that targets entities named "platform_front", via the input "EnableMotion" with a delay of 0.25
  • Output named "OnTrigger", that targets entities named "platform_rear", via the input "EnableMotion" with a delay of 0.25
  • Output named "OnTrigger", that targets entities named "platform_explosion", via the input "Explode" with a delay of 0.25
  • Output named "OnTrigger", that targets entities named "platform_ragdoll", via the input "Enable" with a delay of 0.40
  • Output named "OnTrigger", that targets entities named "platform_front", via the input "Break" with a delay of 1.00
  • Output named "OnTrigger", that targets entities named "platform_ragdoll", via the input "Kill" with a delay of 1.00
  • Output named "OnTrigger", that targets entities named "platform_link_controller", via the input "TurnOn" with a delay of 1.00
  • Output named "OnTrigger", that targets entities named "platform_rear", via the input "DisableMotion" with a delay of 1.75

Optional: Add sound

Create an "ambient_generic" entity near the front of the shelf and name it "platform_sound"

  • Set the "Sound Name" value to "Wood.Crash"
  • Check the flags "Start Silent" and "Is NOT Looped"

Quickly add this output to the logic_relay:

  • Output named "OnTrigger, that targets entities named "platform_sound", via the input "PlaySound with a delay of 0.50

In conclusion!

Finished result!

Now just add an info_player_start and test it out!

Note.pngNote:Remember to change all the entity names if you duplicate the shelf!
Note.pngNote:Feel free to make changes to all measurements and brushwork, as well as adding more supports or anything you please

External links

Download of Tutorial VMF

See also