Hello everyone and sorry for my English because I am French.
I have a problem, I create a survival game in which we invoke a person who is hungry and thirsty.
Here is the problem is that I made the bottle of water that goes up well the bar of thirst and that disappear, maintain I will like to make a reaparition of the bottle of water 5 seconds after the avoire taken for example.
I searched a lot, I looked in addition to the videos but I do not find anything that explains how it could work.
Thank you for your reply!
If possible in image of the software explains me, because I do not speak very good English.
Thank you !
I’m guessing from what I read you want an object to spawn in the game like a waterbottle, and if the waterbottle is picked up/used/destroyed spawn another water bottle 5 seconds later? If that’s what you meant I would recommend making a generic actor that’s dedicated to spawning objects.
What you might want is to make a spawner whose object it creates has a reference to the actor it spawned from/was created from. This way if the waterbottle actor is destroyed/pickedup, or for example an enemy is destroyed, the spawner recieves input from the object it spawned telling the spawner to create a new one.
Here’s a simple example of a Spawner, and an object spawned from the spawner that tells it to create a new actor when its pickedup function is called. The MaxAliveActors integer variable can be higher than 1 by default, to spawn in more actors if wanted for something like multiple NPCs per spawn point.
Using a counter method, you could expand on this to make it so that the spawner would eventually become exhauted and destroy itself by having another counter that just adds 1 for each actor spawned, and when reach its Max, destroy itself.