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

Hi, I’m trying to do the following,

the tank object has 2 variables

tankbasehealth which is the base health for the object
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?



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.


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

can you post the event out? and yes equation can be used in variables


Seems correct, assuming the tank object has a variable “tankbasehealth” and there is a global variable “tankactualdamage”.
You can launch a preview with the debugger, so you can make sure about the value of every variable.