So basically i’m making a game where the player needs to collect scraps. When the player has enough they walk into a location and a building appears. Any idea how i can do this?
So you want a building to appear and to have the player automatically walked towards a location?
Does the player keep an array of these scrap objects?
basically when the player is already already in the location the building appears, and yeah the player keeps an array
Okay, you can check the length of the array to determine if the player has collected enough scraps. If so, I’m not sure how you’re hiding the building now but if it’s an actor you can use “SetActorHiddenInGame” to hide or show the building.
if you werent using an array the pictures below would be the way to do it. since you are using an array you will need to do some things similarly. on overlap you add a index to the array. when going to create the building you will need to get the length of the array as mentioned by Velrin and compare it to the need number of scraps, if its enough you will need to remove indexes by either using a loop or by using the resize node. as for the building itself you could toggle visibility or you could spawn in a new building, it depends on the situation, for example if you wanted to give the player a choice of which building type they wanted then spawning would be the way to go, but if you want more control and have a set building that you want to be spawned then toggling vis/hidden would work well.