I have some questions when calling the "currency" (Gold Value) of a character, I was watching and the currency that I have with a character in the text file, but when loading the data file (SaveLoad.cpp) does not load or save the currency with (pc-> stats.currency;) works with (menu-> inv-> currency). As shows no value (stats->currency;) called with a variable MenuInventory (currency)
I have also looked to (stats->currency = currency;) (same)
From MenuStash with a button (test) I want to add gold to currency:
if (TestGold-> checkClick ()) {
LootManager :: getInstance () -> playCurrencySound ();
stats-> currency + = 100;
}
when I press the button, the sound it makes, but the currency did not increase, I tried adding (class MenuManager) and try calling him MenuManager
menu-> inv-> currency + = 100;
menu->inv->addCurrency(100);
But just when I press the button, the game break, I tried to change everything that contained "menu-> inv-> currency" by "stats.currency" in MenuInventory, SaveLoad etc... and it worked. (I can see that every time I hit the button, the currency of the inventory up 100)
I think the change is not caused by not updating the currency of inventory when enter a value from (stats->currency;)
The question I have is how I can call the currency without having to change all currency called from the MenuInventory and SaveLoad
Sorry for my english, i,m use Google translator
menu->inv->currency is the actual amount of gold that the hero has.
You should ignore stats->currency, it is only used in unusual situations and will probably be refactored.
how I can increase the value of menu-> inv-> currency MenuStash from a button? In MenuStash.h i put class MenuManager and in private
I put in the header (MenuStash.h) and the necessary classes and corresponding header in MenuStash.cpp.
It gives me error or warning in the compilation, but when I press the button to increase the value of the game breaks, it must be because you lack something yet to add to MenuStash or so it seems.
Are you trying to add gold storage to the Stash?
If so I'd suggest skipping this feature for now.
We have a temporary solution with Gems: gems retain 100% of their price when selling, so players should buy gems and store those in their stash.
Long term we are considering converting gold to a stackable item that goes in a regular item slot. If we do that, moving gold to the stash will automatically work.
Yes, i,m trying add gold storage in stash, only for test new adds to source, here i have one ss
Works this way:
- Add "currency" to stash.txt
- 2 WidgetButton, X Green Withdraw gold storage and add gold to inventory currency and X Blue Deposit gold of inventory to stash
- 1 WidgetInput (Here i need one to get integers and set integers)
But it is only a test, I want to see how they would work these things, I like to "touch" in the code and see what new things come out xD
P.D: Good idea saved money into form of gems
Mind the discussion at
https://github.com/clintbellanger/flare-game/issues/282 and
https://github.com/clintbellanger/flare-engine/issues/546
The general agreement seemed to me as if treating gold as item instead of making even more exceptions for gold was the concensus.
i can add this "patch", you can close the thread :)