GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

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 Posts: 10,383Member, Sous Chef
    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 Posts: 397Member

    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 Posts: 11,845Member, Sous Chef, PRO, Senior Sous-Chef
    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

This discussion has been closed.