| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

Advanced scripting of the mission xml

This version was saved 15 years, 2 months ago View current version     Page history
Saved by Bogie
on January 10, 2009 at 4:17:07 am
 


 


Adding a Zeus

Adding a Zeus to your mission is a three step process.  First, in the editor, create a "Target Marker" in the location where you would like your Zeus.  Name this marker "target_zeus01".

 

Second, In the world.xml, search for your "target_zeus01" to obtain the positional x,y,z coordinates where you placed your marker.

 

And lastly, enter this information into your mission.xml:

<element type = "CreateUnit" weapon="predator" pos="5538.6543 -3598.2598 522.5941" spare_clips="1" yaw_pitch_roll="0 0 50" />

 

The position or 'pos="x y z"' comment are the x,y,z coordinates that you pulled from your Target Marker.  If you need to be precise with the placement of your Zeus (IE place the Zeus on top of a box), the Zeus 0,0,0 location is not centered, but on the corner.  So if you would like to center your Zeus, you may need to add or subtract 2-3 from your 'X' and\or 'Y' coordinates to get the desired effect.

 

 

Setting up respawn points

To keep your Ghosts from having to run across the map after an area has been cleared, you may wish to consider setting up additional locations to spawn in the unfortunate incident that a player has been killed.  To do this, setup your respawn locations in the editor.  For our example, we'll have three spawn locations:

  • coop_spawn:  This is your initial spawning location
  • loc_respawn01: After a particular area has been entered (say loc_trig01), then your team will respawn to this location
  • loc_respawn02: After your team detonated an ADAT, you want to respawn at the ADAT location.  So you would create the loc_respawn02 at the site of the ADAT

 

Here is the code:

<trigger name ="t_loc_trig01" interval="2" preserved="false">

<condition type ="UnitInLocation" location ="loc_trig01" player_type = "team_a" greater_than="0"/>

<event name ="e_loc_trig01"/>

</trigger>

<event name = "e_loc_trig01">

<element type = "StopTrigger" name = "t_loc_trig01"/>

<element type = "SetSpawnLocation" location = "coop_spawn" side = "1" set = "false"/>

<element type = "SetSpawnLocation" location = "loc_respawn01" side = "1" set = "true"/>

</event>

 

<trigger name="t_adat01_dead" interval="2" preserved="false">

<condition type = "VehicleDestroyed" vehicle_id="adat01" amount = "all"/>

<event name="e_adat01_dead"/>

</trigger>

<event name = "e_adat01_dead">

<element type = "StopTrigger" name = "t_adat01_dead"/>

<element type="Objective" id="adat_destroyed" state="completed"/>

<element type="SetSpawnLocation" location="loc_respawn01" side="1" set="false"/>

<element type="SetSpawnLocation" location="loc_respawn02" side="1" set="true"/>

 

</event>

 

The above code assumes that you must pass through loc_trig01 prior to detonating the ADAT.  If not, you can even add all three locations to the code such as this example with the ADAT detonation:

 

<event name = "e_adat01_dead">

<element type = "StopTrigger" name = "t_adat01_dead"/>

<element type="Objective" id="adat_destroyed" state="completed"/>

<element type = "SetSpawnLocation" location = "coop_spawn" side = "1" set = "false"/>

<element type="SetSpawnLocation" location="loc_respawn01" side="1" set="false"/>

<element type="SetSpawnLocation" location="loc_respawn02" side="1" set="true"/>

 

</event>

Where both "coop_spawn" and "loc_respawn01" are set to not spawn any more players.

 

Setting up variables

There may be times when you need to store numeric values when manipulating your missions.  In this example, we'll have 10 objectives in order to complete your mission.  So our objective in this code is to add '1' each time a mission is completed.  When our variable equals 10, then we can end the game.

 

First, we'll need to setup our variable string using the "Calculate" element under our starting conditions:

<event name="start_mission">

<element type="StartTrigger" name="t_end_game" start_time="1"/>

<element type="Calculate" start_time="1">

<store target="missions_completed" source="0"/>

</element>

</event>

In the above code, we use the target "missions_completed" to store our values.  Since we are starting the game, we want our initial value to be zero noted by the 'source="0"'. 

 

After we've triggered one of our objectives as complete (detonated a vehicle, entered a location, etc.), we'll want to add the following code into the event

<event name="e_our_triggered_mission_objective_completed">

<element type="Objective" id="obj1" state="completed"/>

<element type="Calculate" start_time="1">

<add target="missions_completed" source="1"/>

</element>

</event>

Note that we've called the "Calculate" element type again.  This time, we use the "add" sub element to add one to our "missions_completed".  You can use other sub-elements such as "sub" to subtract a value, "rand" for a random variable, etc.

 

So each time we complete an objective, we add "1" to our "missions_completed" target.  We now need to setup the trigger to end the game once our "missions_completed" variable equals "10"

 

<trigger name="t_end_game" interval="2" preserved="false">

<condition type="EvaluateVar" var="missions_completed" equal="10"/>

<event name="e_end_game"/>

</trigger>

<event name="e_end_game">

<!-- Enter the code you want to end the game -->

</event>

 

As you can see, under the trigger "t_end_game" we created the condition to evaluate the variable in the "missions_completed" target.  If "missions_completed" then equals 10, call up the event to end the game.

 

You can use variables in many different ways in your GRAW2 Missions: creating random numbers for spawning AI in different locations, using in conjunction with strings to trigger diverse messages, etc.

 

Scripting triggered smoke effects

During gameplay, there may be times when you want to call up smoke effects triggered by an explosion, marking an enemy, etc.  In this example, we are going to pop smoke to identify the extraction zone once all objectives have been completed.

 

<trigger name="t_objectives_complete" interval="2" preserved="false">

<condition type="EvaluateVar" var="missions_completed" equal="10"/>

<event name="e_objectives_complete"/>

</trigger>

<event name="e_objectives_complete">

<element type="StopTrigger" name="t_objectives_complete"/>

<element type="ShowMessage" msg="Mission Complete, Ghosts." kind="splash"/>

<element type="Objective" id="obj_end" state="add" headline_id="Extract" txt_id="Extract" waypoint_id="Extract" waypoint="15465 -2052 50"/>

<element type="StartTrigger" name="t_extract" start_time="3"/>

<!-- Code for the Smoke -->

<element type="CreateUnit" unit="efx_hh_zone_smoke" location="loc_extraction" center="true" name_id="smoke_extract" start_time="3"/>

<element type="ColorSmoke" side="1" name_id="smoke_extract" start_time="3.5"/>

</event>

In this example, we setup a trigger to end the game and an objective to reach the extraction point.  After 3 second, we use the "CreateUnit" element to create the "efx_hh_zone_smoke" in the center of the extraction location and gave it the name "smoke_extract".  The nice thing about the "efx_hh_zone_smoke" is that it has three colors to choose from:

  • 0 = Neutral or Black Smoke
  • 1 = Blue Smoke
  • 2 = Red Smoke

We can change the color using the "ColorSmoke" element and identify the smoke to change via the "name_id".  Just make certain that the "ColorSmoke" element is called after the "CreateUnit" or your smoke will use the default "0" or "Black" smoke.

 

Note that if you do not use the 'center="true"' variable, the creation of the unit (in this case smoke) will appear at random in the location.  As with the example with the creation of the Zeus, you can also use x,y,z coordinates instead of a location you created in the editor.

 

Comments (0)

You don't have permission to comment on this page.