Hello everyone! How can I subtract or add gold from a player's current amount? For example, a player has 2500 gold, and after completing a quest, they receive 1000, resulting in a total of 3500. I tried to do it like this:
1) `gold = GetPlayerResource(1, GOLD);` - I declared a variable.
and used this command to change the player's gold amount:
2) `SetPlayerResource(1, GOLD, gold - 1000);`
3) But the command doesn't work correctly. It does change the player's gold amount, but not as it should. Instead of 3500 gold, the function gives approximately 45000.
1) After executing this command, did you try outputting the value of `gold` to the console? Does it correctly display the gold amount, and does it match?
2) There's no way to verify the correctness of this command. But I wonder, why not do all the calculations before executing the `SetPlayerResource` command? And why is there a "-" if you said the player received +1000 gold?
3) Could you provide a screenshot of the console and the code? It can't just appear out of nowhere that the amount is 45k.