Spawn actor help

Hello , I have a condition for the hero, each time that game.position.x > =450 spwan actor, all well but when the hero returns to a game.positionx <450 , then its position is >= 450 appear spanw actor 2, then 3, etc, how do I get that there is only a spawn actor?, thanks.

Comments

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

    Hi @agueis If you mean you only want the spawn to happen once then use something like the following (one way to handle it): make an integer attribute called Trigger

    In your actor hero, put in its rules:

    Rule: When Position >= 400
    When Attribute Trigger =0
    Change Attribute Trigger to 1
    Otherwise
    When Attribute Trigger =1
    Change Attribute Trigger to 2

    Rule: When Attribute Trigger = 1
    Spawn

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • agueisagueis Member Posts: 420
    I have already resolved, I use an attribute called counter and the rule :when the position is > =400 and self.count=0 count=count+1, sapwn actor Thanks
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited December 2013

    Exactly the same as I suggested except with one crucial difference: if you've got your spawn happening when count is 1, it'll always happen every time your hero goes past 400 with your way… I thought I understood from your question you only wanted the spawn to happen once, hence changing the attribute to 2 in my version to avoid this.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • agueisagueis Member Posts: 420
    Works well, because the integer attribute counter has an initial value of 0, he past one time: rule is true :spawn actor, hero past second time the value is 2, false , not spawn actor,greetings
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598

    So it's identical then; glad to know we're thinking on the same lines, shame I wasted my time when you knew the answer to your own question… ;-) (You say "count" and I say "Trigger"… :P )

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

Sign In or Register to comment.