Jump to content
Ghost Recon.net Forums

Recommended Posts

Like I did 5 years ago, I'll try to write up some helping texts on scripting.

I'll be using XML found in the mission.xml file. Much in the mission.xml refers to entires found in the world.xml, which is created by the map editor. Those are the "physical" names set to objects, all other names see here is just names used between scripts inside the mission.xml.

How To show units triggered by player in a zone

Items needed from map editor:

- 1x area (I called it area_intel)

- 1x human (I called the group intel_group01)

Define A Trigger Zone For Player (place in beginning of script_data, after include)

<area_group name="area_intel" area_name="area_intel" group_id="friendly1" interval="0.3" condition="1"/>

- name => what you call it (use same as area_name)

- area_name => name given to area in editor

- group_id => who can trigger it? ("friendly1" == mitchell/server, "mp_players" == all players MP, "players" == all ghosts SP/MP, or any group_id set for a human/humans in the map editor)

- interval => seconds between checks

- condition => how many from group_id is needed?

NOTE: If you want a vehicle to trigger an area just replace group_id with vehicle_id and enter the name of the vehilce as defined in the map editor. You also have to remove the condition variable. Like in this example:

<area_group name="area_intel" area_name="area_intel" vehicle_id="my_tank" interval="0.3"/>

Activate Trigger Zone (place in an event, example in if active from beginning <event name="start_game">)

<element type="UnitInArea" area="area_intel" state="activate" start_time="1.0"/>

- type => what action to take, UnitInArea check selected

- area => ok, which UnitInArea check?, area_group defined earlier

- state => what to do with it?, activate/deactivate

- start_time => when?, seconds delay after event executed

Create Trigger For Player In Zone

<user name="area_intel" type="once">

<trigger type="UnitInArea" area="area_intel"/>

- Define trigger/condition to run

- type => what will trigger it? ("UnitInArea == zone trigger)

- area => which defined area_group?

<event name="show_area_intel"/>

What will happen?

- name => event to run if trigger ok

</user>

Create Event To Run When Zone Is Triggered

<event name="show_area_intel">

- name => name to call to run event

<element type="DebugString" msg="show_area_intel" start_time="0.0"/>

Feedback in debug mode

- type => gives message in debug mode

- msg => message shown

- start_time => delay in seconds

<element type="UnitInArea" area="area_intel" state="deactivate"/>

Prevents zone being activated again by deactivating it

- type => what action to take, UnitInArea check selected

- area => which UnitInArea check?, area_group defined earlier

- state => activate/deactivate

<element type="ActivateGroup" group_id="intel_group01" start_time="0"/>

Activate group of humans, make them visible and start their given actions

- type => what action to take, "ActivateGroup"

- group_id => ok then, which group?

- start_time => when?, seconds delay after event executed

.

. (add as many elements as you want, all executes when "show_area_intel" in run)

.

</event>

And the clean XML code with only overview comments:

<!-- Define A Trigger Zone For Player (place in beginning of script_data, after include)-->

<area_group name="area_intel" area_name="area_intel" group_id="friendly1" interval="0.3" condition="1"/>

<!-- Activate Trigger Zone (place in an event, example in if active from beginning <event name="start_game">)-->

<element type="UnitInArea" area="area_intel" state="activate" start_time="1.0"/>

<!-- Create Trigger For Player In Zone -->

<user name="area_intel" type="once">

<trigger type="UnitInArea" area="area_intel"/>

<event name="show_area_intel"/>

</user>

<!-- Create Event To Run When Zone Is Triggered -->

<event name="show_area_intel">

<element type="DebugString" msg="show_area_intel" start_time="0.0"/>

<element type="UnitInArea" area="area_intel" state="deactivate"/>

<element type="ActivateGroup" group_id="intel_group01" start_time="0"/>

</event>

Hope you can read this. It's to bad the forum doesn't support TABing.

I'll look into the objective scripting next.

EDIT: added that any human group can be set to trigger a group, of course. ;)

EDIT 2: added how to define a vehicle to trigger a zone instead of a human. :)

Edited by Wolfsong
Link to post
Share on other sites
  • 1 month later...

Cleaned this up and added more descriptions and steps in the document version which you'll soon get access to. It's now 5 pages in Word, and also has 2 chapters preceding it that goes over some basics about XML and the base XML elements used in GR:AW. I think it will help out the new scripters muchmore then the version I've posted here does.

Hope to have everything cleaned up and out for you as a PDF before the end of the week, but it's not the highest priority on my list as I've already covered this ground once.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...