Editing FAQ - Troubleshooting & How-To
Below are some common issues and questions mappers have had in the Editor's Guild forum with common solutions. Some of this assumes you've already gone through the A_-_Z_Beginner_Full_Guide_Start_Here!, Startpack_Mappers'_Guide, and Dark_Radiant_Must_Know_Basic_Intro. (If you know a FAQ not here and worth going in this list, and you know the right answer(!), or you can improve an existing answer, please add it if you have edit control or PM it to a team-member if you don't.)
Troubleshooting FAQ
Rendering & VisPortal Issues
Q. Some of my brushes have disappeared or turned black and won't render.
A. This can happen when two touching brushes around the seam are not perfectly flush with one another and the rendering hiccups for those brushes & brushes behind it, either there's a tiny wedge or overlap or gap or weird angle between them. The usual solution is to make sure the brushes are snapped to the grid and perfectly flush against one another, or more generally to simplify the brushwork around the seam of the disappearing brushes.
Q. My visportal is not showing up or not closing like it should (you can check this with by typing "r_showportals 1" in the console. The portal edge will show green when open and red when closed.).
A. A common reason for that is that the two areas separated by the portal are not hermetically sealed and there's an internal leak, either (1) there may be an unportaled gap between the two, possibly covered up by func_static (which do not seal) or possibly caused by an inadvertent hole created by the first FAQ question above, or (2) an internal leak can happen when all sides of the visportal are not buried in or flush against sealing brushes, and there's a gap between the visportal and brush, or possibly even a tiny gap just touching the visportal side is enough to break it. A way to check if there's an internal leak, and locating it if there is, is described here: Visportals#Trouble-shooting. Other reasons it might fail are also described there (such as accidentally changing a nodraw texture to something else).
Q. I can see other rooms behind a mirror (or any reflective surface) through it, instead of just a reflection.
A. The area behind a mirror should be in a separate leaf (visportaled area) behind a closed visportal so it doesn't render. This problem usually means the two areas aren't in separate leafs, the portal isn't closed, or there's an internal leak between the areas in front of and behind the mirror.
Q. Help! I'm having rendering & visPortal issues all over the place ... broken portals, sparkly lines, disappearing brushes, z-fighting, uneven walls, etc.
A. As a general piece of advice, messy brushwork leads to trouble one way or another. To keep your brushwork clean:
- keep snapped to the grid (Ctrl+G toggles) & stay away from small grid levels (Typing a number or Plus/Minus changes the grid scale; 8 is a good starting grid; staying at or above 2 or 4 is fine for most stuff; going below 1 is usually just for special situations).
- Make brush intersections perfectly flush.
- Stay away from unnecessary tiny brushes & wedges (leave detail work to func_statics; brushes are for closing off leafs and the void. Of course you can do fine detail work with brushes & convert them to a func_static).
- Don't use the "CGS Subtract" tool if it will shatter the brush into tiny slivers; use the cut tool instead (open by pushing "X").
- You can use patches for uneven geometry with square brushes underneath textured with caulk.
- When rotating geometry, avoid weird angles when you can (where vertexes end up off the grid), and for multi-brush structures, build the whole thing first *then* rotate it all together instead of rotating & placing each brush individually.
These aren't rules set in concrete if you want to do something special once in a while, but general rules of thumb that will make life a lot easier if you generally stick to them.
Crashes and Warnings
Q. My map has a leak in it, but a pointfile either isn't generated or doesn't make sense. (A pointfile is generated when dmap occurs and there's a leak, then you open DarkRadient and click File>Pointfile to see it. It normally runs a red line that ends in the void, pointing out the leak).
A. Make sure a gap isn't covered up with func_statics. If the origin of a model is in the void it will also cause a leak with a non-sense pointfile. Read more on the Leaking maps page.
Q. How do I scroll up through the console output to see what a problem was during dmap or map or in-game?
A. Use the mouse wheel or PageUp/Down to scroll through the console.
Q. I'm getting an error message "warning: aas is out of date" once my map has loaded. What does it mean and what do I do?
A. The AAS is for AI pathfinding. It usually means you changed brushwork and started a map without dmapping first. The solution is to dmap. If you dmap and still get the warning, delete your .aasxx, .proc, and .cm files in the maps folder and dmap again. If you're still getting a warning, then it could be a sign that something in your map is breaking the AAS pathfinding. Try monsterclipping tricky areas for the AI to path (like around objects and uneven ground) or clean up messy brushwork that might break the dmapping like sliver brushes.
Q. I have encountered a malloc failure error while dmapping my level. Instead of finishing with the dmap operation, it crashes midway with an error message.
A1. One solution to this is given in the Dmap wiki entry here: Dmap#Malloc_Errors.
A2. This is what I've done to fix this exact issue. Open the map in DarkRadiant, select everything, copy to clipboard. Open another instance of DarkRadiant and paste from clipboard. Save as new filename and dmap new file and that has worked 3 times now with random unresolvable crashes.
A3. GC and I have found correlations between visportalling and mAlloc errors. Time to re-arrange your visportals. In NHAT, we had many malloc problems until we retooled how each area was portaled. Originally, every other visleaf had tons of entities, while half had hardly any. That's not neccessarily bad, but it strains the dmapper when one or two visleafs are cluttered with entities that really bloat your mapname.proc file. We added a few more portals to even out entity distribution, and dmap was happy again.
Performance Issues
Q. My map is so slow. How do I improve performance?
A. See these wiki entries: Performance:_Essential_Must-Knows. Tips include:
- Improve AI Pathfinding. Monsterclipping helps performance,
- Use Interleaved_Thinking_optimization. Reducing AI think-time helps performance quite a bit.
- breaking-up long lines of sight,
- improving visportal & leaf placement (so less architecture is rendered at a time),
- using fewer AI,
- converting ornamental brushwork into func_static,
- reducing the overlap of light sources on surfaces by adjusting their placement & reducing their light-radius (Every time a new light hits a surface, it's another render pass. So 4 lights hitting a surface processes it 4 times), and
- setting objects and lights to "noshadow" if it won't be noticable to the player or affect gameplay (possibly in combination with low-poly shadow meshes or shadowy decals. Note that "noshadow" has two jobs. Put on lights, it means that light will cast no shadows on any object. Put on objects, it means that object will not cast a shadow from any light.)
There are also lots of other tricks out there if you check around the forums, including more advanced & optional tricks such as using the LOD system or SEED system, or even crazier tricks (cross-leaf func_statics, skybox architecture, Strombine lighting, Camera Cubemapped Visportal Patches, lots of crazy tricks out there), that you don't have to worry about if you're a new mapper but you can ask us about or search for in the forum if you're curious. Generally speaking there are pros and cons trade-offs between performance & dazzle for many things (like lights or visportal placement); so it's good to think about the best performance-dazzle balance for your scene. E.g, lots of highpoly brushwork, lights, & AI can look good in a small or medium room, but may not be worth the performance hit in a big courtyard, and try to find ways to get better performance "for free" without the player noticing anything missing, like smart use of noshadows, monsterclips, and interleaved thinking distances.
Gameplay Issues that Mappers sometimes Overlook
Below is a list of common gameplay issues that players sometimes complain about and that mappers & testers sometimes overlook or should at least be aware of.
- Players find it very difficult to frob objects (loot, keys, readables) when the frob distance is set too short or the space is awkward (like in a drawer or up on a wall, etc). In testing, please double-check that every frobable object is easy to frob from a comfortable place, and increase the frob distance if it's not, erring on the side of more space. (See the question on making frobbing easier under "Handling Objects" below for more information.)
- Objects can get stuck into brushwork while moving them around.
- Players can get stuck in narrow spaces and can't mantle out, so try to avoid this kind of geometry if possible.
- A very low ceiling can prevent hitting AI with a BJ, so try to avoid it when AI are around.
- Make sure AI have a flee path.
- Some players would like the ability to drop used keys and other inventory items, done by turning the can_be_dropped property to true, unless for gameplay reasons you don't want to.
- Some players don't like long readables that don't get to the point. At least be conscious of how your readables read to a player.
- Think about how you want to handle non-functioning doors (or other "unnatural" situations like windows that can open) in a way that visually or fairly communicates to the player that something is special about this door or window, but isn't too immersion breaking either.
Issues with Objects
Q. My streetlight, candle, lamp, light-creating object, causes a weird shadow I want to get rid of.
A. Put the spawnarg "noshadows" "1" on the offending object.
AI Issues
Q. My AI will not pass through a visportal no matter how I set up the path nodes.
A. Check that the sides of the visportal use the nodraw texture (except for the portal-face itself of course).
Q. How do you get AI to walk on complex terrain patches or func_statics?
A. You can always lay down invisible monsterclip brushes and the AI can walk on it. Overlay with a brush with a "material" clip texture so it causes the right sound for footsteps.
Problems with Patches
Q. I have 2 curved patches and they're not aligning. What do I do?
A. See this wiki page Patch_Troubleshooter.
Q. My patch is rendering strangely, like fractured into slivers.
A. See this wiki page Patch_Troubleshooter.
Issues with Lighting & Sound
Q. Some of the parallel lights I use for moonlight aren't giving off any light.
A. This is a known problem with parallel lights. For some reason in some arrangements you get no light at all. Just fiddle with it a bit - move it slightly, change the radii, move the vertex a bit - and it should suddenly work. Once you've got it working then it's stable. Likely the code chokes on certain values in its calculations. ... Also, to help optimize your moonlight, you should adjust the radius so it's only as big as it needs to be. You may also want to move the actual position of the little moon cube in the skybox to match the parallel light (and make sure to fix the texture on it if you mess it up - hint: lock textures before moving cube to make it easy)
General How-To Editing FAQ
Dark Radient Questions
Q. How do I see all the default properties already on an object?
A. In the entity inspector there's a checkbox near the top that says "Show Inherited Properties". Click that box.
Q. What are some basic units, scales, limits, maxs, and mins of various things when editing?
A. A list of all these things is here: Limits,_Max,_Min,_Stats,_etc.
Q. Can I manipulate brushes to resize and reshape them?
A. Yes. In DarkRadient you can select a brush and push "V" to select verticies to drag and resize, "E" to select edge(s) to drag and resize, and "F" to select face(s) to drag and resize. "Ctrl+#" makes a selected brush be #-sided. You can also use the Brush>Prism and Brush>Cone to convert a brush to those shapes.
Q. What are some common DR shortcut commands?
A.
- "H" hides selected items.
- "I" inverts selected.
- "Ctrl+I" inverts a patch's normal.
- "J" brings up entity list.
- "Ctrl+K" makes 1st-selected-entity "target" 2nd-selected-entity.
- "L" brings up light inspector.
- "Ctrl+L" brings up the Layers menu.
- "N" brings up entity inspector.
- "T" brings up texture browser.
- "X" go into clipper mode.
- Brush manipulation modes: are "R" rotate brush, "Q" free-move & resize, "W" translate-move.
Q. How do I make my own shortcut key commands?
A. Under the Edit menu, at the bottom is "Keyboard Shortcuts" which allows you to set your own shortcuts.
Q. I screwed something up! What do I do?!
A. Ctrl+Z undos. Ctrl+Y redos.
Q. Is there a way to organize & simplify building, so I can build one section at a time without other sections getting in the way?
A. DR has a Layers function that lets you build one "layer" at a time (open with ctrl+L or View>Layers). It also improves DR performance, which is handy as the map gets bigger.
Q. How do I set up things like the pre-game shop, the player inventory, and an in-game map?
A. All these things are described in the Startpack Mappers' Guide: Startpack_Mappers'_Guide#Ammo.2C_Weapons.2C_Player_Tools.2C_Start_Inventory, Startpack_Mappers'_Guide#Purchase_Shop, Startpack_Mappers'_Guide#Adding_an_In-game_Map_to_your_FM
Q. How do I put spawnargs on def_attached entities?
A. You can put spawnargs on def_attached entities by using the spawnarg "set SPAWNARGNAME on ATTACHMENTNAME" "value" on the base entity. Here's an example of setting a color property on a flame attachment to a torch "set _color on flame" "0.2 0.2 0.9". Read more here Combined_light_entities#Setting_spawnargs.
Q. What's an easy way to find materials in DR?
A. Tip to help find materials in Dark Radiant's materials browser:
- Point to Textures (or any tree).
- Shift + Right key to fully open the tree.
- Type the key letters of what you want to find.
- Up/down arrows to go to next/previous occurrence.
- Esc to get out of input field.
Oh yeah, avoid F3 because that is likely to switch to render mode which in my case crashes DR (but may not if the map is small).
Q. How do I make an N-sided brush?
A. A quick way to make an N-sided brush is to highlight the brush and push cntl+N (N being the number of sides for the top face). So if you want a 5-sided brush, highlight it and push cntl+5. But the best way to get the walls of a multi-sided brush to line up seamlessly is still to use the clipper-tool and precisely cut off a slice. (And don't use CSG Subtract unless you know what you're doing and aren't creating a million splinters!)
Console Questions
Q. How do I open the console?
A. Open the console with ctrl+alt+~ in a normal game, and just ~ when playing through "map".
Q. How do I scroll through the console output?
A. Use the mouse wheel or PageUp/PageDown.
Q.What's a list of all the Doom3 Console Commands and CVars?
A. A list of all commands & Cvars is here [1]. Darkmod Cvars are listed here Cvars_in_The_Dark_Mod.
Q. What are some *useful* console commands and cvars for editing?
A. Here's one list: Console_Useful_Controls. Here's a list more tailored to mapping:
Commands:
"dmap <name>" compiles a map, "give <name>" gives the player an item, "god" player cannot be harmed, "killmonsters" takes out all AI "map <name>" loads a map to play, "noclip" lets the player go through objects and walls, "notarget" let's the player be invisible to AI, "reloadDecls" will reload material defs without having to re-start TDM, "reloadimages" does the same for lights and "reloadSurface" for surfaces, "saveRagdolls" saves the positions of all ragdolls to the .map file (see the FAQ under Handling AI), "teleport <name>" teleports the player to an entity. "tdm_show_loot" Shows loot. "spawn <name>" spawns an entity: spawn atdm:weapon_blackjack spawn atdm:weapon_shortsword spawn atdm:ammo_broadhead spawn atdm:ammo_firearrow spawn atdm:ammo_gasarrow spawn atdm:ammo_mossarrow spawn atdm:ammo_noisemaker spawn atdm:ammo_ropearrow spawn atdm:ammo_waterarrow Append "inv_ammo_amount 50" to any of the above to spawn 50 arrows at once: spawn atdm:ammo_broadhead inv_ammo_amount 50
Cvars (1 turns on, 0 turns off, unless otherwise noted):
"com_showFPS 1", "r_showLightCount 1" (colors shows the number of lights hitting a surface, black = 0, red = 1, blue = 2... etc), "r_showPortals 1" (red=closed,green=open) If your portals dont show up they are most likely not sealing. "r_showTris n" (n=1) Shows tris rendered directly, (n=2) shows overdrawn tri's, (n=3) shows all tri's, direct and indirect.
Objectives
Q. How do I set up a put-object-here objective?
A. Instructions are here [2]
Q. How do I set up a "ghosting" objective (e.g., you are busted if you are seen.)
A. Instructions are here [3]
Handling Objects
Q. How do I attach a door handle to a door?
A. Just position the handle and input "bind" and the door entity ID/name as a spawnarg.
Q. How do I make an object into loot?
A. Instructions are here [4]
Q. How do I make an entity frobable?
A. See the entry for Making an Entity frobable.
Q. Ok it's frobable, but doesn't fall or move. How do I make an entity act like a world object?
A. You need to make the object a moveable, see Moveables.
Q. How do I get a lever or button to open a door?
A. Instructions are here [5]
Q. How do I put some text on a sign or wall?
A. You can use this method [6]
Q. How do I bind something to a rope (like a body) so it doesn't fall?
A. Dynamic ropes are unreliable, so it's good to use a func_static like a chain or make a func_static rope from a cylinder brush. For a ragdoll, place the ragdoll so he clips into the func_static. You need to bind the ragdoll to the chain (so the spawnarg is on the ragdoll), with "bind" "func_static_...", where func_static_... is the chain. Or, through DR, you can just select the entity you want to attach (the ragdoll), then also select the thing you want to attach it to (the chain), and in the menus select "Entity" - "Bind selected entities". But it's been reported the clipping does the job, not binding. See this link [7]
Q. How do I make something switch from frobable to unfrobable like a used lever, or unfrobable to frobable like contents in a chest or drawer you don't want frobable until it's open?
A. Make a brush around the object with a clip texture and convert it to an atdm:target_set_frobable entity, with the property "start_frobable" 1 or 0 (which mean true or false) depending on your case (it affects everything inside), and a triggering entity, such as the lever or the chest itself, that targets the set_frobable entity that triggers the switch when it's frobbed. For the record, you can also switch the frobability of an object in a script with the command: $<entityname>.setFrobable(n);, where n is "1" to make it frobable and "0" for unfrobable.
Q. How do I make breakable glass?
A. Instructions are here [8]. You basically convert your glass brush to a func_fracture entity and set the "health" spawnarg to the value you want the glass to break at.
Q. What about an object that gets increasingly damaged-looking as you hit it?
A. Use a func_damagable entity, which replaces its model and/or shader with increasingly "damaged" versions (as many stages as you like) when its health goes below the threshold you set with the "health" spawnarg, and you can use "target" to trigger something when damage occurs (such as a sound effect or event). See here for details on the spawnargs involved in setting it up: [9]
Q. How do I make an object that you can frob and it does something or something happens?
A. If it's an object you made from patches or brushes, make it into a frobable func_static, or if it's already a func_static, make sure it's frobable (Making an Entity frobable). Then give it a Frob response whose effect is a trigger, and give it a "target" spawnarg to the entity that causes your effect when triggered.
Q. Can a lever or button target multiple entities?
A. Yes! Use the spawnargs "target1", "target2", "target3", etc, with each entity-target as a value. A quicker way is to use the keyboard shortcut Ctrl+K. Select the button or lever, then select the target-entity and hit Ctrl+K. De-select the target-entity then select the next one, hit Ctrl+K again. Each time adds a new target to the switch. (Many other spawnargs allow you to have multiple entries by numbering them, such as bind and def_attach.)
Q. How do I make a rotating entity, like a fan?
A. Instructions are here [10]
Q. How do I make objects non-solid so they still render but the player can walk through them?
A. Add the spawnarg: noclipmodel 1 to turn them into non-solids.
Q. How do I make a firefly or will-o-wisp, basically a glowing ball that floats around?
A. This is a rough explanation to help you get started. A firefly is a func_emitter. Click the model property then use the button bottom right to select a suitable particle effect, possibly tdm_glare_lamp_01.prt. Bind to something invisible that will move it along a path, typically a func_mover with nurb curves used as the path. A tutorial for setting up nurb curves is here [11].
Q. How do I trigger an event from something in the player's inventory?
A. give the object a "target" to trigger and also the property/value: scriptobject InvTriggerScript. If your object does not already go in the inventory then use the entity: items > custom > atdm:moveable_custom_item. If you get a collision model error then ask on the forums for help (or read the wiki entry for Moveables).
Q. How do I teleport an entity?
A. Use targets/atdm:teleport. See this wiki page Teleporting_entities.
Q. How do I make a custom inventory item with its own inventory icon graphic?
A. See this entry A_-_Z_Beginner_Full_Guide_Page_6#Special_Items for setting the inventory category, loot type, inventory name and inventory icon. To repeat the instructions for a custom icon: on the object put the property "inv_icon" with a value "guis/assets/hud/inventory_icons/<name>.tga" (substitute whatever name you gave it for <name>), and package your .pk4 to put your image file in that relative location. You can also see other inventory_icons there and can use an existing one, or package your .pk4 to replace an existing one with your custom one. A method for making an inventory icon is described here [12] (be sure to use an alpha channel to make the background transparent, tutorial: [13]).
Q. How do make an object that's hard to frob easier to frob?
A. One easy way is to add this property: frobbox_size 5. If it's still hard, see this post for other things you can do. [14]
Q. How do I make a candle you can pinch to go out?
A. I made a bunch of pinchable non-moveable candles into my WIP like this:
- Make a func_static candlestick. place light source entity candleflame on it.
- Give the candlestick "frobable 1."
- Give the candlestick S&R response frob, extinguish light and candleflame name.
- You can optionally add another response frob to trigger a speaker with a "snuff" sound effect.
- Done.
You can copy the entity bunch around and all the params should update correctly for the new replica. Frobbing will not relight it: the player needs to relit them with a flame source.
Handling AI
Q. How do I make sure a guard can unlock a door?
A. There are a few different ways, explained here [15]
Q. How do I attach a key or purse to an AI's belt, or similar kinds of attachments?
A. The easiest way is with "bind". Place the key or purse around the belt area where you want it, sticking a little farther out than usual, and rotate it as desired. On the key add the property "bind" with the value of the AI's entity-ID or name, then the property "bindToJoint" with the value "leftHips_dummy" or "rightHips_dummy" as needed. For attaching things in other places (like a ring or hat or necklace), it's the same general principle but you should look up the joint to attach to. A list of all the joint names is here: BindToJoint. See this wiki entry for more info Attaching_Items. For another method using def_attach see Attaching_Props_to_AI, and this post for an example of the spawnargs involved [16]. The issue with def_attach is that the attached thing spawns at its own rotation angle, which might not look great and is tricky to change (if you insist, see AI_Attachment_Ingame_Editing and Cvars_in_The_Dark_Mod#Attachment_related). With bind you just place and "bind", and it stays where you put it.
Q. What about other kinds of attachments where special animations are involved, like torches and weapons?
A. For these you want to use Def_Attach. See this wiki entry Attaching_Props_to_AI. For heads & weapons specifically see this wiki entry Adding_Heads_and_Weapons_to_AI. (You can set spawnargs on the def_attached entities with the method described here Combined_light_entities#Setting_spawnargs.)
Q. How do I mute an AI?
A. Give the AI the spawnarg: def_vocal_set atdm:ai_vocal_set_mute. If you only want to mute some barks, you'll have to modify the AI's .def file by hand, taking or commenting out the barks you don't want, and packaging the new def file in your mission's pk4. For coughing and animation based barks, see this post [17]
Q. Can I hide an AI until I trigger him?
A. No, the spawnarg "hide" doesn't work well with AI (they're made invisible, but still audibly there). Put the AI in a blueroom and use a teleport instead, or a teleporting script command. See the wiki entry for Teleporting_entities. Note, after teleporting an AI, pathing becomes a problem for it. See this post [18] and the previous posts on this issue to make sure the AI can path properly after a teleport.
Q. How do I manage AI teams, who is a friend, enemy and neutral?
A. To set the teams, see Relations. If you want to trigger a change in team with a script, see AI_Relations_(Scripting). Another method to switch AI teams using S&R (stim & response) is described here [19] and see the entry Stim/Response.
Q. How do I make an AI play an animation when I want?
A. Instructions are here [20]. There may be other ways possible.
Q. How do I set or change the health of AI?
A. AI use the spawnarg "health" to set their hit points. To change it in-game, use a script and the function "setHealth".
Q. How do I pose ragdolls so they look naturally placed?
A. Save a backup, pose all the ragdolls in-game, then use the console command saveRagdolls which saves their positions to the .map file. cf. [21].
Q. How do I make a scene of AI playing cards?
A. Probably the easiest thing to do is load the prefab (under AI), place it, and adjust it how you want.
Q. How do I make an AI frob something?
A. To get an AI to frob something, eg, a lever (doesn't work to pick up and carry) create a path_interact entity. You can include it in a normal pathing patrol. Give it these 2 spawnargs: ent <name of entity you want the AI to frob>; target <next path entity (if any)>. Note that the AI won't walk to this entity; you have to use a path_corner to get him where you want then target to the path_interact to get him to frob.
Q. How do I make an AI catch fire?
A. You can bind some unlit fires to an NPC (like a zombie) and shoot it when a fire arrow, he'll erupt in flames, but the flames won't damage him. You could also light him with a candle. I'd bet theres some way to make that actually kill the creature, or at least cause it damage. ... One improvement suggestion: When the the light gets the fire stim, target a trigger multiple, which delays for a 120-240 seconds and then turns the fire off. You could make the fire damaging by starting a trigger timer which applies the stim damage to the target every few seconds. Remember to switch off the timer when the flames are doused.
Q. How do I keep an AI ragdoll from sinking into the bed model, e.g., if he's KO'd?
A. I found one way to keep [an unconscious/dead ragdoll body] from sinking into the model below it is to use a platform of nodraw_solid underneath the body. You should be able to place such a brush within the bed model and test it with a ragdoll on the bed. Adjust it's top surface height until the body lays just on top of the bed (then delete the ragdoll)... then a blackjacked AI should be able to stay on top of the bed like the ragdoll did.
The Player
Q. How do I do things with the player's inventory, like trigger an inventory item to be deleted, or an item to be added to the inventory, or one item being replaced with another item?
A. You can do all these things with a script (read A_Beginner's_Guide_to_Scripting and the scripting FAQ below to learn about scripting). Have your triggering mechanism trigger a target_callscriptfunction entity which calls a custom script, then use the appropriate script command in the script on $player1. A list of the commands is here Inventory#Scriptsupport. Useful commands are (replacing the "Item" variables with the item ID): $player1.addInvItem(inv_item); and $player1.replaceInvItem(oldItem, newItem); (note: If <newItem> is the $null_entity, <oldItem> is just removed and no replacement happens.) For example, to remove a key from the player's inventory, use a command like: $player1.replaceInvItem ($key, $null_entity);
Q. How do I teleport the player?
A. Use base > info_player_teleport. Give it the spawnarg and value: target info_player_start_1. Give it the spawnarg: angle with a value if you want to force the player to turn to face a particular direction.
Q. How can I simulate a crawl for the player to pass under things like tables that he couldn't normally do?
A. See this post [[22]]
Scripting
Q. How do I make a custom script?
A. First read A_Beginner's_Guide_to_Scripting, Scripting_basics, and My_first_map_script to learn the basics of scripting. You write a custom script as a text file named <mapname>.script and packaged in your .pk4 in the same place as your .map file. Inside it you make your own script object in the format the Beginner's Guide gives you, usually looking like void MyScript() { code goes here }. Then the game can "call" "threads" of that "script object" that will run until they end or are killed, so you can have more than one thread running of the same object concurrently. If you want multiple script objects, put them all in your <mapname>.script file and the game-engine will find them. You run scripts by the object name, not the file name.
Q. How do I run a script in-game?
A. A few common ways of calling a script object thread in-game are
- creating a target_callscriptfunction entity with the spawnarg: "call" "<name of your script object>", then creating some other entity (such as a button or trigger brush) that "targets" that entity;
- creating a button with the property "state_change_callback" "<script object>", which runs the script when pushed or triggered,
- Using Location_Settings#Script_calls to call a script when you enter or leave a location;
- triggering a script with the Objectives_Editor when you fulfill or fail an objective (possibly a hidden objective only for triggering the script);
- A script can call another thread in itself with the "thread" function; see the command in the link below.
- An entity can call a script when it spawns. Add a property/value either in the .def file or as a spawnarg on the entity: "ScriptEvent void <script object>(<parameters>);".
- The script "void main();" is always called at game start. So if you add code under that heading in your script file, it will run at game start.
There are other methods too. (Note, if you call a persistent script, i.e., it runs all game, be especially sure to avoid performance hits, or make it non-persistent if possible, that is, you "kill" it at some point in the game so it doesn't hog resources..)
Q. What are script events (aka commands or functions)?
A. A script event is a pre-made object that does something for you, usually to some game item you specify, just when you write it in your code (like $item.eventX(); does X to item). Sometimes it wants parameters or arguments to run (the stuff in parentheses) and will give an error if you don't put the arguments in the parentheses in exactly the way it wants, with the right number of them & right data types, etc. And some of them return values too, especially the "get" functions, which are handed over to a variable (e.g., X = getValue();, now X has the value. If X is an entity, you can even act on X as if it's the entity itself. Just be sure the data type of X and Value are the same, e.g. float, or string, or entity, etc, or you'll get an error).
Q. What are some common or useful script events for editing?
A. A list of all Doom3 and TDM script events are listed in two files (open with a text editor): scripts/doom_events.script, scripts/tdm_events.script. Proper syntax for the Doom3 events is here [23]. Note that TDM has some of its own script events, like setFrobable (in the tdm_events.script list). A quick list of common or useful script events good for editing is here: Script_Events_User-Friendly_List, with syntax and description, and including TDM events. It doesn't list all script events and all details, just common & useful ones for actual mapping IMO.
World Building
Q. What's a good way to make caves?
A. Some tips are here [24] & [25]
Q. How do I make a good looking roof using clean brushwork?
A. See this method as a good example [26]. It can be better to "cut out" a roof from a square brush using the clipper tool than to rotate brushes to make it by hand.
Q. What's a good way for making a forest or a big outdoorsy area?
A. One good method is making large "rooms" in the shape of a big oval cylinder with very high natural-looking "rocky" & skybox walls and uneven ground using patches, filling it with trees and hiding some of the walls behind trees and greenery (you could also fill it with thick cylinder brushes of different sizes with bark texture to look like more trees, and place branches coming off them or to make a canopy), and possibly filling it with tons of grass (using SEED) and rocks and streams, with visportaled openings at "kiss points" in the walls to other large oval rooms at different orientations (maybe 2-5 connections per oval) so there's a dense web of interconnected forested rooms that (sort of) appear to be one big dense forest to the player. Some useful things to use are the Object_detail, SEED, and LOD systems.
Q. How do I make uneven ground?
A. One method is by burying patches into the ground that stick out and make the ground lumpy as described here [27]. For more encompassing unevenness, you can use much larger patches laid over square caulk brushes underneath that seal the leaf to make the entire ground uneven.
Q. How do I make a natural looking road where there isn't a sharp seam between the road material and grass but a nice fading transition?
A. See the Wiki page for Roads.
Q. How do I make curved ceilings and archways?
A. Use patches. Here's a list of some good tutorials for this sort of thing [28]. Also look at this wiki page Patches#Archways.
Q. What's a way to get good-looking fog in my mission?
A. There are numerous values to make good fog. The setup for the fog from Fidcal's Heart mission is here [29].
Q. What are some tips to making a better looking map?
A. See this wiki entry 10_Simple_Tricks_for_Better_Looking_Maps.
Q. What's a good method or plan-of-action for building?
A. This is a matter of personal preference, but a method that professionals use is called the "stepwise refinement" method. It means you build the *entire* space of your mission first in rough blocks (so you have it all planned out first), then refine the whole thing in increasingly more detailed steps section by section, leaving the most fine detailing towards the end. It can help to use DR's Layer system to organize your building by sections too, without other sections interfering. Also, when you're drawing your map, think about arranging space into winding "rooms" (so there's no long lines of sight), even outside with tunnels, walls and skybox; and think about visPortal placement right at the start. Also think about the gameplay-performance balance of shadowing-lights & AI when thinking about placing them.
Q. How do I cleanly connect two brush edges meeting together, especially at a diagonal?
A. See this post [[30]].
Q. What's a method for building very fast & efficiently?
A. Sotha came up with "modular" approach where you build a few stock modules of architecture that you can combine to make a lot of geometry very quickly and efficiently. Here's his description: [31]
Patches!
Q. Is it possible to split patches?
A. See this tutorial on it Patch_Splitting_-_Basic_Tutorial.
Q. How do I bend patches?
A. See the instructions at Patches#Bending_Patches.2C_Curves.2C_L-shapes.2C_etc (Here's another small tutorial in a post [32].)
Q. I want to use a patch to round off a corner.
A. See this part of the Patch wiki page Patches#Round_and_Soft.
Q. How can I make a perfect circle with patches?
A. Select verts of 4 corners, select the "rotate and scale" tool, and use the value "0.9428" to scale "up" (actually down) in the 2 corresponding axis of the scale tool. See this post [33].
Q. How do I make a dome or sphere?
A. Make a cone patch and drag down the top vertex to form a dome. Invert the matrix if you want an internal dome or thicken if you want it to be visible inside and out. A sphere is just two of these stuck together. Also tweak the tesselation in patch inspector if it is too chunky. You can have fun with the textures though; try fit. If you totally flatten the dome you have a disc which can produce some nice texture effects, eg, the marble floor centrepiece or a round rug. Drag a side to make it oval. See this post for a picture [34].
Q. How do you align a texture on a curved patch?
A. When you want to align properly texture to curved patch like this one in the image [NB: image is missing], divide a brush according to the angle of the patch then use it's shader for your purpose. ... I made it with one edge is at one end of the curved patch and the other edge is at the other end. It gets distortions without this way.
Events and SFX
Q. How do I trigger an earthquake event?
A. Earthquakes can be done with a speaker. Just use the spawnarg "s_shakes" "1" on the speaker, and the screen will shake violently however loud the sound gets.
Q. How do I emulate something like a blizzard or dust storm?
A. Doom3 made a dust storm area, and the same method can be used to make a blizzard, so it's possible. I'm leaving this here to look up instructions for future reference.
Q. How do I make the screen fade to black (or some other color), or from black back to the game.
A. Trigger a script with the functions fadeIn [35], fadeOut [36], or FadeTo [37].
Textures
Q. What's a quick way to align textures between two surfaces?
A. For two brushes, select the first surface, then edit --> copy shader, then click on the second surface and edit --> paste shader. This will seamlessly match the 2nd surface to the texture of the 1st. DR also comes with a useful tool for texture alignment, Texture_Tool, which you bring up with Ctrl+Alt+T. If it's textures on two patches, you can follow these directions: [38]
Q. How do I randomize the position of textures on multiple brushes, e.g., for a row of stairs or pillars all with the same texture that I want to look different?
A. Select multiple faces and in the surface inspector, press the natural button once you set the scale properly.
Q. Can I blend textures?
A. Yes. This is particularly good for dirtying some textures up by blending in a grime texture. You can blend textures with a custom material file. Link to instructions coming. Also see the entry for Basic_Material_File.
Q. How about blending texture transitions so there isn't a sharp seam, e.g., for a dirt path in grass?
A1. DR comes with grass edge transition decal patches to overlay the hard edges. Read how to set it up here Grass_Edges, or a more detailed tutorial on making roads here Roads.
A2. In NHAT blended terrain was made from patches broken into segments then exported as ASE models. Then the models were vertex painted in Blender and imported back into Dark Radiant. See this tutorial DrVertexBlend_(tutorial).
Q. How do I set the color for some textures (like glowing mushrooms) and make lightbulbs go dark when turned off?
A. "Colorme" textures allow you to set the color with a spawnarg. So e.g. for colored mushrooms, choose a colorme skin with the spawnarg like "skin" "mushroom_selflit_green_colorme" and choose the color with a spawnarg like "_color" "0.24 0.50 0.40" (where the value is the RGB values you want). For lightbulbs you can trigger a colorme texture switch with the lightswitch (so it switches between "lit up" and "black"). Instructions on that coming.
Q. What's a fast way to put different textures on a lot of objects?
A. 1. Click the mouse wheel on the texture to copy it. 2. To paste it naturally (i.e., in a random position): shift+mousewheel click. 3. To just paste it: ctrl+mousewheel click.
Q. Can you tile a texture a specific number of times to fit a surface?
A. When you want to tile a texture a certain number of times, enter the values 1/X and 1/Y (you need to compute them in your head) in the little boxes in the surface inspector, then press "Fit". It will tile your texture horizontally X times and vertically Y times. You can also enter things like "2" and "1" and get a texture that only occupies half of the width. You can then use the "Right" or "Left" buttons to align it quickly at the ends. Pro-tip: Press CTRL+ALT+T to open the texture tool, it allows super quick aligning of textures on patches. Esp. useful for decals where the decal texture consists of multiple decals.
Readables & GUIs
Q. How do I put custom art in a book or scroll, like a picture?
A. Use a custom .gui. Here's a rough idea to get you started [39]. I'll try to put better instructions in later.
Q. How do I trigger a text message to pop up and say something?
A. Create an entity: darkmod > targets > atdm:gui_message and give it the properties/values that you want. Popups will explain each one. You can target it with a triggering entity or trigger it from a script or any other triggering mechanism. An example is here [40]
Lighting and Sound
Q. How do I add music or ambient sounds? Q. Can I dynamically adjust the ambient lighting?
A. For both of these things, check out the article for Location Settings
Q. How do I set up Reverb (EAX) settings for my rooms? (E.g., the echo of a large hall, etc.)
A. Create a text file and name it <mapname>.eax; place it in your .pk4 with your .map file; and in it create entries by location name with the values you want for that location. See this wiki entry to see the format & values Setting_Reverb_Data_of_Rooms_(EAX).