Spawn Limit

http_gamesaladhttp_gamesalad Member Posts: 1,340
edited August 2014 in Working with GS (PC)

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?

Link

Comments

  • pHghostpHghost London, UKMember Posts: 2,342
    edited August 2014

    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.

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    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

  • pHghostpHghost London, UKMember Posts: 2,342

    @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).

  • Speedy007Speedy007 Member Posts: 229

    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.

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    @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?

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    & @pHghost want me to post a photo of the rules I put in or the gameplay?

  • Speedy007Speedy007 Member Posts: 229

    Lets see the rules....Yeah by default the integer starts out as 0 so set it to how many actors you want to spawn...

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    @speedy I made a youtube video of it

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    Sorry about the bad audio and stuff but I hope it helps

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    @pHghost hope this helps :) thanks

  • pHghostpHghost London, UKMember Posts: 2,342

    @Speedy007 said:
    You want to spawn a certain number of actors? You could always try an integer set to five and put a rule as follows...

    [...]

    so every time an actor spawns it lessens your integer. And it should only spawn as many actors as the number of your integer.

    @http_gamesalad said:
    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?

    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.

  • pHghostpHghost London, UKMember Posts: 2,342
    edited August 2014

    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

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    @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?

  • pHghostpHghost London, UKMember Posts: 2,342

    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.

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    @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?

  • pHghostpHghost London, UKMember Posts: 2,342

    @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.

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    @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 :)

  • pHghostpHghost London, UKMember Posts: 2,342

    @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.

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    @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

  • pHghostpHghost London, UKMember Posts: 2,342

    @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.

Sign In or Register to comment.