Conditionals from Game Modules 4 Data
v1.0
You may wish to display certain juicy behavior based on Game Modules 4 data, such as stats, or conditions, or items in the inventory. The Conditionals system enables three easy-to-utilize methods of querying Game Modules 4 data.
Custom Predicate
Any interface you have, or add, can be used in the Conditionals system as well, with custom methods. In this example, we have an interface IHaveGameModulesData, and we can call methods on that interface. Note the JuicyActor demo class, implements IHaveGameModulesData.

Once you assign the interface in the field, available methods are shown in the dropdown. The interface class and actor class for this may look like this example below. Any of the defined methods can be used in the Custom Predicate conditional option.
Custom Value Check with IConditionalValue
IConditionalValueSelecting the Conditional type "Custom Value Check", requires a class on the target or gameObject selected to implement IConditionalValue, and the method GetConditionalValue(string valueName).
Your custom class will then handle the response based on the valueName provided to the method.

For example, the conditional above is looking to see if the float response from "Hit Points" is less than 100. If true, the actions will execute. Your code may look like this:
Now, when GetConditionalValue("Hit Points") is called by the Conditionals system, it will return the float value of HitPoints.
Game Modules Blackboard
The Game Modules 4 Blackboard can be used apart from the Juicy Actions Blackboard. When you have Game Modules 4 installed, there will be a "GameModules" option when the "Blackboard" Conditional is selected.

The Game Modules 4 Blackboard uses a slightly different strucutre, so you'll have the requirements for the Topic and Subject to look up, and then the option to compare against a value, which includes all the values supported by the Game Modules 4 Blackboard.


Remember you can set the "Game ID" value in the Actor class (JuicyActor.cs in the demo) which is used as the Topic, and specify in the Stats setup that the values are posted to the Blackboard. There you can see the Subject that will be used.
Last updated