• News

• Industries

• Learning & Support

• Community

• Marketplace

# Help money system in game.

Hi, i’m not very experienced with blueprint but i’m studying and i have a problem with money system. I have created a hud for draw my copper money and silver, after i have created blueprint mesh copper and silver in the level and when my character overlap the trigger of my blueprint mesh, my copper or silver, depend of the mesh, increase by 1. I have created the same blueprint for copper and silver, but when i pickup they increase by 1 every time. For example in my case ( copper = 100, 101, 102, ec… silver 100, 101, 102, ecc) i want set 100 copper = 1 silver and 100 silver = 1 gold. How can i make this whit blueprint? The same of world of warcraft money system. Sorry for my bad english >.<

Hi Damian_Velasco,

Do a branch each time one is picked up. Set the integer values to check and see if copper >= 100 (same for silver, gold, etc.). If copper >= 100, set copper = 0 and add +1 to silver. This should be very doable in blueprints.

WORKKK!!! thx i’m really happy. XD

You mean set copper to copper - 100.

Well that depends, if you increase it by 1 every time and check if copper >= 100 immediately after it then there is no difference.

hey i found a bug. if copper >= 100 silver +1, but if silver >= 100 and i pickup 100 copper, copper become 0, silver become 1 but i lost 100 silver. I do not know if I explained

create a variable which stores the overall copper amount (Keep internal stuff simple) and use the Modulo operator for calulation

quick pseudocode example:

``````
Int Money = 1023456 //overall Money
Int Copper = Money

Int Gold = Copper / 10000 // Gold = 102
Copper = Copper % 10000

Int Silver= Copper / 100 // Silver = 34
Copper = Copper % 100 // Copper = 56

``````

can you explain with blueprint pls ?

Are you setting silver to Int+int (silver+1)?

this is my blueprint in character blueprint, for silver and coin. I think the problem is in the sequence for both which resets my current silver and copper. Excuse my ignorance , recently got into this field.

the problem is that you set it to 0 instead of subtract 100
and you shout have a loop (in case of more money).

wouldnt this be easier to do something like this have 2 variables for each current copper and max copper, current silver, max silver current gold max gold. then with your max copper you can can do a branch and do something like this if 100 copper is reached add 1 silver then subtract 100 copper to bring you back to 0 and do the same with silver to gold then you can also make a function that will take your currency away and add it to shop events so that way every time you buy something the shop will read what was taken and subtract it from your current.

thanks for the answers , now I see what I can do with this tips.

hi, i changed “Total Silver coin set to 0” with " Subtract by 100 Total Silver coin" in the silver coin blueprint and all works. I added a statich mesh in the level and in the event graph i copied the same blueprint of my static mesh for silver coin, and instead of +1 silver, is -1 ( this is for simulate the “buy” potion and it cost is 1 silver). But my problems begins when i haven’t coin and when i pick potion my silver become -1, and the other problem is when i have 1 gold, my money instead of becoming 99 silver, becomes 1 gold -1 silver 0 copper. Sorry for my bad english, and thx for help. I insert a picture of event graph of my static mesh that simulate a potion.

this is why I recommend a total money variable and calculate gold,silver and copper only to display them.