Random function constantly picks new numbers... How to prevent this?

FlyboyTrevy_FlyboyTrevy_ Member, PRO Posts: 148

So I have an attribute that has a couple of random functions within the equation. The problem is, the game constantly picks a new random number as the game is in runtime. How would I set it so that when the equation starts it just picks one and goes with it.

Comments

  • SummationSummation Member, PRO Posts: 476

    @FlyboyTrevy_ said:
    So I have an attribute that has a couple of random functions within the equation. The problem is, the game constantly picks a new random number as the game is in runtime. How would I set it so that when the equation starts it just picks one and goes with it.

    Just take the random out of the behavior that's causing it to constantly fire?

  • SocksSocks London, UK.Member Posts: 12,822

    @FlyboyTrevy_ said:
    So I have an attribute that has a couple of random functions within the equation. The problem is, the game constantly picks a new random number as the game is in runtime. How would I set it so that when the equation starts it just picks one and goes with it.

    Change self.R to random(a,b)

    Then use R where you are currently using the random function.

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    Without seeing your rule, it's hard to know what you mean exactly and why it might be a problem.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • FlyboyTrevy_FlyboyTrevy_ Member, PRO Posts: 148

    @Socks said:
    Then use R where you are currently using the random function.

    Well I thought of putting it into an attribute, but im spawning off 15-20 of the same actor, and I want them to each have different values in that formula.

  • SocksSocks London, UK.Member Posts: 12,822
    edited May 2015

    @FlyboyTrevy_ said:
    Well I thought of putting it into an attribute, but im spawning off 15-20 of the same actor, and I want them to each have different values in that formula.

    Yes, the code I posted above will work fine for that.

    Change self.R to random(a,b)

    Then use R where you are currently using the random function.

Sign In or Register to comment.