Expressions in Attribute Browsers

I'm trying to make a rule so that if an attribute modulated by 2 is equal to zero (if it's an even number) then have it do something, but I can't add expressions when putting in my attribute using the attribute browser, I've tried clicking on the text box, and I can't seem to edit it at all other than add an attribute or remove it. Is there any way I can do this? The equation I'm trying to do (in code) is "If Game.Wave Number % 2 = 0 then do whatever."

Having trouble with your game? Sounds like a personal problem.

Comments

  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    i think you have two options:

    1. create a self.attribute and give it a value of 0, then you can have a rule that says "if self.Attribute = game.Wave Number % 2 then do whatever.

    2. seperate the modulation out into another function(this is what I do), and have two rules that say if game.WaveNumber = 0, do this, if game.WaveNumber = 1, do that.
  • ADSentertainmentADSentertainment Member Posts: 397
    i think you have two options:

    1. create a self.attribute and give it a value of 0, then you can have a rule that says "if self.Attribute = game.Wave Number % 2 then do whatever.

    2. seperate the modulation out into another function(this is what I do), and have two rules that say if game.WaveNumber = 0, do this, if game.WaveNumber = 1, do that.
    I was thinking about doing the first one, since the rules of math say that it works on both sides of an equation :P thank you

    Having trouble with your game? Sounds like a personal problem.

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    The first option works fine. You can make it a game attribute (game.ZERO) and use it whenever you need it.

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

Sign In or Register to comment.