2 or more random spawners not having the same numbers?
in Tech Support
If I have 2 or more spawners that spawn actors are random times between 1-10, how do I make it so they don't get the same numbers? Thanks!
Comments
You don't. You use a single spawner actor and add a random interval after each spawn behavior so that they never overlap. This might help: http://forums.gamesalad.com/discussion/comment/464547/#Comment_464547.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
so it's only possible for single spawners? and not multiple ones..
The original question is a little vague (for me). Can you explain what you want a little more? For example, do you want it so that the two actors don't spawn an actor at the same moment?. Or do you want the second actor to come up with a random number that is always different from the first actor?
More detail may help.
I'm not saying it's impossible... I just can't conceive of how to do it so I'd recommend using a single spawner actor. Unless you can't for some reason.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
I guess so, my question was if I could have 2 spawners that spawn each spawn an actor at random intervals to not have the same intervals as each other? So at least one second away would be fine. Thanks
So... can spawner1 give a time of say 8 seconds. (Meaning that 8 seconds from now its going to spawn an actor.) And then 5 seconds from now, spawner2 is going to throw out a random time of 3 seconds. (Meaning that 8 seconds from now it is also going to spawn an actor.) Is that allowable? Or is that what you are trying avoid?
Oh no, i'm avoiding that. So I want it like, if spawner1 was 8 seconds, then spawner 2 is 5 seconds or something like that. As long as they don't spawn out the actors at the same time.
So... they can't spawn at the same time, but can the two spawned actors ever be on the scene at the same time?
For example, if spawner1 spawns actorA and spawner2 spawns actorB -- can actorA and actorB exist on the scene at the same time? (Can their time on the scene overlap?)
Hmm.. let me ask it a slightly different way. Do you just want actorB to delay its arrival so that it isn't spawned at the very same second that actorA is spawned? (But after that they can exist on the scene together. Only their arrival time must differ.) Or do you want it so that actorA and actorB can only spawn when there isn't another another actor present.
ahh this is confusing :P I just want it so in spawner A, it the time is random between 1-10, as well as spawner b. I just don't want the two spawners to get the same time in the random timer. E.g. if spawner a is 5 seconds, and spawner b is 5 as well, then I don't want that. However if spawner a is 5 and spawner b is 6 its fine by me. As long as the numbers are never the same
I'm sorry my questions are confusing. I honestly am trying to understand what you are asking for!
Your last answer did not help, unfortunately. I think you are not taking into account the difference between the random spawn times and real time. I think you are conflating the two. For example, your last answer conflicts with the previous one. In your last answer, you can still have actors spawning at the same time. (Just because the the spawn intervals are different, does not mean that they won't overlap at some point.)
Here are some more clarifying questions:
How many times do the spawners fire? Is it only once? Or are they continue to spawn new actors every few seconds?
well i want them to continue to fire every random seconds, so it doesn't stop. oh well, real time or random time, since the actors being spawned move to the right but at different y positions, i just dont want it so those two actors move at the same time
@RThurman I think the idea is that once one actor spawns, the next should spawn 1-10 seconds afterward. When the second spawns, the next should spawn 1-10 seconds after that. When the third spawns, the next should spawn 1-10 seconds after that... etc.
This is why I recommended a single spawner actor. Once a spawn occurs as part of a custom timer, you just reset the timer and spawn the next actor. If you have two different actors, then you alternate the value of an attribute so that it spawns one then the other.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
In my game I just released, Stormy Skies, I had an actor that spawned the actual spawners ( a spawner spawner, if you will) and each of those spawners in turn remembered which one they were through use of a global attribute (numSpawners) and a local attribute (spawnerNum).
spawnerNum was numSpawners+1, and that was changed before it did anything else. I then used that value to set up individual behaviors for spawning for each one. You can also utilize each spawner's self.Time attribute in a similar way.
@tatiang -- I think its more about placement than timing. @justinodunn is trying to get multiple spawners to act in coordination. But I think it only seems like a timing issue because he is trying to use several spawners. If you take that away, (and just use a single spawner) its just a placement issue.
@justinodunn -- please take a look at the attached example and let us know it its close to what you want. (Its kind of a fun issue and interesting to work on.)
If its not what you want, then the next option is to modify it so that it uses a vairable-interval-timer as @tatiang suggests.
Yes that is what I want! As long as they don't move together (one on directly on top of the other) then it's fine, did you look at my game?
Yes, looking at the game helped. Glad it will work for you.
So the file you attached shows the spawners that will never spawn actors that will go directly on top of each other?
Yes, it is impossible for an actor to spawn 'directly on top' of another because each actor is being spawned exactly 1 second apart.
Try an experiment. Run the file for 30 minutes and observe each spawn. See if you can find an actor that is spawned in the same space as the previous one.
awesome, let me take a look and report back![:) :)](http://forums.gamesalad.com/plugins/emojiextender/emoji/twitter/smile.png)
Do I have to use that code for each spawner? or just one of them? or do i delete all spawners and make one spawner?
You need just one spawner. As you can see, it spawns all actors and places them in their appropriate row/lane/space.
Okay, but what about the rate of spawn? could it be adjustable? How can I cause the actors to spawn in a random order in a set of specific y coordinates?
Ah... now your getting back into it. Yes you can, but you need an adjustable timer that you will need to build. (The regular timer is not adjustable.) That is what @tatiang was saying. Look at his first comment in this thread. He put a link (with a demo file) that shows how he built an adjustable timer.
actually thinking about it, could it be possible to just not have a repeated number in the random timer of the multiple spawners? Or could it be possible to have it so that actor 1 has like a minimum distance away from actor 2 when they are spawned?
Yes, its all possible. But will it be 'better'?
You can design all sorts of game mechanics. Then you can test them against each other. That is one (of many) great things about GameSalad.