A - Z Beginner Full Guide Page 6: Difference between revisions

From The DarkMod Wiki
Jump to navigationJump to search
Line 76: Line 76:
===Placing Loot===
===Placing Loot===


We need to place some loot around for the player to find and complete a couple of objectives. Creep is a thief so might have various valuable items stashed away but other stuff he might just leave lying around. Look in the entities under darkmod/atdm/loot and pick a few appropriate items. It's a tiny demo mission so we probably need to seed it more thickly than normal with plenty of loot. In particular we need a scepter for the main objective. This can be found in the entities at atdm:loot_scepter so put this in the best hiding place you can make.
We need to place some loot around for the player to find and complete a couple of objectives. Creep is a thief so might have various valuable items stashed away but other stuff he might just leave lying around. Look in the entities under ''darkmod/Loot''; you will see there are subsections ''Moveable'' and ''Static''. Many loot items are in both lists. The ''Static'' ones will remain fixed at its start position so might be used if you don't want the item to be nudged or for say, a magical floating gem or a gold plate 'hanging' on the wall. The ''Moveables'' will fall from where you place them to the nearest surface below once the game starts and they can be knocked or nudged down a drain etc so keep that in mind. Both just go into the inventory as loot once frobbed by the player.
 
Go ahead and pick a few appropriate items. It's a tiny demo mission so we probably need to seed it more thickly than normal with plenty of loot. In particular we need a scepter for the main objective. This can be found in the entities at atdm:loot_scepter so put this in the best hiding place you can make but not so difficult as to annoy the player.


===Special Items===
===Special Items===

Revision as of 18:57, 11 March 2008

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

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


More Sounds, More Atmosphere

We have already covered this in the section on rainfall so we are doing the same thing but this time to add tension as the player enters the house...

  • Clone one of the speakers from the yard. Dark Radiant will automatically rename it. Occasionally two entities might get the same name when cloning and you will get an error when you try to play the map. If that happens you just have to rename it manually to whatever you want. No worries - but just be aware.
  • Give it the following properties...
  1. s_volume 1 = loudness
  2. s_mindistance 0 = start fade distance
  3. s_maxdistance 8 = fades to nothing here
  4. s_shader sound/ambient/ambience/mansion_tense_02.ogg = sound file. try also 01a and 01b (sounds can also be selected at the bottom of Entity Inspector when this property is selected.)
  5. s_looping 1 = plays repeatedly

Place the speaker in the middle of the big room. Check it vertically also to be half way up. Clone it and put it in small room too.

Save and try it out!

Portalizing: Visportals

Portalizing defines which areas of a mission are to be rendered at any time so as to avoid unnecessary rendering. Without it a big mission would grind to a halt. Our little mission could manage but even here, if you put in torrential rain you will find it slowing down on many PCs. Portalizing won't help out with the rain but it will improve performance indoors; why waste processing time on the rain when you can't see it?

To divide up the mission for rendering we use 'visportals'. These are simply brushes with one surface having a visportal texture. Full details of visportals are at Visportals and you should eventually get a good understanding of them. For now, this is how and where we shall put visportals in this tutorial mission...

  • Make a thin brush like a wall 4 units thick and about the size of a door.
  • Give it the texture common > nodraw all over.
  • Give it the texture editor > visportal on one of its big surfaces. This is its active surface which you should focus on when placing the brush.
  • Place it so the visportal surface is inside the yard door and fits the gap in the door frame (no gaps.) Technically it does not need to be inside the door but only need its visportal surface in contact with any part of the door but in this situation that's the most convenient place. Being in contact with the door will close the visportal when the door is closed so no rendering will take place of the outside when you are inside and vice versa. Even if the door is open it will still close itself if you pass through another visportal and round a corner.
  • Clone it, turn it 90 degrees, and place this one close to the old door to the little room. But here, the old door has holes. If the visportal connected with it then when closed the gaps in the door would go black. This would be true of a iron barred gate or portcullis or a glass windowed door etc. So place the visportal so its active surface is tight within the doorframe but not in contact with the door. It is still worth having because it will still work as an auto-visportal as you will see.
  • Clone again and tilt it over and put this one in the gap to the upstairs. Cut right through the ladder. I didn't expect this to work with the ladder entity poking through but it does.
  • Clone again and put this one just below the elevator platform. I left a gap between elevator entity and visportal surface. I'd have to check to see if it would be disabled if they contacted.
  • Clone again and resize this to go in the middle of the yard - right up to the sky and wall to wall. It should be placed at that protruding corner near the door so it crosses the yard from west to east. There must be no gaps.

Save, dmap, map and try it out. If you have torrential rain then you should notice a big difference when you go inside and close the yard door.

Now, try this, in the console type and enter r_showPortals 1 and back in the game you should see your visportals as green or red wireframes.

  • First make sure every one is working - that it is either red or green when you approach it (you won't see the ones too far away at all that's OK)
  • Now check they are working correctly...
  1. From the south end of the yard looking north with the yard door closed you should see the big yard visportal green and the door one red.
  2. Now open the door and the door one should turn green.
  3. Still without looking in through the door you should see the upstairs one and the old door one and maybe the elevator one two depending on your position. They will be red or green depending on your position. Move left so you see them round the side of the yard door visportal and they are red; look at them through the yard door and they should be green. In fact you should only see the elevator one if the old door one is green.
  4. Go inside and close the yard door. Its visportal should go red and if you have a monsoon out there the performance should improve.
  5. Open the yard door again and look back at its green visportal. If you are close you should see the big yard visportal outside also green if it is overlapping the door one. Now step back a few paces and to your right a little until the big yard visportal no longer clips over the door visportal. It should turn red indicating that the bottom half the yard is no longer rendered even though the door is open. Clever eh?
  6. Wander around and notice how the visportals open and close.
  7. You can also try r_showTris 2 which will show you what is being rendered at any time.

Sound Propogation

Visportals not only affect rendering but also sound propogation. Sound from the player to AI is directed through visportals and reduced if they are closed. Sound from AI to the player is also affected but comes more direct. So an AI the other side of a wall might be faintly heard. When a door in contact with a working visportal is opened further along he might be louder but the sound will still seem to come directly from him through the wall. Whereas if the player makes a noise the AI will hear it from the direction of the door and go there to investigate.

You might have already noticed that the sound of Creep and the thug in the house is reduced when you are in the yard with the door closed at mission start. And the sound of the rain is cut off when you are inside and close the door.

Finishing Decor & Furniture

Now you can finalize the appearance and add/move furniture to enhance the mission. Keep in mind this is a thief's den, a rough hideout. I see them almost as squatters in a derelict place...

I added a front door on the west wall of the big room to the north of the window. Just make a niche, fit frame and door - but make the door func_static or frobable 0 to stop it opening. It will just be static architecture like the window. Later you could expand this mission out through the door if you wanted.

I added a window upstairs and a few pieces of rough furniture. I put one of the chests up there and obscured it with a big old wardrobe and junk.

Have you noticed that convex corners that jut out like the one in the yard or window edges have ugly, mathematically-sharp edges. It is recommended that in a 'real' mission you soften them by clipping off the corner and replacing it with a bevel patch. Details are in Patches#Round and Softened Corners: Bevels and you might want to try at least one so you know how even if you don't do all the corners in this tutorial mission.

Down in the basement I moved another chest and added odds and ends, an upturned table, a coil of rope.

In the big room I stuck in a barrel, a long bench. In the kitchen some old pots, broom whatever.

In the yard some debris, an old cartwheel.

Take a look through the models and have fun!

Loot and Special Items!

Virtually all TDM missions will have loot for the player to find as an objective and often special items to find too.

Placing Loot

We need to place some loot around for the player to find and complete a couple of objectives. Creep is a thief so might have various valuable items stashed away but other stuff he might just leave lying around. Look in the entities under darkmod/Loot; you will see there are subsections Moveable and Static. Many loot items are in both lists. The Static ones will remain fixed at its start position so might be used if you don't want the item to be nudged or for say, a magical floating gem or a gold plate 'hanging' on the wall. The Moveables will fall from where you place them to the nearest surface below once the game starts and they can be knocked or nudged down a drain etc so keep that in mind. Both just go into the inventory as loot once frobbed by the player.

Go ahead and pick a few appropriate items. It's a tiny demo mission so we probably need to seed it more thickly than normal with plenty of loot. In particular we need a scepter for the main objective. This can be found in the entities at atdm:loot_scepter so put this in the best hiding place you can make but not so difficult as to annoy the player.

Special Items

Now the scepter is a special item we need to get for the main objective. If it just goes in the loot it will be anonymous - the player might not even realize they had frobbed it! So this is how to change a loot item into a special item:

  • Select the scepter
  • Give it these properties...
  1. inv_category : Special
  2. inv_loot_type : 0
  3. inv_name : Lord Frothley's Scepter
  • The inv_loot_value does not matter as it will not count towards the loot because we made it inv_loot_type : 0
  • If you want and are able you can create an inventory icon as described before at Inventory Icon and then add the property inv_icon with value : guis/assets/hud/inventory_icons/<name>.tga (substitute whatever name you gave it for <name>)

LOOT COUNT?

???

Giving AI Keys and Valuables : Pickpocketing

Objectives

Dark Mod mission objectives are very advanced but an editor is being developed to make it easy to set up quite complex challenges for the player. Do not use the earlier objectives editor (in Dark Radiant at least up to 0.9.5.) In this tutorial we shall only set up some common objectives as example by manually entering properties in an objectives entity...

  1. Steal back the scepter Creep stole from you
  2. Drop the incriminating message in a chest.
  3. Creep is a thief and must have other loot worth stealing - take at least 400
  4. Find his key and when all else is done, exit by the front door

Create an entity target_tdm_addobjectives and place it anywhere not in the void but preferably somewhere you can find it easily and add these properties and values. Do not include my comments shown in square brackets...

  • obj1_1_spec1 : name
  • obj1_1_spec_val1 : FrothleysScepter [use name of scepter]
  • obj1_1_type : item
  • obj1_desc : Nobody crosses me! Must get back Frothley's scepter Creep stole off me.
  • obj2_1_type : custom
  • obj2_desc : Pay him back! Drop his incriminating note in a chest so he won't see it till Sam tips off City Watch when I'm gone.
  • obj3_1_args : 400
  • obj3_1_spec1 : overall
  • obj3_1_type : item
  • obj3_desc : He's small time but Creep may have good stuff stashed he can't fence yet. Shan't leave without at least 400 loot.
  • obj4_1_spec1 : spawnclass
  • obj4_1_spec2 : name
  • obj4_1_spec_val1 : idPlayer
  • obj4_1_spec_val2 : exitLocation
  • obj4_1_type : location
  • obj4_desc : Find Creep's front door key. That's my way out when done.

By default they are all incomplete, visible, mandatory, and reversible (so UNdoing an objective will UNcheck it.)

Objectives 1 and 3 will work automatically.

For Objective 4 you need to create a brush at the exit location and give it the texture common/clip. Then assign to it the entity info_tdm_objective_location. Give it a suitable name like exitLocation and that name must be used in the objective property. When testing, experiment with the best position for the brush so it triggers timed for the best effect.

Strictly speaking, Objective 4 should only be completed if 1, 2, and 3 are done first but I can't see an easy way to do this at the moment so for now it can be left as a location example and because it is by default, reversible, if the player goes there early then the objective will check off but the mission will not complete and the player has to return (when that objective will UNcheck.) Not ideal but simple (in the released Thief's Den I used a system too complicated for this beginner's tutorial.)

An info_tdm_objective_location entity might also be used for Objective 2 but at the time of writing we found this too imprecise for something as small as dropping a message in a chest so for this we shall use a stim response (see next section.)

First we create a target_tdm_setobjectivestate entity. Place it somewhere you can find it such as near your target_tdm_addobjectives. Give it a name such as SetObjective2Complete. This objective can now be completed by any trigger that targets this entity and as said, we shall use a stim response in the next section. Add these properties to it...

  • obj_id1 2 [defines Objective 2]
  • obj_state 1 [defines the required state of the objective after triggering as complete]
  • wait_for_trigger 1 [makes the entity wait for a trigger]


For more on objectives see Objectives


Stims and Responses

Stims and responses are used to trigger events when one entity comes into the vicinity of another, for example a water arrow in the vicinity of a flaming torch will trigger it to be extinguished. A stim provides a named stimulus with various properties on an entity and a response of the same name on another entity will be triggered if it comes within range of the stim, producing various effects. You can have multiple responses to the same or other stims on the same entity. Dark Mod S & R are very advanced so we shall just describe one example here to complete the objective where the player has to drop an incriminating message into a chest.

Although stim and response properties can be added directly in the entity inspector there is an excellent s & r editor built into Dark Radiant which we shall use.

Before you begin this you should have created a target_tdm_setobjectivestate entity named SetObjective2Complete (see the previous section on objectives.)

  • Create a small brush of about 4 x 4 x 4 and place it inside one of the chests at approximately the centre of the positions the message will be when dropped in.
  • Give it the texture common/nodraw
  • Give it the entity func_static
  • menu > entity > stim/response
  • Select the tab Custom Stim
  • Click the button 'add stim type' to create a new custom stim with the default name CustomStimType
  • In the Name box change its name to IncriminateStim
  • Select the Stims tab
  • Click the downward pointer in the Type box and all available stims will show.
  • Select IncriminateStim
  • Check the checkbox at the left of the Radius input.
  • Enter 5.0 as the radius
  • The other fields can be left blank - the 'Active' checkbox should already be checked.
  • Click OK.

Clone that brush and drag it into any other chests you have made so the message can be dropped in any of them.

Now we add the response to the message entity...

  • Select Creep's message - the one you created under the readables section.
  • menu > entity > stim/response
  • Select the Responses tab.
  • Click the downward pointer in the Type box and all available stims will show.
  • Select IncriminateStim
  • With IncriminateStim highlighted, double click in the big window on the right headed Response Effects.
  • In the popup menu select the downward pointer in the Effect field.
  • Select Trigger.
  • Select the downward pointer in the Target field and select SetObjective2Complete (or type or paste it in.)
  • The Activator field should be left blank and the Active checkbox should be checked.
  • Click the Apply button and the response effect should appear in the Response Effects list. Double click it if you need to edit it.
  • Click OK

The objective will be set if the response on the message (origin point) comes within the radius of the stim in one of the chests but if the player then takes away the message the objective will remain checked. This does not make sense in the story so to prevent the player taking away the message we make it unfrobbable after dropping...

  • Make sure Creep's message is still selected.
  • menu > entity > stim/response
  • Select the Responses tab.
  • Click to highlight the IncriminateStim
  • Double click in the big window on the right headed Response Effects.
  • In the popup menu select the downward pointer in the Effect field.
  • Select Set Frobable
  • Select the downward pointer in the Target field and select CreepsMessage (or type or paste it in.)
  • The Activator field should be left blank and the Active checkbox should be checked.
  • Click the Apply button and the response effect should appear in the Response Effects list.
  • Click OK

We have created two response effects to the incrimate stim that is in any of the chests - one to set the objective complete and the other to stop the player removing the message again. You will need to test and adjust the best position of the stim brush in the chests.

This is just one simple example but you can see the possibilities and flexibility of s & r for many other tasks in your missions. For more on s & r see Stim/Response

Testing Your Mission

Zipping up

link to zip up wiki

Your own Build Design

link to build design wiki

Additional Recommended Information

All mission developers ought to read and know the following...

Performance: Essential Must-Knows

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

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