Objectives Editor
Written by HappyCheeze and Fidcal
Introduction
The objectives editor is a very useful tool located inside Darkradiant (Version 0.9.7 or later) that allows the map author to set objectives or goals that the player must do in order to win the level. The opposite is also true, the author can set restrictions that the player must adhere to, or will fail the mission.
Adding Objectives Entities
To access the objectives editor once inside Darkradiant, click the pull-down menu Map>Objectives...
Upon clicking you will see a separate window that looks like this.
To start things off, click the Button
This will create an Entity that stores all of the objectives information that will you be editing.
Now we've spawned our objectives entity,
Notice the numbers in the “[]”'s. Those are the entities' coordinates on the map. These numbers will most likely be different from yours. When the objectives entity spawns it is placed randomly around the origin (As of 0.9.7 this is how it is, it might change in future versions, but for now this is how it is).
*Note:Be mindful that sometimes this entity will spawn outside your map and into the void. This will cause a leak, so look around the origin.
Adding Objectives
Now we're ready to start adding some objectives.
Under Objectives you'll notice there's a new Objective. You can add more as needed.
Editing Objectives
Click an objective in the list than click
This will bring up this window.
Now we're editing our first objective. It may seem a little confusing at a first glance but a lot of it is self explanitory and a little practice will take you a long way.
So what do all these various lines and checkboxes do? They effect the objective components at the bottom.
What do they all mean?
Description: This what the player will read in the objectives menu. For example: “Steal the scepter”, “Don't kill any guards”, “Get back to where you entered the warehouse”. Its explaining what you want to player read so he/she knows what to do. A good rule to follow is to make them short and to the point.
Difficulty:These refer to Easy/Medium/Hard difficulty levels. If the author wishes, they can be different for each difficulty. For example: on Hard difficulty the player will have to avoid being seen. On Easy the player will only have to steal 200 gold at the minimum. All Levels means that the objectives that are checked under this will be there regardless of difficulty.
Initial State:This is the condition of the objective at mission start. There are four options. Complete, Incomplete, Invalid, Failed. Typically the objective will be incomplete and the player has to complete it in-game to fulfil the objective.
Flags:
Mandatory means the objective in question is necessary to complete the game. If it is unchecked than the objective will be optional.
Ongoing means that the objective won't show completion until the end of the mission. Use this with do NOT type objectives, eg, do NOT kill.
Irreversible means that once the objective is done it will not UNcheck even if logically in the game it becomes no longer true. Example: get a special object. If the player later drops it normally the objective will then UNcheck because the player no longer has got it. But sometimes you don't want it to reverse. Example: get magic skull. New objective: throw it in magic pool. Player no longer has 'got' the skull so normally it would then UNcheck the objective. Make it irreversible and it won't. Another example is to go to a location. If the player then leaves it would UNcheck so make it irreversible.
Visible means that objective will be visible in the objectives menu ingame. If unchecked than there will be no objective shown. (The objective will still work, it just won't show up in the menu).
*Tip: The "Visible" Box isn't checked by default yet, so try to get in the habit of checking it with each objective you want visible.
Enabling Objectives: These are other objectives that must be completed before this objective can be done. Example: "When you have completed your main objectives, escape from the castle." So, those main objectives would be the enabling objectives and if the player escapes the castle without doing them first then the escape objective does not check off either.
Logic Success: These are only needed if you have more than one type component. For example, if you can escape the castle by either of two routes this would be an objective with two go to location components. These components would be numbered 1 and 2 so the logic success would be 1 OR 2 since either would work. If however you wanted say the player to escape the castle via a special corridor then the player has to go to both corridor location and exit castle location so that would be logic success 1 AND 2. Those components need not necessarily be the same type - the player might be required to pull a lever AND escape for example (even though he could escape without pulling the lever but you don't want him to.)
Scripts: Under Construction
Components
Components: These are the type of objective you want, eg, steal, kill - or rather 'types' because each objective can have more than one (eg, go to exit A or go to exit B or it could be go to exit A AND go to exit B! - see logic success) These type components are used by the editor to specify what objectives need to be done. The map author can choose from a variety of options under Type with varying degrees of specification. For example: Knocking out an AI named "Roy". Not being seen by the ANY enemy. (less examples, should cover this in the coming up tutorial.)
Components Flags:Components have their own special flags as well.
Satisfied at Start:For some objectives it makes sense to have them done at start. For example: Not killing anyone.
Irreversible:One the objective has reached a certain state, it will stay that way and not change. (more elaboration, an example?)
Boolean NOT:Adds "NOT" to your component so the player has to do the opposite of said objective. For example: Do NOT kill any AI on team 2.
Player Responsible:The player MUST follow through with the objective himself. For example:The player must kill the zombie to complete the objective, instead of letting something else take care of it.
Now it might seem a bit crazy trying to take all of this in at once, so lets start with something easy.
Tutorial
*Note:This tutorial is assuming you've learned the basics for using Darkradiant.
You should already be in Darkradiant. Start a new map if you're in an existing one.
We'll start with the basic cube room. Nothing fancy, just make a room, stick in a player start, a light and plaster on some textures.
For this tutorial, our player is going to have to knock out a guard and steal a trophy.
So lets start with adding the AI, I chose atdm:ai_citywatch. Select him, go into the entity editor ("N") and change his NAME to "Roy" (without quotes).
Now its time to open up our objectives editor.
Now as you just learned, click add, click the target_tdm_addobjectives_1 and click add again.
The Edit Objective window should be open now. Clear the text under Description and type in "Knock out the guard". Set the initial state to 'Complete'. Check the Mandatory and Visible flags.
*Note: Although Initial state refers to the state the objective is at start, it is reversed right now and in the process of being fixed. So for now, you have to set the state to what you want the outcome to be. 9/6
Time for a new step, click the button under Components and the word "Kill" should appear. Select it and you will see some more options. Under Type select "AI is knocked out".
under Knockout target: select "Name of single entity" and type in the box to the right of it, "roy" (without quotes). Set amount to 1.
Now compare your screen to this, it should be the same.
If all looks good than click OK.
Its always a good idea to test things to make sure everything is running right. So save your map, get into TDM and load your map.
First, hit ESC and click Objectives. You should see your objective onscreen.
*NOTE:If you don't see it on screen, you probably forgot to check the Visible box.
Now its time to test your objective. Exit out of the objectives menu and launch a gas arrow or use the blackjack on poor Roy. When he goes down you should see the words "Objective Complete" appear onscreen and since thats the only objective we've added so far you'll win the mission.
*NOTE:If you don't win nor see the on screen message, go back and try to figure what you did wrong.
If all is well than its time to move on. Exit TDM and go back into Darkradiant.
Now it is time to add the trophy. In your map add a trophy somewhere, I used the entity loot>atdm:loot_trophy_old change its name to "trophy" and go back into objectives editor.
Add another objective and edit it. 'Description should be Steal the Trophy. State is Complete, Flags should be Mandatory and Visible. Click ADD and select Player possesses item. Change Item: to Name of single entity and type in the box to right, "trophy". Change the amount to "1".
Your objective should look like this.
Since this is a tutorial this map is very small and very basic so we are tossing all pre-thought and planning for the objectives out the window. As maps get bigger, more elaborate, complex, so too will the objectives be to suit the level. You might want to the trophy in a vault. Maybe the guards will be patrolling.
Save your map and load it up in TDM. Look at the objectives menu to see if the fresh addition is there. And than take it and see if it completes the objective.
Congratulations!
You now have a basic understanding of how the objectives editor works. For more advanced work, look for more tutorials in the future or go on the forums.
FAQs & Examples
KO objective but AI already dead!
- If I kill the guard I don't fail the mission, but I can't complete it either.
- Answer: I'll quote Ishtvan for this one.
- "The system is not smart enough to know automatically that someone who's killed can't be KO'd later, so if you want it to fail when they're killed, you have to put that in specifically. Note that this doesn't have to be a whole 'nother objective, it can be a component of the KO objective, so you have two components, KO them, and don't kill them. We could potentially make this automatic later on, but that's the way it is right now."
- Until this is fixed, I'd recommend making a knockout objective optional, unless you want to put in the kill component.
Kill objective thwarted by another AI
- I put a monster in my map and he killed the guard, yet I still passed/failed the objective.
- Answer: Check the Player Responsible Flag, this means that the player MUST do it himself in order to get credit.
Leak caused by Objectives Entity
- Help! My objectives entity is outside the map and I have a leak! I can't find it! I even used the pointfile!! help!!!!
- Answer: The objectives entity is a very small, yellow cube that is spawned around the origin. Its about the size of a light entity.
How to directly trigger an objective or component to complete
If the actions that the player has to do in a mission are not directly covered by the normal objectives properties, for example, the player must open a door, then objectives can be triggered to complete by any target entity.
In the objectives editor, to your objective add a component type : custom script. (this might just say 'custom' or similar.) The objective now just awaits some external trigger or script in the game to set it complete. To do this with a trigger...
- Create a new entity : target_tdm_setobjectivestate
- Give it the properties/values...
obj_idN O
... where O is the objective number and N is simply the obj_id number if you want several on the same entity. Just use obj_id1 if you only want one.
obj_state 1
You must then target that from some triggering entity like a button, lever, door (see Doors) or you can trigger it from stims & responses or from a custom script.
In a similar way, you can trigger individual components using entity target_tdm_setobjective_component_state. In this give it the properties/values...
- Create a new entity : target_tdm_setobjective_component_state
- Give it the properties/values...
comp_idN C
... where N is just this ID number and C is the component number.
obj_state 1
Again, trigger that as above.
How to make my invisible objective become visible to the player later
To make an invisible objective visible later....
- Create a new entity : target_tdm_setobjective_visibility
- Give it the properties/values...
obj_idN O
... where O is the objective number and N is simply the obj_id number if you want several on the same entity. Just use obj_id1 if you only want one.
You must then target that from some triggering entity like a button, lever, door (see Doors) or you can trigger it from stims & responses or from a custom script. It will by default then become visible. You can do it the other way round and make an objective become invisible (remember it is still active by default. by changing the spawnarg value 1 to...
obj_visibility 0
Completing Objective Components in a Certain Order
Suppose you want the player to complete two or more parts of an objective but in a certain order. Example : "Close the office door then open the safe." In that example you want the player to close the door first not just do both in any order. If you just make the two components they default to a Success Logic of 1 AND 2 which means the player must do both to complete the objective but it does not matter which order. So if the player opens the safe and then closes the office door then the objective will check off - perhaps not what you want. This is how to do it if you want to force the order in which the player does the components...
There are two possible outcomes :
If you want the mission to fail set the failure logic for that objective to
NOT(1) AND 2, i.e., door is open AND safe is open.
But if you just want the objective to not complete (so the player can try again)...
Make two objectives, both using the door and safe components - the first is invisible but still active:
- Objective 1: success logic: Door closed, safe not open = 1 AND NOT(2)
- Objective 2: success logic: Door closed, safe open = 1 AND 2
(Objective 2 enabling objectives = 1)
Technical info
- I have some other questions about objectives
- Answer:This article talks about more specific, more technical and advanced work. Objectives