Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

how do you update structs in a script?

A topic by DEEP0 created 1 day ago Views: 57 Replies: 2
Viewing posts 1 to 3

i have a script with a bunch of structs in ( my game data script  ) and i wanna be able to change values in it & for it to update. putting any of the live call functions in the script gives me an error .

Developer

Depends on what’s in the script!

If it’s just struct assignments that are done once on game start, you’d want to wrap them in a

function some_init() {
    global.a = { ... };
    ...
}
some_init();

because global script init is a little quirky to resolve from GML.

Then you can use live_code_updated to re-run the (updated) script when a new version is loaded.

thanks for the response!  i've wrapped my array in a function:

function enemies_struct(){       
    global.enemies =     
     {           
     ...      
     }  
enemies_struct();

but i'm struggling to wrap my head around the live code updated function. how would i format the function & where would i put it? thanks!