-
Notifications
You must be signed in to change notification settings - Fork 3
Edit Element Global
A Global edit element is a way to replace existing, or add new, global definitions. This is the most complicated Edit Element. You need to understand a how a global file is formatted before you can start editing it.
A global element requires the name of the global file you'd like to edit. It also needs an entry to find within the source global file.
- You can only define one find by attribute
<global source="" type="" context="" ...="">
child-properties
</translation>
Type | Regex | Name | Required | Description | Usage |
---|---|---|---|---|---|
attribute | No | source | Yes | Name of the global file | <global source="global.model">... |
attribute | No | type | No | How the edit is applied | <global type="exclusive">... |
attribute | Yes | context | No | Segment in global file to edit | <global context="Actors go here">... |
attribute | Yes | ... | Yes | The find by attribute | <global name="prop_0484_rang_01">... |
elements | No | child-properties | No | Child-properties to apply | ...<ammoCount>4</ammoCount>... |
The type defines how the edit is applied. Below is a list of the supported edit types:
Type | Description |
---|---|
inclusive | Add (or replace existing property definitions) without destroying other property definitions |
exclusive | Remove pre-existing property definitions and add the given property definitions |
replace | Replace existing property definition, but do not add if the definition doesn't already exist. |
The Find By attribute defines a property key and value to find. The attribute name is the property key to find. The attribute value is the property value to find. The attribute value can be a regex expression.
For instance, if you wanted to find name prop_0519_LargePontoon
within the global.model
you'd write a global edit:
<global source="global.model" name="prop_0519_LargePontoon">
</global>
In this case, the name attribute is the Find By attribute. A key value pair of name prop_0519_LargePontoon
in global.model
is searched for.
If you want to find any name
that has a value containing the word rang_
ending with a number you'd write this:
<global source="global.model" name="rang_[0-9]">
</global>
For this example, we're going to edit all the rang definitions with one global edit. Specifically, we're going to set the flightTime
property to 0.
The start of the rang definitions are like so:
// ==================================================================== Actors don't go here
// ===================================================================== return to actors
//==================================================================================================== Rangs Start
name prop_0484_rang_01 // BR_Standard
trailMatName = RANGTRAIL_01
ammoCount = 1
range = 1500.0
flightTime = 1.5
name prop_0485_rang_02 // BR_Frostyrang
trailMatName = RANGTRAIL_02
ammoCount = 1
range = 1000.0
flightTime = 1.75
...
So we want to find all name properties and edit their child properties. Each name property has the word rang
in it. So let's start with that.
<global source="global.model" type="inclusive" name="rang">
<flightTime>0</flightTime>
</global>
This works pretty well. Got some buggy rangs now. But rang
could be defined in another, unwanted, region. We wouldn't want to add flightTime
to anything but the boomerangs. That's where the context attribute is handy. A context is defined by the // ...
placed above a region. So in this case, we see the words Rangs Start
at the beginning of the rangs definitions. Let's update the element.
<global source="global.model" type="inclusive" context="Rangs Start" name="rang">
<flightTime>0</flightTime>
</global>
Now only properties under that, until another // ...
region is defined, will be affected.