Game attributes are not being updated to change the spawn rate...

youdvdkyoudvdk Member, PRO Posts: 21

Hello. I have been working with this problem and have researched/tried a few different ways to get my spawn rate to increase every 10 seconds. Here is what I have right now:

Spawner:
When attribute game.SpawnLimit is equal to or greater than 0, then every game.SpawnMore seconds (set at 1 second to start) spawn actor.

SpawnLimit is set at 30 and whenever the actor spawns then it subtracts 1 and when the spawned actor gets destroyed it adds another. It is just set to have a limit. Also, every 10 seconds game.SpawnMore is subtracted by 0.1.

I have the attributes game.SpawnLimit and game.SpawnMore displayed so I know they are changing the way they are supposed to.

The main problem right now is that the spawner doesn't update the new game.SpawnMore, so it only spawns every 1 second all the time.

If anyone has an idea please suggest it. I would greatly appreciate any help.
Thanks.

Comments

  • LovejoyLovejoy Member Posts: 2,078

    Try changing your game.SpawnMore to a Real Attribute.

  • youdvdkyoudvdk Member, PRO Posts: 21

    It is a real attribute already, but thanks :)

  • LovejoyLovejoy Member Posts: 2,078

    Can you take a screenshot of your rules so i can see?

  • youdvdkyoudvdk Member, PRO Posts: 21
    edited September 2014

    Here it is:
    https://www.dropbox.com/s/het8vmvjgjjbob1/Screen Shot 2014-09-06 at 10.12.49 PM.png?dl=0
    The first attribute is game.SpawnLimit and in the spawner it's every game.SpawnMore.

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    Uncheck run to completion

  • youdvdkyoudvdk Member, PRO Posts: 21

    @The_Gamesalad_Guru‌ Unfortunately that didn't work either.

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    I see where you are changing the spawn limit where is the code for changing the spawn time?

  • youdvdkyoudvdk Member, PRO Posts: 21

    Ok. Here it is. It is within the same actor, and is the second change attribute in that timer. Right now it changes game.SpawnMore to game.SpawnMore-0.1. I also turned the increase of game.SpawnLimit off just for testing purposes.
    https://www.dropbox.com/s/z9dtoulm27p685k/Screen Shot 2014-09-07 at 7.19.45 PM.png?dl=0

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    I'm confused as you are also changing the limit in the other rule too. Could you tell me more about how you want this to work? Then I can come up with how the code should be.

  • youdvdkyoudvdk Member, PRO Posts: 21

    Alright sounds good. I will try be as clear as possible. Don't worry about the spawn limit. I think I'll be taking that out anyways once I get the game.SpawnMore to work properly. All I am trying to do is have game.SpawnMore to decrease by 0.1 every 10 seconds (that is what it is set at right now). It does decrease, but the spawner doesn't seem to update that new value for game.SpawnMore every 10 seconds. It always spawns at 1 second, as the original game.SpawnMore value. It seems like it should be very easy to fix, but I am just not getting it. If you need more explanation please just say so.
    Thanks.

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited September 2014

    Hi @youdvdk The reason why the SpawnMore doesn't update in a Timer is there's no constrain code written into that particular behaviour - so it'll take the first value, via an attribute or not, and go with that for its "Every".

    Here's a small test for you to get around that - it involves a loop I devised (not an original idea tho', I know) a few years back now, for toggling back and forth with the use of a boolean. I'm sure you'll be able to weave it in using the principles shown into your programming.

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    Oh yeah I forgot about that. You could always use a every self timer with a mod too and adjust the function.

  • youdvdkyoudvdk Member, PRO Posts: 21
    edited September 2014

    Thanks so much guys. I am in college at the moment, but I will definitely try that when I get home this afternoon. And would, instead of changing attribute every 10 seconds, it work to constrain attribute for changing game.SpawnMore to game.SpawnMore-0.1?

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    No do what gyroscope said

  • youdvdkyoudvdk Member, PRO Posts: 21

    IT WORKS!!! Aww man I'm so happy!! Finally!!! Haha. Thanks so much guys!

  • youdvdkyoudvdk Member, PRO Posts: 21

    Alright. Now that apparently created another problem. I have 4 actors that randomly get chosen to be spawned. Every game.SpawnMore seconds a "Spawn Selector" selects which will be spawned next. This isn't the problem, but it adds to my system that i have in place. I also got rid of the game.SpawnLimit attribute, so that is completely gone. I changed every thing to the code that @gyroscope gave me except the four added actors to spawn. The attribute game.SpawnMore seems to decrease just fine, but it spawns more actors than it should now. Im not really sure how to explain it further, but if someone asks some questions I should be able to answer them. Here are the rule files:
    https://www.dropbox.com/s/focitrg7c1ooxqe/Screen Shot 2014-09-08 at 5.29.49 PM.png?dl=0
    and
    https://www.dropbox.com/s/y4zp9bkwm9ya10d/Screen Shot 2014-09-08 at 5.34.36 PM.png?dl=0

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    Put the spawn behavior in a "for" timer and set the time so it only spawns so many.

  • youdvdkyoudvdk Member, PRO Posts: 21

    Yeah if you look at my last dropbox file link, I just have the added game.spawn attribute that I have for selecting which actor of the four to spawn. I previewed the game again and I see that it spawns two actors at a time, only sometimes. Once we eliminate that I'm pretty sure that would be it. When I put the Spawn Actor, in the Spawn Actor 1 rule, under the Spawner rule and turn off the Spawn Actor 1, 2, 3 and 4 rules then it works great. Once I add the Spawn Actor 1, 2, 3 and 4 rules again, it does the same thing as before. Here is the code for selecting the actor to spawn cause maybe that is whats wrong:
    https://www.dropbox.com/s/y4qj41ysjmyxf8p/Screen Shot 2014-09-08 at 7.38.58 PM.png?dl=0
    The attribute is every game.SpawnMore seconds.

  • youdvdkyoudvdk Member, PRO Posts: 21
    edited September 2014

    @The_Gamesalad_Guru‌, This problem still hasn't been fixed.

    Sorry, I just fixed it. To do this I put the spawn selector after each actor spawns so that it will always choose a new number to spawn.

    Thanks for all your guys' help!
    Much Appreciated.

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    Yep you need to remember code inside an actor fires in order top to bottom.

Sign In or Register to comment.