Reset variable to default value

I think that´s no way to do this.

But, if you want a way to remember default value of any variable, you simple put a “comment” under it, by select the variable (in blueprint, in that case) and right click select “comment”. It´s useful ? Tell me you.

:slight_smile:

hi all. is there any way to reset variable to its default value? Just interesting

i mean reset value to default while executing .for example you have a variable called “power” with defaul value 50. then you use …hmmmm…potion which makes it increase to 100 for 5 seconds and after 5 secs you need to reset it to 50. i think it would be useful to have some node which resets var value instead of having 2 variables “currentPower” and “defaultPower”

I think it depends on how you are creating your function in blueprint…you have a screenshot to better understand ?

Maybe that´s help?:

Editing Switch Nodes

you dont understand.in bp you have variable. Integer called Speed with default value of 100. You start the game, pick some item which slows you down for a second. While you are slowed your speed is 50. So you set Speed to 50. ok, lets say slow is gone and you need to set Speed back to 100 again cuz 100 is your default speed. I If there is no variable resetting then you have two ways to do that: 1) use setter node for speed and type 100 manually or 2) setter node for speed with another variable “defaultSpeed” connected to it. in first case you need to change all values each time you want to change default speed of a character. in second case you will need twice more variables in a blueprint(1st var for current value, second var to store default value)

Normal way to do this is creating 2 variables. One with current speed and one with default speed. If you need reset your current speed, just set it to the default speed variable.

The “default” value of a variable in blueprints is just the initialization you would give the variable in the constrctor of your c++ class. Resetting it to this value is not planned i guess.

Ok, i understand now. Do you try to use a “branch” with condition set to false/true ?

Yeah! Nice answer at last. It was just interesting tto me cuz i thought maybe i do something wrong when i create both currentX and defaultX variables. Thanks for your answer