GMS 2 [SOLVED] Create Event Function Updates


Spencer S

When I put something like this into the Create event of an object:
var j;
var toughnesshp = 5.00;
var toughnessiteration = 0.00;
    for (j = 0; j < playerToughness; j ++) {
        toughnessiteration = toughnessiteration + toughnesshp;
        if playerToughness >= 20 {
            if toughnesshp > 2.00 {
                toughnesshp = toughnesshp * 0.96;  
            else toughnesshp = 2;
Will the entire function update if I change a variable that is in that function? For example, if I change the playerToughness value, will this entire for loop run again and update all values, even though its located in the Create event?

Essentially, my bare bones question is this: if I have a for loop that uses previously created variables in the Create event, and I change one of those variables, will that loop located in the Create event execute again, just once, to update the other values located inside that for loop?


No the create event only runs once, when the object is created.

If you want to run it a second time, you can move it into the step event, and use an if statement to determine when to run it.
Last edited by a moderator: