I feel pretty dumb that I can't figure out how to use Game Variables - it seems like a pretty basic concept to me. My goal is the following:
1. Player picks a character at game start 2. String variable playerChar gets set corresponding to that char ("Tristina" if they pick Tristina) 3. When they go to the combatant vendor, he will not show Tristina for purchase if the player already picked her
This is all being tested off of the tutorial environment. I approached this as follows: when the game starts you get menu options to pick your first character - when you confirm the character it changes the player name, class, and the following event node to set the variable:
Node: Change Game Variables Variable Origin: Global
After that, I thought I set the shop settings to only display the combatant as long as the playerChar value doesn't match:
Combatants Combatant 0
Use Variable Conditions: Enabled Variable Condition 0 Condition Type: Conditions Needed: All
Variable Condition 0
Variable Key Value Type: Game Variable Value: playerChar Is Valid: Unchecked Type: String
String Value Value Type: Value Value: Tristina
My noob understanding of these settings is that playerChar should get set to Tristina by the event, then as long as that value is Tristina, the shop won't show this item (since Is Valid is unchecked). What is actually happening is that all of the combatants are showing on the shop regardless of the character I pick at start. I feel like the variable needs to be initiated before my character select event or something, it seems like it's a null value or just doesn't exist at all. I am working with the tutorial game, so I have a Ork Game Starter on the main menu. I tried adding one to the first scene, but that didn't change the behavior. Feels like this is just some fundamental misunderstanding of mine on how to use game variables. Let me know if you guys see my problem here.
As @Shadow_Fire pointed out, the Value Type shoud be Value - this is because you directly define the variable key that you want to use.
Using Game Variable as value type means that the variable key you're using is stored in the game variable you defined.
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!
Olive Branches ~ in development ~ now with a WEBSITE!!!
Using Game Variable as value type means that the variable key you're using is stored in the game variable you defined.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!