| 
  • 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
 

Basic setup of the mission xml

Page history last edited by davros123 15 years ago

Page Contents


 


 

Basic setup of the mission.xml file

 

Even the most complex of co-op mission scripts in ghost recon are made up of two basic elements.  The trigger and the event. So in other words, a mission script is a series of events that are waiting to be triggered.

 

If you read a mission.XML you will see that this is exactly how a mission script is laid out.  So when planning your mission you need to consider what events you want and how they will be triggered.  Some events you may want to trigger when a player enters an area, other events you may want to trigger when all enemies in a group have died and still other events may be triggered by a combination of conditions - but essentially everything that happens in a mission script is triggered by something else.

 

So when planning your mission, I recommend you think about it as a movie.  See yourself walking through the mission and how things will unfold.  For example, as the players walk along the road they might get to a point which triggers a vehicle to come in the opposite direction.  If a fight breaks out with the occupants of the vehicles, you might want to trigger additional troops to come down the road on foot as backup for the mexicans.  Now they are alerted a helicopter gunships will be called by the Mexicans and will arrive in five minutes.  You need to consider what happens if the players do not engage the vehicle but moved stealthily passed it.  What happens next - well, that's up to you.  Essentially what you have done is mapped out the triggers and events for your script.  Once you have mapped this out it is relatively easy to translate it into a mission.XML file.

 

Triggers and events both have a standard structure which is outlined in detail in the "scripting for beginners" PDF that accompanies the game. So I suggest you print this pdf as you'll refer to it often.

 

In order for a trigger to become active, you need to activate it.  To activate a trigger you would have script like this...

    <element type="StartTrigger" name="t_loc_panhard01" start_time="0"/>

Not surprisingly, this will activate the trigger, "t_loc_panhard01" after one second delay. Once a trigger is activated it will sit there in the background and wait until its conditions are met. When they are met, it will trigger an event.

 

You can also call events directly from other events, like this...

    <event name="e_event_xyz">

             <element type = "TriggerEvent" event = "e_event01" start_time = "0"/>

             <element type = "TriggerEvent" event = "e_event02" start_time = "1"/>

             <element type = "TriggerEvent" event = "e_event03" start_time = "1"/>

    </event>

This can be handy when you want to trigger a number of events at once.

 

So let's have a look at an example of how we might script and the above scenario of the ghosts walking down a road.

Firstly will need a trigger which "triggers" or activates when the ghosts (team_a) enter a location on the map (loc_panhard01).  This in turn calls an event which activates the vehicle to come in the opposite direction..

The mission.xml script might look like this....

 

<event name="start_mission">
        <element type="StartTrigger" name="t_loc_vehicle01" start_time="0"/>
    </event>

     <trigger name="t_loc_vehicle01" interval="1" preserved="false">
        <condition type="UnitInLocation" location="loc_panhard01" player_type="team_a" amount="1"/>
        <event name="e_start_vehicle01"/>
    </trigger>   

    <event name="e_start_vehicle01">
           <element type="ActivateVehicle" vehicle_id="panhard01" start_time=".5"/>
           <element type="OrderCar" vehicle_id="panhard01" order="move" position="-817 -12836 -600" speed="1" start_time="1"/>       
    </event>

 

Then we need another trigger which calls reinforcements if the occupants of the vehicle get into a firefight...so we might change the script to look like this...

    <event name="start_mission">

        <element type="StartTrigger" name="t_loc_vehicle01" start_time="0"/>

    </event>

    <trigger name="t_loc_vehicle01" interval="1" preserved="false">

        <condition type="UnitInLocation" location="loc_panhard01" player_type="team_a" amount="1"/>

        <event name="e_start_vehicle01"/>

    </trigger>   

    <event name="e_start_vehicle01">

           <element type="ActivateVehicle" vehicle_id="panhard01" start_time=".5"/>

           <element type="OrderCar" vehicle_id="panhard01" order="move" position="-817 -12836 -600" speed="1" start_time="1"/>

        <element type="StartTrigger" name="t_panhard01_in_fight" start_time="0"/>    

    </event>

     <trigger name="t_panhard01_in_fight" interval="1" preserved="false">

         <condition type = "UnitInCombat" combat="true" group_id = "panhard01_passengers" greater_than= "0"/>

        <event name="e_call_reinforcements"/>

    </trigger>

    <event name="e_call_reinforcements">

          <element type="ActivateGroup" group_id="reinforcements01" start_time="1"/>

    </event>

 

The timing of elements within an event

The elements within an event are all executed at the same time - ie. when the event is activated/triggered. Think of it as saying do all the things inside the <event>...</event> tags at the same time. The do not run one after the other like traditional code would - but you can tell elements to start a counter and run after "x" seconds.

All elements have an optional attribute called “start_time”. It can be set to decide the delay in running each child element after their event is executed. It is set in seconds, and if this attribute is not used it will default to “0.0”, and the element will run directly after the event is triggered. This attribute will not be listed on each element type as it would be very redundant.

 

It is a good idea to divide the elements inside an event by giving them different “start_time”, so that they all won’t run at the same time which can cause the game to lag or temporarily freeze up all together due to the amount of information it has to process at the same time.

 

Example #1...

<event name = "e_explode_vehicles_01">
      <element type="ShowMessage" msg="BOOM!" kind="splash"/>
      <element type = "ExplodeVehicle" vehicle_id="panhard01"/>
      <element type = "ExplodeVehicle" vehicle_id="panhard02"/>
      <element type = "ExplodeVehicle" vehicle_id="panhard03"/>
</event>

The above event will show a message on the screen and explode all three vehicles at EXACTLY the same moment, ie. as soon as the event "e_explode_vehicles_01" is executed.

Example #2

<event name = "e_explode_vehicles_02">
      <element type="ShowMessage" msg="BOOM!" kind="splash" start_time="5"/>
      <element type = "ExplodeVehicle" vehicle_id="panhard01" start_time="1"/>
      <element type = "ExplodeVehicle" vehicle_id="panhard02" start_time="3"/>
      <element type = "ExplodeVehicle" vehicle_id="panhard03" />
</event>

When executed, this event will behave as follows..

At 0 seconds, explode panhard03

At 1 seconds, explode panhard01

At 3 seconds, explode panhard02

At 5 seconds, show the message on the screen.

 

 

Comments (0)

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