How do you calculate an image change with a timer of %
natclarke
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
When all the following conditions are true
attribute 'energy' is > 0.5
and
attribute 'energy' is < 0.8
--change image to 2
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
You can add as many conditions as you wish.
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
Can we see the rules you are using ?
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.
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.
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
Could we see one of the numeric expressions.
Nat Clarke
Life Cleansing
'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.
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
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.
What are the value ranges for each attribute ?
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
//