For the complete documentation index, see llms.txt. This page is also available as Markdown.

Condition.cs

v4.0

Condition is a Scriptable Object which holds all the information about the condition, and the Stat objects it affects. It implements IHaveUid and IHaveDictionaries

Condition.cs
public string ObjectName
public string ObjectType

public string description;
        
public List<ConditionTime> conditionTimes
public List<ConditionPointEffect> pointEffects
        
public bool Periodic => _periodic;
public float Period => _period;
public bool Instant => _instant;
public bool Stack => _stack;
public int Level => _level;
public string DisplayName => _displayName;

public Condition ExpirationCondition

Setup

The objectType of a Condition is the name of the folder the Scriptable Object is in. Create one named as you'd like, and right-click inside to select the menu option:

/Create/Game Modules/Create/Condition

This will create a Condition Scriptable Object in your project. Select that and view the Inspector to begin setting up your data. The name of the Scriptable Object is saved as the objectName value.

Inspector

Select your new object and view it in the Inspector. Here is where you can manage all the details about this Condition. Note there are multiple tabs, each of which provide access to specific, and optional, information.

This is a condition in the Party Based RPG demo game.

Here you can adjust the main details about the Condition, as well as the length of time the condition should be active, and the effects the condition has on points -- both periodic effects and one time effects.

Main SettingsCondition TimeEffects on Points

This panel controls what affect the condition has while it is active, on the Stat values of the target which owns the condition.

This acts similarly to the ItemObject, ItemAttribute and other Stat settings.

The Base values will occur regardless, simply by having the condition. You are also able to add any number of other sources. If the "caster" of the condition has the Stat, then the values will be included in the total, otherwise they will not be included in the total.

In the example above, the "Haste" condition adds 5 to the "value" of the Speed stat, and 0.2 to the "proficiency".

The "Owner" of the condition is set on the GameCondition object, or if the GameCondition is on a GameConditionList, then it will be automatically set to the IHaveStats owner of the GameConditionList.

All of this is automatically handled if you inherit your Actor from GameModulesActor or GameModulesInventoryActor, as there is a "Conditions" list already included, with all the automatic goodness that comes with Game Modules 4.

No values here are impacted by the "Periodic" checkbox, and nothing here will take effect if the condition is marked "Instant".

Like most of the other objects in Game Modules, Conditions can have custom Dictionaries, expanding their potential use cases for your project. Set up the exposed Keys by clicking the "Manage Conditions" button, and selecting the "Dictionaries" tab.

Manage Conditions

Based on the Condition type selected in the drop down menu, you will be able to see and manage the "Main Settings" and "Stats" of each Condition object. In the "Dictionaries" tab, you can set up and expose KeyValue pairs which can be managed while viewing each individual Condition Scriptable Object.

Last updated

Was this helpful?