Transferring Property Values


This is my first post on the forum. I am not necessarily new at the Blender Game Engine, in fact I have a good bit of experience with it. However, I have next to no experience with Python scripting, and so if its required, please bare with me as I try and make sense of it. Thank you.

I am currently designing a dungeon exploring game that is based on random generation. Random loot, random enemies, random rooms, etcetera. However, I’ve run into an issue that I cannot fix for the life of me.

The player walks up to a chest, and activates it. A random actuator goes off, using the “integer uniform” setting, and it chooses a random number between 1 and 199. This value represents how much gold is looted from the chest.

The issue I have is that I have no idea how to replicate / transfer this integer to my gold gold counter, which is an integer on another object. I need the gold that is acquired to be added to the player’s gold stores.

If it helps, an example: the random actuator chooses 120 as its amount. The player already has his starting 100 gold. I need that 120 to be added to the 100 to make 220 gold. But I have absolutely no idea how to do this.

Any help that can be provided will be greatly appreciated. Thanks in advance.

Thank you. This is super helpful. I’m going to try and mess around with this once I get a free moment. Also, thank you for the guides as well. They’re likely to help me quite a bit.
Here is the way I would do it. Press spacebar to add more gold.

On the treasure chest, I would give it a property int. called “chest” with the random set for however you have it.

On the player, I would make a property called “Gold” (players total gold) and a property called “chest1”. (players found gold copied from the chest) Both int.

So. . . To copy the property from the treasure chest “chest” to player “chest1”

On the player camera or whatever, always True----and-----copy property “chest1”
from treasure chest, property “chest”
Then I would do a property changed-----and------Assign property “Gold”
value: Gold + chest1. Type it without quotes, as it’s not looking for a string, but rather the player property Gold, and chest1.

So everytime the property is changed it adds players Gold with chest1.