Ask here your questions to get help using GDevelop.
By robert20
#69217 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)
Last edited by robert20 on Wed 5 Dec 2018, 07:33, edited 1 time in total.
User avatar
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.