Skip to content

Modifier

Ferdinand Calo edited this page Apr 7, 2021 · 7 revisions
# Feature Overview
Kind: Attribute Modifier
Extendable: yes/by code
JSON based: no
JSON config: yes

Modifiers are a new feature added in FVTM 3!
Currently FVTM uses the 5th prototype of the Attribute System.

Modifiers can be appended to Attributes to change their value
and in effect change the vehicle's behaviour or appearance.

Modifiers are created in a similar way as Attributes.

Example config (taken from FVP / C10):

{
    "__comment": "Vehicle JSON file.",
    "Attributes":[
    	{ "id":"c10_doors_fl", "type": "boolean", "value": false, "editable": true, "seat": "driver" },
    	{ "id":"c10_doors_fr", "type": "boolean", "value": false, "editable": true, "seat": "pass_front" },
    	{ "id":"c10_doors_bl", "type": "boolean", "value": false, "editable": true, "seat": "pass_rear_left" },
    	{ "id":"c10_doors_br", "type": "boolean", "value": false, "editable": true, "seat": "pass_rear_right" }
    ],
    "Modifiers":[
    	{
    		"id": "weight",
                "type": "additive",
    		"target": "vehicle:weight",
    		"value": "125.445",
                "priority": "veryhigh",
                "impl": "float"
    	}
    ]
}

Here an overview of the fields:

  • id - the ID of the modifier
  • value - the value of this modifier
  • priority - the priority of application of this modifier, the higher
    the sooner it will get processed, valid are: VERYHIGH, HIGH, NORMAL, LOW, VERYLOW
  • type - the modifier type of this modifier, available are:
    • OVERRIDE - overrides the attribute's value with it's own
    • ADDITIVE - adds to the attribute's value it's own
    • PROCENT_ADD - adds a percent (it's value being the percent)
      of the attribute's value to it
    • PROCENT_DEC - removes a percent (it's value being the percent)
      of the attribute's value from it
    • PROCENT_SET - sets a percent (it's value being the percent)
      of the attribute's value as the attribute's value
    • OPPOSITE - sets the attribute's value to opposite (e.g. 20 -> -20)
    • OTHER - unused
  • update - the update pass this modifier will be applied on, available are:
    INITIAL - on install/reset, ENTITY - on entity update (tick), MANUAL - manual
  • target - the target attribute of your modifier
  • impl - (code) modifier implementation (when missing float is default), valid are:
    • float - processes float or integer type values
    • integer - processes integer or float type values (note it returns as int, no decimals!)
    • string - processes string type values
    • since 3.6.52 you can register new Modifier classes (implementations) into FVTM
Clone this wiki locally