A - Z Beginner Full Guide Page 5

From The DarkMod Wiki
Jump to navigationJump to search

"Teach Yourself Dark Mod In One Day!" by Fidcal

Page 1 | Page 2 | Page 3 | Page 4 | Page 5 | Page 6 | Index


Windows

Adding windows to rooms will really help them towards looking authentic. Windows can be models or textures; openable (like doors) or mere architecture. Older medieval gothic type windows might be mere shaped slits in the stone. There are many facets to making windows which cannot all be covered in this beginners' tutorial. A few points to remember...

  • If the player can go to both sides of a wall then make sure there is a window on both sides and aligned.
  • Consider if you use outdoor 'lit' windows, can the player extinguish the light inside then go back outside and see the window still lit?
  • Consider the frame.
  • Consider having a windowsill.
  • Perhaps a support beam or stone is needed over the top of the window?
  • Does the window need to be recessed into the wall?

In this old house we shall put a few simple recesses with window texture...

  • On the west wall of the big room, between the middle vertical beam and the south wall, create a niche 80 wide by 112 high using the same technique as for the yard wall torch niche. Try to get it between courses of stonework (though this irregular stone makes that tough so don't worry.)
  • Texture the back of it with textures/darkmod/window/largesquare02_dark
  • Scale it Horiz 0.15 and Vert 0.2
  • Shift the texture so the frame is equally half on one side and half on the other.
  • Check the texture and alignment of the sides of the niche align with the rest of the stone wall.


  • In the same way create TWO windows 56 wide by 80 high in the small room - one about the middle of the west wall and the other on the south wall and to the east.
  • Position and rotate Creep so he appears to be standing looking out of the south facing window but stand him a little to one side. Place the thugs path_corner at his side. With a bit of tweaking later it might suggest the thug is coming and standing there looking out the window with Creep for a few seconds. We are trying to create opportunities for the player to sneak in!

Outside you cannot put a window on the west wall of the yard else it would show indoors which would need more thought. We might consider an openable window - another avenue for the thief to get in? Ideally we'd have a window or two to the yard but let's leave it for now and press on...

Fires and Fireplaces

Let's put a fire and a fireplace in the kitchen - sorry, 'small room' - I'm already visualizing it as being used as a kitchen...

  • Create a model : darkmod/fireplace/fireplace_stone.ase in the south west corner of the small room.
  • Create a model : darkmod/fireplace/grate.lwo and place it in the fireplace
  • Create a model : darkmod/fireplace/burntwood.lwo and place it on the grate
  • Create an entity : light_extinguishable_moving and place it within the top two thirds of the logs
  • To the light add properties...
  1. _color : 0.50 0.38 0.31
  2. light_radius : 180 180 120
  3. model_lit : tdm_fire_flames.prt
  4. model_extinguished : tdm_smoke_torchout.prt
  5. snd_lit : element_fire_fireplace
  6. snd_extinguished : machine_steam01
  7. texture : lights/fire_fireplace

Save and map and check it out. You might want to adjust the position of the fire or logs.

Chests and other Containers

Container are effectively an open box with a lid functioning like a door. These can be existing models or you can make a custom one out of brushes. The lid and body need to highlight together as one unit and a special clip brush entity is inside to stop items being frobbable when inside with the lid shut. Full details are at Containers, Chests, etc. but here we are going to do it the easy way using ready-made prefabs. If you want to know more you can study that article and these prefabs.

Layers (groups)

I recommend you create separately suitably named layers (menu > view) for each chest and move each chest to its layer while still highlighted after insertion. This is because there are several components to each chest and it is easy to miss parts when moving. Think of these layers as groups where you can collect together items that all need to stay together. You can easily re-select the whole group just by clicking its layer name in the Layers dialog so it can be moved, rotated, cloned, deleted, whatever. Tip: always switch off all filters (menu > Filters) when reselecting groups of stuff. These chests include a clip-textured brush. If you have clip texture filtered out and select the layer then it won't include this brush. Consider also if you had pressed 'H' to hide anything, eg, the lid.

When rotating groups some items may go out of place relative to the others. In this case the lock has a tiny moveable lockpin. I suggest when first inserted and still highlighted, examine the position of this pin. If you then rotate the whole group and find that pin oriented wrongly just select it on its own and delete the rotation property. Now rotate and move it into position. I use menu > Modify > Rotate and Scale for precise control but there is also a rotate tool button.

  • You will be inserting three prefab chests of your choice : menu > file > insert prefab > containers > openable
  • Insert one chest in the little room against a wall.
  • Likewise insert two other chest prefabs in the big room. One or both them may eventually go upstairs or in the basement when finished.


Locking

These chest prefabs come ready locked, lockpickable, and with a key inside (maybe even some sample loot.) Later you can delete the key if not wanted or place it to be found by the player, give it to a guard (see pickpocketing), or give it the player (see Inventory). Locking the chest will be dealt with later under #Locks, Keys, and Lockpicking but essentially these chests are ready to go so you need only delete properties you don't want eg, lockpick properties or delete 'locked' if you don't want it locked at all.


Putting Items into Chests

Putting an item into a chest is literally that - just position any item(s) in the chest. If you use a completely empty chest it looks odd with just say, one ring or one coin in it so the prefabs include a patch shaped like some blankets with an appropriate texture to pad it out. I think the chest models now might already have similar. For now we shall just put single items in and this we shall deal with later under #Loot!

Some items become difficult to frob highlight even with the lid open because the chest may hog the frob highlight. If you see this when testing then try adding frobbox_size 5 to the item (any value works but 3 to 8 are suitable here or you could overdo it and cause some other problem.

Locks, Keys, and Lockpicking

Locking a Door, Chest, etc.

To lock a door, chest, etc. that is using the standard Dark Mod entity atdm:mover_door, just set the property locked to 1. The default for doors is 0 which is unlocked but the default for froblock is 1. The froblock entity is under Misc > adtm:froblock and is used for chest bodies and other locks separate from doors.

Keys

You can use the key that came with the chest prefab if you did it that way. This section describes how you would normally create a key.

Any object can be made to function as a key with the right properties. Here we use predefined key entities with normal key models...

  • Create entity > darkmod > Keys > atdm:key_ornate
  • Place it on the table somewhere for now. You can rotate it to lie flat (modify menu)
  • Optionally change its name (NOT class name) to say, key_chest3. You can change the name of any entity you create. For most there is no need but here is an example where in a big mission you might have a lot of keys, and they are small after all. By naming them Key_something they will all appear together in the alphabetical enitity list (keyboard L) so you can quickly find what you want. I recommend starting with a capital letter. The list is sorted in ASCII order which means capitals list first so your specials are at the top of the list. The list selects the entity for you in the grid and camera views in Dark Radiant and centres them to zoom in. Neat eh? (keys in inventories are not visible though.)
  • Optionally change the name that shows in the player's inventory when the key is selected by changing the value of the property inv_name
  • You can also add comments to any entity if you wish so you might have 'Gate guard's key to be added to his belt' or something. See Comments for details


To set a specific door, chest lid, etc. to be opened by a particular key, add the following property to the door...

used_by <key name>

You can assign the same key to many different doors by adding used_by to each of the doors. On bigger missions you might create a master key just for testing. Name it key_master and it will work on all locks. Put it in the player's inventory using the property inv_map_start 1. Such a key is provided in the startpack. Remember to set inv_map_start to 0 or delete the master key when you pass your mission to beta testers and the public so they don't get the master key.

You can also assign many keys to open the same door, chest, etc:

"used_by"   "doorkey_1"
"used_by_1" "doorkey_2"

Lockpicking

The basics of setting up lockpicking on a door or chest lid etc is fairly simple but there are enough complications if you add a lockbox, lock bar (that flickers while lockpicking to indicate progress) separate handle etc. that I will not include these in this beginner's guide. Instead I will just refer you to Doors#Lockpicks

The chest prefabs are already set up with default lockpicking so you need only adjust the values to suit your mission.

Managing your Mission Files

So far we have only been saving your map file. You will see in the darkmod folder there are materials, and textures, and models, etc. subfolders. It is possible to produce a respectable mission without any other files except the Dark Mod resources. But even if you do not create any custom textures or models for your game, few missions will not need readable texts in the game. While it is possible to include this text right in your map as properties of the readable, that makes it more difficult for later translations into other languages. So this is a good time to discuss where to store any other files.

Place materials files into the materials folder and textures directly into the textures folder etc but give your files distinctive names and keep note what and where they are. When finished you will have to include them, and an equivalent folder, zipped up with your FM.

Ultimately your FM must run in its own game folder because all Dark Mod FMs work that way. It is possible to develop it from the start, along with any other custom files, in such a folder. For details of this see Project versus Non-Project?

Readables: Books & Scrolls

By 'Readables' might mean either static books, scrolls, etc, whether open or closed, or functioning such that can actually be read in-game...


Static Book & Scrolls for Decoration

Creating a static, non-functioning readable is fairly straightforward - just create the model of your choice (see models > darkmod > readables) and place it nicely to decorate a shelf or library in your mission. There are open and closed books as well as shelves and rows of books. Also look under models > furniture > shelves where there are some book shelves with books. At the time of writing I can't see any book textures but it is worth checking to see if any are added later or even make your own. You could then texture a brush bookshelf or even make a reasonable custom book out of brushes and/or patches.

Readable Books & Scrolls

You can see a choice of readable types under darkmod\Readables in the "Create Entity" dialog in DarkRadiant.

In our mission we are going to create the incriminating message from Creep that the player will have in his/her inventory at mission start, ready to place in Creep's hideout.

For our present use we want a carryable (mobile) note, not a book - and a scroll might be too grand - so we use the simple note type...

  • Create entity darkmod > readables > atdm:readable_mobile_paper01
  • Place it on the table for now.
  • Add the property xdata_contents with the value : creeps_message. This is the name defined in the text file we are going to make and identifies each text.
  • Add the property inv_name with the value : Creep's Message. This is the name that will show in the player's inventory.
  • Add the property inv_map_start with a value of 1 so the message will be in the player's inventory at the start.

Now we define the text of the message itself...

Creating Text for Books, Scrolls, and Sheets

In Dark Mod, multiple in-game texts can be stored in one file in xdata format. For details see Readables but the simplest method is to insert a prefab which already works and you need only add your text (see Readables Prefabs

For the sake of this guide I will give a simple description for our tutorial mission and this is all you need for now...

  • Copy and paste the following into a plain text editor
  • The xd file can be any name with the .xd suffix but the final mission name makes sense so...
  • Save it as thiefsden.xd in the darkmod/xdata folder.
  • You need to be aware where all your mission files are so nothing gets missed when you zip up for publishing.
creeps_message
{
  precache

 "gui_page1"   : "guis/readables/oldparchment.gui"
 "page1_title" : ""
 "page1_body"  : 
 "I have real good information about Frothbody's sceptor" \
 " - I can be trusted on that. " \
 "Must be some rogue who can do this heist for me.\n\n" \

 "If not interested I'll do it myself so make up your mind quick.\n\n" \

 "                  ~ Sebastien Creep" 
}


Explanation...

  • Multiple texts for different messages and books can be defined in this one file.
  • Each definition consists of a definition name then the details within curly brackets as follows...

creeps_message
{
details in between.
}


text2name
{
details in between. (can be many pages in-game)
}


text3name
{
details
}

...and so on.

  • precache - this means Dark Mod will load it at mission start. Otherwise it will load as the player starts to read it causing a slight lag as it loads off the disk.
  • "gui_page1"  : "guis/readables/oldparchment.gui" - the graphical image of the background scroll, book, etc.
  • "page1_title" : "" - Text in this is shown as a large header suitable for posters, notices, etc. (around 10 or 12 characters only.) We left it blank in this message as it is just a scrawled note.
  • "page1_body" - this is the actual text where...
  1. text is in quotation marks
  2. \ at the end of a line after the quotation mark means the next line is to be added to this line and wordwrapped. Make sure you do not have one of these at the end of the last line - a common mistake which will cause an error.
  3. \n within the quotes means start a new line. So \n\n means leave a line gap between paragraphs.

And yes, you can add graphics in .tga format.

For full detals of readables and how you can even make your own readable books out of brushes, see Readables

Extra note: There is an alternate xdata format which I think is simpler and used in the prefabs and in startpack. I recommend you use that hereafter.


In-Game Mission Maps

In-game maps of the terrain in your FM are very popular with players. They add atmosphere, story, extra information, as well as helping the player navigate. In Dark Mod they are like other readables in the inventory but displaying a map instead of just text.

This is no longer described here because it is far easier to use the template in the startpack and described at Startpack Mappers' Guide#Adding an In-game Map to your FM At its simplest all you do is replace the image file with your own.

Adding an Upstairs Room

let's build some more to add interest to our mission and demonstrate climbable surfaces such as ladders...

  • Clone a wall from the small room as our upstairs room doesn't want to be too high.
  • Drag it 16 units above the big room and extend it out to the inner surfaces of that room on the north, west, and south sides but only 352 in length east to west so it is smaller than the big room and doesn't jut out anywhere near the yard.
  • Use the room, go inside and check the walls are the same stone as downstairs, the ceiling is plaster and the floor can be boards.
  • Note there is a wall jutting up at south east clipping through the south wall of our upstairs room so use the Clipper tool to cut it away. To do this...
  1. Remember you cannot cut out a piece to leave an L shaped brush; they must be convex.
  2. Select that wall and using clipper (X key) click on it left and right between floors and use Shift + Enter to split it in two.
  3. Select the part that is clipping into our new upstairs wall and using clipper clip it away using Enter.

Check the main ambient light. I found it needed resizing to cover the upstairs room. Just make sure the centre of the light is not in the void.

Now we'll just create a simple opening in the floor to downstairs...

  • Move down to the big room below
  • Use the clone and curtain method described earlier to split the ceiling up to leave a gap 64 x 64 units in the ceiling in the south west corner of the big room but 32 units from the west something like this...



  • Repeat in the floor of the upstairs room exactly above it.
  • You should now have an opening between downstairs and upstairs.
  • You might have a gap(s?) but just fill in with small solid brushes
  • Check the texturing makes sense. Stone on the wall, wood against the floorboards, plaster below.
  • You should have something like this...



Throw in a few bits of static model furniture for poor old Creep. I lay down three sacks and stuck a mattress over it. A shelf unit and a static model crate at the side of his mattress. I put an entity atdm:moveable_candle1 on that and an entity light_candleflame_moving at the top of the wick. Then on the candleflame add the property bind with the name of the candle so if picked up the flame will go with the player! Remember to adjust the light radius.

Now we need to get the player up there....

Climbable Surfaces: Ladders, Drainpipes, Vines

In Dark Mod a climbable invisible textured brush can be placed over a visible model or other surface that you want the player to climb. Full details at Climbables, Ladders, etc.. For our mission we...

  • Create a model : darkmod/architecture/ladders/ladder_16steps.ase
  • Place it against the stone wall left of midway through our hatch so it's not far too step off at the top. You probably need to reduce grid size to get it close to the wall.
  • The ladder itself is just a visual - it cannot be climbed.
  • Make a brush XYZ = 24 x 4 x 256 (it does not need to cover right to the top of the ladder) and place it around the ladder
  • Give it the texture common > ladder

That's it! Save, dmap, map, and you can try it out. The player must be able to step off the ladder top and bottom without having to jump and be forced to break stealth. So experiment with the ladder brush position - maybe make it a little bigger than the ladder if you want.

Switches, Buttons, & Triggers

In Dark Mod, the entity atdm:mover_button can be linked using the 'target' property to switchable items like electric lights to turn them on and off. Use it like this...

  • Create model darkmod/lights/non-extinguishable/wallight_outdoor3.lwo and place it outside over the yard door.
  • Create a light radius about 180 200 200 and brightness about 35 and centre it just at the bottom of the wall light. Give it a name, eg, yardLight.
  • Create model darkmod/mechanical/numberwheel_button.lwo or whatever switch available that looks suitable as an outdoor light switch.
  • Change its class name from func_static to atdm:mover_button
  • Place this on the wall outside the door - ideally create a tiny niche to keep it out of the rain.
  • Add the propert target yardLight

It should now work to switch the light on and off.


Adding a Basement

This is the final room in our tutorial mission. We are almost there! Adding a basement is a similar exercise to creating the upstairs...

  • Create the room below the small room and exactly the same size and texture.
  • Create the connecting gap between the floors like we did for the upstairs but in the north west corner of the small room. It should be 56 x 56
  • Check texture etc and check for gaps! Remember pointfile if dmap shows a leak!(For details on fixing leaks & pointfile see Leaking maps and Performance: Essential Must-Knows#Build Airtight. Seal out the Void. Avoid Leaks)
  • Make sure the main ambient light radius reaches down to the basement or put another ambient down there.
  • You can throw in a crate or two but we'll rethink decoration later.

Meanwhile how to get the player down there - and back...

Elevators

Sophisticated multi-floor elevators are now possible with Dark Mod (see Elevators, multi-floor) and it is recommended that you use that tutorial for your own missions. But in this beginners' tutorial we shall improvise a very simple, one floor, platform elevator using the sliding door entity...

  • We need a recess for the lift to descend into ideally so the floor surface of the lift fits flush with the floor in the basement. Skip this if you feel lazy...
  1. The recess is just like making a tiny room 56 x 56 and maybe 40 units deep
  2. Make the gap for the recess in the basement floor
  • Create a brush 8 units high that exactly fits the gap 56 x 56
  • Position it flush with the floor in the small room in the gap.
  • Give it the texture darkmod/metal/detailed/rusty_diamond_pattern
  • Ideally it should have supporting struts underneath, motor etc. (if these are assigned to the same entity as the main lift platform they move in sync with it) as well as a track up the wall. Improvise and experiment later if you wish or just leave it as a metal platform.

That's the visible build and now to get it working...

  • Select the platform (and all extra parts, struts, etc if you made any) then RMB grid menu > Create Entity > darkmod > atdm:mover_door_sliding
  • Optionally give it a name like CellarLift.
  • Add/set these properties...
  1. frobable 0 (stops it being frobbed directly like a typical door)
  2. translate 0 0 -132 (distance and direction it has to travel)
  3. translate_speed 12 (units per second)

Finally we need two simple buttons. Make one and clone it...

  • The button can be the darkmod/mechanical/numberwheel_button.lwo (small, not easy to see in the gloom) or make one from a small square brush with a suitable texture. It is likely you will find more button models.
  • Change func_static to atdm:mover_button.
  • Add the property target with value of CellarLift (or whatever name it has)
  • Clone the button
  • Place one on the ground floor near the lift and one down in the basement

Save, dmap and map and try it out!


More info on elevators at Platform That Moves When Button Is Pressed and at How to make a Three Stage Elevator

"Teach Yourself Dark Mod In One Day!" by Fidcal

Page 1 | Page 2 | Page 3 | Page 4 | Page 5 | Page 6 | Index