How to use objectives and init.sqs

By snYpir.

Main Menu

This will detail everything you will ever need to know about defining, hiding, and using objectives. Also explains the little-known but very handy init.sqs.

Objectives are very flexible, and you can do alot with them once you know how.

In order to properly use objectives you have to understand the following three areas:

- The briefing.html file
- The ObjStatus command
- The init.sqs file

The Briefing.html File

The briefing.html file is where you will define all objectives for your mission. This area has also been covered in the breifing tutorial but this is a better way of understanding it. Regardless of whether you want them to be hidden at the start or not. Objectives are defined in briefing.html as follows:

<p><a name = "OBJ_1"></a>Lolisse is to be secured, and a firm base established to prevent enemy counter attack.</p>

Subsequent objectives would be "OBJ_2", "OBJ_3" etc.

Don't forget that you can also link to markers on the map. If you had a marker named obj1 at the objective, you could use:

<p><a name = "OBJ_1"></a><a href="marker:obj1">Lolisse</a> is to be secured, and a firm base established to prevent enemy counter attack.</p>

<p> and </p> simply define the bounds of a paragraph in html.

Objective Basics

Objectives don't just have to sit there for the whole mission. They can be made to pop up at any stage during the mission or disappear as they are completed as new objectives surface.

The single command that is used to manuipulate objectives is ObjStatus.

This command is called as follows:

"objectiveNumber" ObjStatus "objectiveStatus"

objectiveNumber is the number of the objective to modify, corresponding to the numbers in the briefing file. Quotes are necessary.

objectiveStatus the status to set. Quotes are necessary.

Valid values are :

"DONE" - Will mark the objective as done in the mission warrent
"FAILED" - Mark the objective as failed in the mission warrant
"HIDDEN" - Objective won’t appear in the mission warrant
"ACTIVE" - Unhides a hidden objective

For now, we will just examine "DONE" and "FAILED".

Suppose we had an objective as described above, to capture Lolisse. This is objective 1. We could put a trigger around Lolisse, activated by the player's side being present. In the activation field you could put:

"1" ObjStatus "DONE"

And this would flip the objective in the briefing to done. Suppose the player must keep a certain unit alive during the assault (the bosses sports car for example, named bosscar). The following would be in the condition field of a trigger:

NOT(alive bosscar)

And the following would be in the activation field:

"1" ObjStatus "FAILED"

Flipping the capture Lolisse objective to failed.

Hiding Objectives

If you want to hide an objective at the initial briefing, you must create a file called init.sqs in your mission folder. This file will be called automatically by OFP at the start of your mission (before the briefing window appears). We don't need to make any calls to this script file, OFP will do that for us.

If we wanted our capture Lolisse objective to be hidden at the initial briefing, we would put the following line into init.sqs:

"1" ObjStatus "HIDDEN"

and there will be no objective one shown at startup. Suppose we want the objective to become visible part way through the mission. We could use the following command in the activation field of a trigger:

"1" ObjStatus "ACTIVE"

This will make the objective appear in the mission briefing. There is no reason why we couldn't also link markers on the map with the objective to take Lolisse. If we wanted to hide the obj1 marker until the capture Lolisse objective is shown, we would firstly hide the marker via this command in init.sqs (the quotations are neccasary):

"obj1" SetMarkerType "Empty"

And then to display the marker we would use the following line in the same trigger activation field as "1" ObjStatus "ACTIVE":

"obj1" SetMarkerType "Destroy"

This will show the obj1 marker with a "Destroy" icon. Some other icon types are:

"Start" - Arrow moving out of a circle
"End" - Circle with an arrow going into it from the top
"Pickup" - Arrow bouncing in and out of a circle
"Marker" - X icon
"Arrow" - Arrow
"Flag1" - Flag icon
"Warning" - Exclamation Mark
"Dot" - A dot
"Join" - Two Arrows joining in a circle
"Unknown" - Question Mark

The init.sqs file is the key to hidding markers and objectives at the initial briefing. It also provides a good way to initialise global variables and perform any other pre-mission tasks that you require.

WARNING: I have experienced trouble when using an init.sqs file when calling a script for an intro.

I hope this helps u out a bit, and I encourage you to make use of the hiding/activating objectives because it adds suprise and fun to a mission.

Happy editing!