How do I increase attribute by more than 1

Erikweiss4
I've figured out how to increase my attributes by 1 using the "increase object counter" but how can I increase them by more than 1??

lightwriter
let's say the attribute is health of the player, you simply do the following:
player.health = player.health + 25
//you can even add variables together
player.mana = player.mana - player.manaused

HegemonKhan
in GUI~Editor:

run as script -> add new script -> variables -> 'set a variable or attribute' -> (see below)

set variable Object_name.Attribute_name = [expression] Object_name.Attribute_name OPERATOR Value


*(Math) OPERATORS:

Programming's Assignment (as there is no math's "equals" in programming): =

Addition: +
Subtraction: -
Multiplication: *

Division (division: returns the Quotient only): /
Modulus (division, but it returns the Remainder only, instead of the quotient): %

Exponents: I'm not sure actually haven't needed to work with them yet... but it's probably: **, ^, or there's a 'pow' Function
Roots: see exponents, for example of a square root: ** 0.5, ^ 0.5, or a 'sqrt' Function


**(Math) Relational Operators (used with~in the ' if ' and like Scripts):

Equals (comparing): =
Not Equals (contrasting) A: <>
Not Equals (contrasting) B: not xxx = xxx
Greater Than: >
Lesser Than: <
Greater Than or Equal To: >=
Lesser Than or Equal To: <=


for example:

'game' Object -> 'Attributes' Tab -> Attributes -> Add -> (see below)

Attribute Name: turns
Attribute Type: int (integer: non-decimal numbers)
Attribute Value_or_Expression: 0
~OR~
Attribute Name: turns
Attribute Type: double (decimal numbers)
Attribute Value_or_Expression: 0.0

Object Name: game
Attribute Name: turns

for my ' Value ', let's say we'll use: 5

replace my ' Object_name ' with ' game ' and ' Attribute_name ' with ' turns ' and ' Value ' with ' 5 '

so, for example:

set variable game.turns = [expression] game.turns + 5

----------------------

in scripting code:

Object_name.Attribute_name = Object_name.Attribute_name OPERATOR Value

for example:

game.turns = game.turns + 5

------------------

CONCEPTUALLY, how programming's *ASSIGNMENT* (not math's equals) works:

initial (old) value: game.turns = 0

equation (expression): game.turns = game.turns + 5

--

old value: game.turns = 0

game.turns (new) = game.turns (old: 0) + 5
game.turns (new) = (0) + 5

new value: game.turns = 5

--

old value: game.turns = 5

game.turns (new) = game.turns (old: 5) + 5
game.turns (new) = (5) + 5

new value: game.turns = 10

--

old value: game.turns = 10

game.turns (new) = game.turns (old: 10) + 5
game.turns (new) = (10) + 5

new value: game.turns = 15

--

etc etc etc

This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums