Page 1 of 1

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

PostPosted: Wed 5 Dec 2018, 06:33
by robert20
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)

Re: can't use equation as an object's variable value.

PostPosted: Wed 5 Dec 2018, 07:23
by steveang9999
can you post the event out? and yes equation can be used in variables

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

PostPosted: Thu 6 Dec 2018, 01:02
by Lizard-13
Code: Select alltank.Variable(tankbasehealth)-GlobalVariable(tankactualdamage)

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.