I'm confused about where and how I need to plug in the "action" key to make an item reference itself as the formula's selected data. I want to set certain item variables automatically through formulas based on other variables, such as creating a variable code for materials that a formula can reference to determine an Item's various properties.

Example:

-The item is a knife with a steel blade, so I give the Item a variable called 'Wpn_Material_Blade' and set the value to 1.

-I want to specify the degree to which the blade's material properties have been altered by forging, so I create a variable called, 'Wpn_Blade_Forging' and give it a value of 2.

-Finally, I want to use those two variables in a formula to determine the value of another named, 'Wpn_Blade_Hardness', so I set the value of this variable to use a formula rather than giving it value.

-The formula will be a composite of separate formulas beginning with one that checks the value of the sister variable, 'Wpn_Material_Blade' and sets the formula's value then accordingly before moving on to check the value of, 'Wpn_Blade_Forging', and assigning the correct multiplier. Other formulas will then plug in to add or subtract from this value based on certain factors such as how, or whether, the item was tempered.

-Testing this is tricky since there really isn't any user the formula can reference. To start with, just to see if I could get the selection part to work, I used the 'Select Item' node and set it to the specific knife I'm trying to test. Which didn't work at all.

-I thought that a degree of separation might help, so I gave a combatant the knife as starting equipment, created another formula and selected the equipment slot with the knife to see if I could check the variables that way. The values set directly pinged fine, but obviously those variables intending to use a formula to assign their values didn't go so well, else I wouldn't be posting this.

Anyway, I hope I've explained well enough what I'm trying to accomplished. How far off the mark am I in terms of basic procedure?
  • edited September 2018
    The item variables currently don't reference the item instance itself as selected data in formulas. Also, using a formula will only calculate that value when first initializing the item instance, i.e. it'll not automatically update if any of the used values is changed.

    Edit: I'll change this behaviour in the next update - the item instance will be passed on as selected data with the key action and you'll be able to reference item variables in the formula calculation. Keep in mind that this will only allow accessing variables that where set up before the one doing the calculation (i.e. they have to be in the list above the one with the formula).
    Post edited by gamingislove on
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Thank you so much for deciding to include this feature in the next update! It sounds like variables will behave like stats insofar as they'll be able to utilize only those variables placed above them in the list, but would it be possible to run a pass for variables with manually defined values prior to those whose values rely on a formula? Similar to how stats with non-combined values are pinged before checking those with defined values.

  • Hm, not directly, I could add a setting to make 2 passes over the variable setting, though.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.