How do you calculate an image change with a timer of %

natclarkenatclarke Brisbane, AustraliaMember, PRO Posts: 243

Hi

I have an attribute where I want to time the energy of my character, which is set between 0 and 100 %

How do I set up a range rule when the % is between 50 (.5) and 80% (.8) change image 1 to image 2

regards

Nat

Nat Clarke
Life Cleansing

Comments

  • SocksSocks London, UK.Member Posts: 12,822
    edited April 2017

    When all the following conditions are true
    attribute 'energy' is > 0.5
    and
    attribute 'energy' is < 0.8
    --change image to 2

  • natclarkenatclarke Brisbane, AustraliaMember, PRO Posts: 243

    Thanks socks. What do you do if you have a few more attributes within the range i.e hunger, happiness and energy and health?

    Nat Clarke
    Life Cleansing

  • pHghostpHghost London, UKMember Posts: 2,342

    You can add as many conditions as you wish.

  • natclarkenatclarke Brisbane, AustraliaMember, PRO Posts: 243
    edited April 2017

    I am using doing the following but it is not working at all in changing the image. I am not sure what I am doing wrong with these rules

    Rule 1: Image 1 (Range: 90.1 to 100 % for health, happiness, energy & Hunger 0-9.9%)

    Numeric expression 'game.health','game.happiness','game.energy' <0.901
    Numeric expression 'game.health','game.happiness','game.energy' >1
    Numeric expression ' game.CSHunger ' < 0.99
    Numeric expression ' game.CSHunger ' > 0

    Rule 2: Image 2 (Range: 50 to 90 % for health, happiness, energy & Hunger 10-50%)

    Numeric expression 'game.health','game.happiness','game.energy' <0.9
    Numeric expression 'game.health','game.happiness','game.energy' >0.5
    Numeric expression ' game.CSHunger ' < 0.5
    Numeric expression ' game.CSHunger ' > 0.1

    Change image to image 3 (Range: 34% to 49.9 % for health, happiness, energy & Hunger -50.1%-67%)


    Numeric expression 'game.health','game.happiness','game.energy' <0.499
    Numeric expression 'game.health','game.happiness','game.energy' >0.34
    Numeric expression ' game.CSHunger ' < 0.63
    Numeric expression ' game.CSHunger ' > 0.501

    Change image to image 4 (Range: 17% to 34.9 % for health, happiness, energy & Hunger 67.1% to 84)


    Numeric expression 'game.health','game.happiness','game.energy' <0.349
    Numeric expression 'game.health','game.happiness','game.energy' >0.17
    Numeric expression ' game.CSHunger ' < 0.84
    Numeric expression ' game.CSHunger ' > 0.671

    Change image to image 5 (Range: 0% to 16.9 % for health, happiness, energy & Hunger 84.1% to 100)


    Numeric expression 'game.health','game.happiness','game.energy' <0.169
    Numeric expression 'game.health','game.happiness','game.energy' >0
    Numeric expression ' game.CSHunger ' < 1
    Numeric expression ' game.CSHunger ' > 0.841

    Nat Clarke
    Life Cleansing

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

    Can we see the rules you are using ?

  • pHghostpHghost London, UKMember Posts: 2,342

    Rule 1 you have a mistake.

    energy > 0.901 and < 1. You have it the other way around, so smaller than 90.1% and bigger than 100%. They can't be both true at the same time.

  • pHghostpHghost London, UKMember Posts: 2,342

    Also, what about the situations when NONE of these combinations are true?

    Say, energy is 0.480 and hunger is 0.3? That isn't covered by any of these rules. Or is the hunger and energy linked? If they are, why have two stats?

    I think the problem you have is not the GS code, but the general logic of your system.

  • natclarkenatclarke Brisbane, AustraliaMember, PRO Posts: 243

    I wanted to group the hunger which ranges from 0-100 and the energy. happiness and health that ranges from 100 to 0%

    The code is a virtual animal that I want to show their moods but I am not sure if the attributes are grouped or displayed correctly or how to achieve this if they are not.

    Nat Clarke
    Life Cleansing

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

    @natclarke said:

    Could we see one of the numeric expressions.

  • natclarkenatclarke Brisbane, AustraliaMember, PRO Posts: 243

    Nat Clarke
    Life Cleansing

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

    @natclarke said:

    'attribute','attribute','attribute' . . . . isn't a valid expression.

    Numeric expression is looking for something to calculate, so things like commas and quote marks won't make any sense to it.

  • natclarkenatclarke Brisbane, AustraliaMember, PRO Posts: 243

    what would i place there? Just one attribute and repeat the rules over and over again for each attribute. Health, Happines and Energy all have the same range of %. Is there a better way to do it? that groups the three attributes together?

    Nat Clarke
    Life Cleansing

  • SocksSocks London, UK.Member Posts: 12,822
    edited April 2017

    @natclarke said:
    what would i place there?

    Basically a calculation, so something like . . .

    When
    --Numeric Expression
    ----Level1Score+Level2Score+(Bonus*10)
    ----Is lager than 200
    ------Then do some stuff.

    . . . or maybe . . . .

    When
    --Numeric Expression
    ----Self.position.X + Self.Width
    ----equals 512
    ------Then do some stuff.

    @natclarke said:
    Just one attribute and repeat the rules over and over again for each attribute. Health, Happines and Energy all have the same range of %. Is there a better way to do it? that groups the three attributes together?

    What are the value ranges for each attribute ?

  • natclarkenatclarke Brisbane, AustraliaMember, PRO Posts: 243

    Rule 1: Image 1 (Range: 90.1 to 100 % for attributes: health, happiness, energy & Hunger 0-9.9%)

    health or energy or happiness >0.901
    health or energy or happiness <1 Hunger < 0.99 Hunger > 0


    Rule 2: Image 2 (Range: 50 to 90 % for attributes: health, happiness, energy & Hunger 10-50%)

    health or energy or happiness<0.9
    health or energy or happiness >0.5
    Hunger< 0.5
    Hunger> 0.1


    Rule 3: image 3 (Range: 34% to 49.9 % for attributes: health, happiness, energy & Hunger -50.1%-67%)

    health or energy or happiness <0.499
    health or energy or happiness >0.34
    Hunger < 0.63
    Hunger > 0.501


    Rule 4: image 4 (Range: 17% to 34.9 % for attributes: health, happiness, energy & Hunger 67.1% to 84)

    health or energy or happiness <0.349
    health or energy or happiness >0.17
    Hunger< 0.84
    Hunger> 0.671


    Rule 3: image 5 (Range: 0% to 16.9 % for health, happiness, energy & Hunger 84.1% to 100)

    health or energy or happiness<0.169
    health or energy or happiness >0
    Hunger< 1
    Hunger > 0.841

    Nat Clarke
    Life Cleansing

  • SocksSocks London, UK.Member Posts: 12,822
    edited April 2017

    //

Sign In or Register to comment.