[SOLVED] Dumb question: Can functions modify values of global variables


I have a function, but I’m having problems modifing a global variable from it.
I’m passing a number in the parameter “VidaPerdida” that should be substracted from the global variable “P1_Vida” , but it doen’t look to work.

Am I missing something?

I think the arguments should be getted through an expression not used directly?

1 Like

Puedes intentar saber el valor de VidaPerdida que recibe la función metiendola en la condición de la function. tipo

VidaPerdida = 0
Aqui mete un objeto tipo texto y le indicas Text = VidaPerdida y lo metes en el HUD para ver si recibe bien los valores.
Tus acciones

Mmhh… I don’t get well how to work with parameters into the function, I put values into the parameters but looks like no numbers are passed to the function at all:

I get it!

I was just trying to get the parameter value only by typing the parameter name, but to get it into the function, you have to use “GetArgumentAs…”.
Now is working fine, this tip may be helpful for people starting to work with GDevelop’s functions.

@arthuro555 I get you now!