Download

Giving the player the ability to "buy" a building

Hey everyone!

So, a friend of mine and I are making a game where the player will be in a small town (made up of maybe 10 buildings, for example), and will be able to choose between some number of those buildings (for example, 5) to purchase for himself. He will have the ability to buy more than one of them once he is able to afford it.

For anyone who might have experience in this realm, what would you guys consider to be the best way to go about handling this?

My current idea is to create a blueprint out of each individual building (since they’ll each be different) and have some kind of isOwnedByPlayer boolean or flag or something in the blueprint that will be false from the start, but set to true once the player purchases the building. Then I can check that boolean inside of the blueprint to determine whether or not the player owns the building, and if so, do certain things that can only happen when the player owns it.

Is this the best way to go about doing this? It feels like this is a very simple way to do something that sounds like it should be more complex, but it doesn’t seem like it has to be more complicated than that.

Thanks for any input!

Just create 1 blueprint for “building” (you can use child blueprints for different types of buildings if you want, or just assign the static mesh differently) and give it a variable on it of “Owner” assign that to the player when he purchases it.

You can then drop the building blueprint into the level 10, 100, 57463 times or however many you want and they will all work the same way

I’ll give that a try! Thanks for the response.