1
Ask a Question / Re: [HELP PLEASE] Spawning an Actor
« on: October 25, 2018, 09:29:02 am »
Here is a suggestion:
If I understand you correctly, you want the player to start the game in a random spot when the game is first loaded, but then spawn in regular predictable locations (like depending on what direction or previous location the player entered the scene from or something) all other times, right? Well, you could use a global boolean variable, like "firstTime" or something that starts out true. When the game first loads, if firstTime = T, move the player to a random spot and set firstTime to F. If it really is just the randomizing code in the creation block that is causing the error, this would work around that. And actually, you could probably use a similar technique if there are other times than the beginning of the game that you want the player's spawn location to be random: whenever you want that to happen, you just set the global variable to true before switching to the next scene. Does that help?
If I understand you correctly, you want the player to start the game in a random spot when the game is first loaded, but then spawn in regular predictable locations (like depending on what direction or previous location the player entered the scene from or something) all other times, right? Well, you could use a global boolean variable, like "firstTime" or something that starts out true. When the game first loads, if firstTime = T, move the player to a random spot and set firstTime to F. If it really is just the randomizing code in the creation block that is causing the error, this would work around that. And actually, you could probably use a similar technique if there are other times than the beginning of the game that you want the player's spawn location to be random: whenever you want that to happen, you just set the global variable to true before switching to the next scene. Does that help?