Skip to main content

String Operation

A String Operation (or Stat Operation) is a string type that allows you to type in an expression with your Stats and return a result (a value).

Example

({Agility} + {Strength}) + 2
Will return the sum of the Final Value of Agility, Strength and 2.

It is used in Value Influences or can be used directly with MakeStringOperation().

Expressions​

Operators​

You can use the following operators:
( ) + - * / % sqrt ^

Example

sqrt(3 - 1) / (3^4 + (5 * 2.5))

Stats​

You can use Stats in the operation by encapsulating their IDs in curly brackets {StatID}.

Example

{Strength}
Will return the Final Value of Strength.

Target Values​

If you don't want to target the Final Value of a Stat, but rather its Integer or Alternative Value, you can use a dot .targetvalue.

Example

{Level.int}
Will return the Integer Value of the Level Stat.
{Strength.alt0}
Will return the Alternative Value at index 0 of Strength.
{Strength.alt1}
Will return the Alternative Value at index 1 of Strength.
etc.

Default Values​

If there's a chance that the Complex Stat might not exist (if you intend to add or remove Stats during gameplay), you can add a default value with parenthesis (DefaultValue). Without any Default Value provided, the value of a Stat that doesn't exist will be 0.
It can be useful if you intend to use some Stats as multipliers or dividers in your Value Influence.

Example

{Agility(1)} * 2
Will return 1 * 2 if Agility doesn't exist.

2 / {Agility.int(1)}
Will return 2 / 1 if Agility doesn't exist.

Custom Values​

A Custom Value is a value tied to an ID. You can add some in your String Operation, and will be able to modify them later on.

Add Custom Values​

Add a Custom Values by adding an element to the Custom Values array.

Use Custom Values​

For Custom Values, you'll need to use Square Brackets: [MyCustomValue].

Example

2 * [PerkRank]
Will return the product of 2 and the value associated to the ID "PerkRank".

[PerkRank] + {Agility}
Will return the sum of "PerkRank" and the Final Value of "Agility".

Modify a Custom Value​

You can modify a Custom Value with UpdateValueInfluenceCustomValue().

note

This function will update all Custom Values "MySecondCustomValue" under "MyInfluenceID" with the value 7.

Curve​

In situations where the influence would be hard to translate into an operation, you can use a Curve to set your key values directly in the curve editor.

The result of the operation will be used as the X axis, and return the value of the Y axis.

Example

I want to manually set the threshold points on how my Agility will affect my Attack Power.
I can create my curve and add some key points.

In my Value Influence, I can simply capture "Agility" and use my curve.