Rules Question (not reacting as intended?)

freshfishfreshfish Member, PRO Posts: 49
edited April 2012 in Working with GS (Mac)
Hello,
It is really strange but I thought a rule always runs while the conditions hold true.
Example:

When All Conditions Are Valid
enemies > 0
Spawn New Enemy

The above is just an example but I would assume that it will keep spawning enemies until enemies=0.
It doesnt work with me. The only thing I can think of is that the methods I have in the rule are "actions" and not "behaviors" and are only executing once.

Do I really need to use timers for this? Or did I miss something obvious :S
Thanks for any help I can get on this

Best Answer

  • xforcexforce Posts: 187
    edited April 2012 Accepted Answer
    you need the timer. the spawn actor behaviour only fires off once unless you give it conditions to keep triggering. so you could do something like

    timer every 0 seconds spawn actor enemy

    which will work but it will spawn them like crazy unless you have another rule to stop it when it hits a certain number. make the timer a smaller number if its spawning too fast. 0.1, 0.05, etc

    so yes if you want it constant add the timer

Answers

  • stackpoolestackpoole Melbourne, Victoria, AustraliaMember, PRO Posts: 473
    edited April 2012
    quick question:
    did you have a counter for your enemies?
    (to count how many enemies you have)
  • freshfishfreshfish Member, PRO Posts: 49
    well I'm actually creating a grid on the fly (squares in a grid)
    And yup, I do have a counter

  • stackpoolestackpoole Melbourne, Victoria, AustraliaMember, PRO Posts: 473
    edited April 2012
    Hi

    So what you are asking is that spawning doesn't stop at 0?
    Just to clarify ~

    ~~
  • freshfishfreshfish Member, PRO Posts: 49
    I'm actuall building a grid with lots of squares and have a count to stop after x number
    But it was only firing off once as xforce stated despite my conditions not having been met. I did use a time to resolve it but wondered why action would not keep executing until the conditions have been met (in my case reaching x squares)

    From a technical standpoint it seems the rule has a state Boolean to see if it is a rule governed by behaviors or by actions....a behavior inside the rule will set that state to active till the conditions are met but not so in the case of actions in the rule....

    Does that sound about right?
  • MotherHooseMotherHoose Member Posts: 2,456
    @freshfish … rules in general fire/trigger once

    but, to have a rule fire till all conditions are met … without using Timer behavior:

    demo: http://www.mediafire.com/?32suav885g8p0j6

    image MH
Sign In or Register to comment.