Perchance, does changing an item variable of a selected equipment part actually create a new variable instance? I've noticed that if I set up a generated combatant's object variable component to use a formula set to an equipped item variable's value, the value of the object variable remains stagnant even after the item variable is changed by an event. Using selected equipment in an event to change the same item variable referenced by the preset Object variable, and then "Variable To Variable" to generate a new Object variable with an alternate name referencing the same item variable, It seems that the new object variable changes to reflect the altered value and the original one remains set to the original value. Assuming that explanation read confusing as hell, allow me to break it down.

-A weapon set to a combatant's initial equipment slot has a variable set under the name, "Wpn_Blade_Edge_Nicks_WTF!!!?". I have a number of such variables set up as float values intended to indicate particular levels of damage done to an equipment piece. The concept was to set them up as a placeholder that could hold the values altered by certain events but retain a position in the list above the variables that would read them in order to determine their own values.

-A formula is created which selects the equipment slot holding the weapon, and its value is set to the selected variable, "Wpn_Blade_Edge_Nicks_WTF!!!?".

-The combatant with the equipped item is given a new object float variable named, "O_Wpn_Nicks_Huge," with its value set to the formula.

-The game is run, and the Object value reads commensurate with that of the item's variable, "Wpn_Blade_Edge_Nicks_WTF!!!?," so that part is working.

-An auto event is assigned to the combatant that checks their speed and loops to a one second wait if it fails to be greater than 0.

-The same event upon succeeding moves into a loop that selects the equipment slot holding the item, changes the value of "Wpn_Blade_Edge_Nicks_WTF!!!?", and uses Variable To Variable to transfer the value of the selected data variable, "Wpn_Blade_Edge_Nicks_WTF!!!?," to a new object variable named, "ScoobyDoo."

-"O_Wpn_Nicks_Huge" shows the original value of 3, and "ScoobyDoo" shows whatever I tell the event to set it to. The case of "Wpn_Blade_Edge_Nicks_WTF!!!?" is exactly the same in both instances; no extra spaces thrown in on the end or anything.
  • So ... what is the issue now?

    Variables are simply values, not instances - e.g. using Variable To Variable will simply copy the value from one variable to the other, but the variables are not linked in any way.
    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!
  • The instance as it turns out appears to be that Combatant Object Variables linked to a formula remain stagnant after the combatant has been generated. The variables on the item appear to change, but the object variables that that were initially linked to item variables by a formula break their link after the combatant spawns. Thus, changing the variable on the item has no effect on the generated combatant's object variable.
  • As I said - variables are not linked, assigning one variable's value to another doesn't link them and changing one afterwards doesn't change the other.
    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.