Spawn Limit
http_gamesalad
Member Posts: 1,340
I followed this video very simple, but it doesn't spawn the right amount of numbers . I wanted to spawn 5 but sometime it only spawns 3 then if I restart it it only spawns 2 then I restart it again it spawns only 4. It spawns everything else besides the number I really want it spawn LOL. I'm I the only one getting this problem?
Comments
Re-check your rules and also put up a display that shows your 'howmany' attribute, to see what is happening in background while the spawning happens, if you haven't a display already.
If the display shows the right number, but the number of spawned objects is wrong, you most likely have a mistake in the rule adding +1 (or -1) to the counter.
If both counter and spawned objects are wrong, there has to be an error in setting the limit number.
I was up all night redoing it & I'm not getting the right amount of spawn. I Must have re entered it like 8 times @pHghost
@http_gamesalad -- well, what is the counter display showing?
If you can also post a screenshot of your rules, it might help...
As you can see in the tutorial, it works in principle. So there has to be something slightly different in your code (or it is a PC build bug).
You want to spawn a certain number of actors? You could always try an integer set to five and put a rule as follows...
When Integer is More than 5 Do spawn actor every 1 second(Change this time to fit your gameplay) and Change Attribute Integer to game.Integer-1.............
so every time an actor spawns it lessens your integer. And it should only spawn as many actors as the number of your integer.
@Speedy007 Thanks bro I never really thought about that! So what youre saying is that I should change the number from 0 to 5 on interger?
& @pHghost want me to post a photo of the rules I put in or the gameplay?
Lets see the rules....Yeah by default the integer starts out as 0 so set it to how many actors you want to spawn...
@speedy I made a youtube video of it
Sorry about the bad audio and stuff but I hope it helps
@pHghost hope this helps thanks
Wait, isn't that exactly what the first video you posted is recommending you do? I thought you did that and it didn't work.
OK, looking at your second video, I think the problem is that you don't have the add +1 to how_many in the timer spawning the zombies.
So, basically, you need --
RULE: when (how_many) < 10
TIMER: every 0.5 seconds -- I would also uncheck run to completion
Spawn -- zombie + change att: (how_many) to (how_many)+1
That means every 0.5s, you both spawn a zombie AND add to how_many -- because how_many needs to count ALL the spawned zombies
@pHghost okay you want me to put the change attribute in the same rule as the spawner? So I won't have the change attribute in my Zombie actor it'll be in the Top spawner from now on?
It has to be in the same timer that spawns the zombie actors. That's the way I would do it.
It is possible to do it by putting the change attribute into the zombies as well, it works out the same, but since it's not working for you at the moment, try it like this, to see what happens.
@pHghost I put the change attribute in the timer with the spawner. So what I have is
Rule:
If game.howmany < 10
Do:
Timer Spawn Zombie 2
Change attribute game.howmany to game.homemany+1
It's not spawning 10 it spawns like 4 or sometimes 7. Would you mind trying it and see what you get so I know I'm not the only one who's getting this problem?
@http_gamesalad -- I set up mine according to your description in in your previous post and it all works perfectly.
Are you sure the zombies are not being spawned? Is it possible that some of them are just not falling down to where you would see them, staying off-screen?
If that is not the case, try this:
Copy your project. In the new copied project delete EVERYTHING except: one spawner prototype actor, one zombie prototype actor, one display actor and the how_many attribute.
Try again. If the problem is gone, it means it is caused by some of the other elements in your game. You'll have to go through them and find which one and why.
@pHghost Okay I will just restart all of it and do the spawner limit first I didnt get to far so it should take me about an hour to get where I was
Cheers
@http_gamesalad -- I don't think you need to start over. Just as a test copy the project and delete all extra actors and attributes. Since you copy it, you won't lose your work on the original project. And it will help you figure out what is causing it.
Finding out what is causing it and why will be a great way to learn something about GameSalad, as it will reveal what to look out for in future projects.
@pHghost I found out what my problem was (I feel so stupid LOL Face palm) I told my actor to collide with the spawn er so when I spawned something it would get trapped on the spawner BUT thank you bro Thanks for your time
@http_gamesalad -- I thought it might be something like that. Don't worry, that's the learning process. Now you know why it happened, and what to avoid next time.