### -SOLVED-can't use equation as an object's variable value.

Posted:

**Wed 5 Dec 2018, 06:33**Hi, I'm trying to do the following,

the tank object has 2 variables

tankbasehealth which is the base health for the object

and

tankhealth

the latter is the actual health of the tank, to get this value I tried doing (tankbasehealth) -(GlobalVariable(tankactualdamage))

the global variable tankactualdamage stores the damage done to the tank, so that I can set this value to whatever I want for purposes of for example, repairing the tank.

I tried adding this equation to tankhealth value but it's not working, the tank just explodes as soon as I try it.

is it even possible to add an equation as an object's value? Am I doing it wrong?

Thanks.

UPDATE:

I tried doing the equation from the scene adding an action with no condition, and, it's not working either. I'm sure I'm doing something wrong.

I tried (tankbasehealth)-GlobalVariable(tankactualdamage) Didn't work.

I tried (tank.Variable(tankbasehealth))-(GlobalVariable(tankactualdamage)) Didn't work.

I tried tank.Variable(tankbasehealth)-GlobalVariable(tankactualdamage) Didn't work.

UPDATE:

I fixed it by moving the event higher up this worked ok: tank.Variable(tankbasehealth)-GlobalVariable(tankactualdamage)

the tank object has 2 variables

tankbasehealth which is the base health for the object

and

tankhealth

the latter is the actual health of the tank, to get this value I tried doing (tankbasehealth) -(GlobalVariable(tankactualdamage))

the global variable tankactualdamage stores the damage done to the tank, so that I can set this value to whatever I want for purposes of for example, repairing the tank.

I tried adding this equation to tankhealth value but it's not working, the tank just explodes as soon as I try it.

is it even possible to add an equation as an object's value? Am I doing it wrong?

Thanks.

UPDATE:

I tried doing the equation from the scene adding an action with no condition, and, it's not working either. I'm sure I'm doing something wrong.

I tried (tankbasehealth)-GlobalVariable(tankactualdamage) Didn't work.

I tried (tank.Variable(tankbasehealth))-(GlobalVariable(tankactualdamage)) Didn't work.

I tried tank.Variable(tankbasehealth)-GlobalVariable(tankactualdamage) Didn't work.

UPDATE:

I fixed it by moving the event higher up this worked ok: tank.Variable(tankbasehealth)-GlobalVariable(tankactualdamage)