Hiya! I'm using a Unity sprite library to dynamically manage sprites, such as the weapons on a character. For each weapon, I set up an Equip Schematic in the Schematic Settings. In this schematic, I utilize a Call Function Node to activate a Method that updates the string to match the current weapon. This Method also updates a global variable, helping the system recognize the equipped weapon, which is useful when loading a game for example.
However, I'm encountering an issue during battles. When the character gets hit by an opponent, the global variable reverts to its default value, causing the sprite to change incorrectly. In the editor, the character still appears to be equipped with the correct weapon. Yet, when I check the global variables, they display incorrectly. If I switch weapons through the battle menu during gameplay, the global variable corrects itself, updating the sprite accordingly. After this change, the problem doesn't recur even if the character gets hit again.
I've thoroughly checked the code but can't seem to pinpoint the cause of this issue. The function to swap the weapon and global variable is only used by the Equip Schematic.
Any suggestions would be great! Thank you in advance!
As for ORK/Makinom variables - they can't change or reset on their own. There has to be somewhere that's doing it, e.g. a schematic or script accessing it and doing the change.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
I created a new schematic for it and ran it following the attack schematic, but as soon as this runs, the global variable for the weapon swapper resets.
this is the console log of the moment the sprite unintentionally switched back (with the Add to Bestiary node):
So, as said earlier - the static field in your class will be an issue if multiple combatants use this.
Why is this a static field and what is it used for further?
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!