Vinsane
Member
Hi there everyone,
I currently have a working INI save system (that is very basic mind you) that saves what fields I enter into it.
at the moment I have saved the players "kills" and "coins" so when I relaunch the game and hit load these two variables will load up fine with the objects assigned to them.
At the moment the game will auto-save at the start of every level. My issue is that I'm trying to save the variables of the clothes system that I've created.
I have a main clothes controller that has global variables assigned to 4 different button presses. up on arrow key will increase the global var assigned to that piece of clothing, example below.
global.tops = 1 will spawn a t-shirt on the player,
global.tops = 2 will remove the previous t-shirt and replace it with a new one, and so on and so on.
My goal is to have 4 new variables in my INI file -
Hats="0"
Shoulder Pads="0"
Pants="0"
Tops="0"
I have achieved the writing to the INI file fine but I am unable to get the code to actually save the global variable assigned to each of the string. the weird thing is that my global kill counter and gold counter works fine but I just cannot get the clothes variables to work at all. it always saves 0 instead of the real global variable
Here is the code I am using for saving the var's
ini_write_real("Clothes","Hats",global.hats);
and for the load
global.hats = ini_read_real("Clothes","Hats",0);
Can anyone please lend me some assistance because I don't understand what I'm doing wrong.
The only thing I can imagine is that it is because I have not written in to save the clothes controller in the save script. that is because my knowledge is very limited when it comes to saving objects instead of variables.
I currently have a working INI save system (that is very basic mind you) that saves what fields I enter into it.
at the moment I have saved the players "kills" and "coins" so when I relaunch the game and hit load these two variables will load up fine with the objects assigned to them.
At the moment the game will auto-save at the start of every level. My issue is that I'm trying to save the variables of the clothes system that I've created.
I have a main clothes controller that has global variables assigned to 4 different button presses. up on arrow key will increase the global var assigned to that piece of clothing, example below.
global.tops = 1 will spawn a t-shirt on the player,
global.tops = 2 will remove the previous t-shirt and replace it with a new one, and so on and so on.
My goal is to have 4 new variables in my INI file -
Hats="0"
Shoulder Pads="0"
Pants="0"
Tops="0"
I have achieved the writing to the INI file fine but I am unable to get the code to actually save the global variable assigned to each of the string. the weird thing is that my global kill counter and gold counter works fine but I just cannot get the clothes variables to work at all. it always saves 0 instead of the real global variable
Here is the code I am using for saving the var's
ini_write_real("Clothes","Hats",global.hats);
and for the load
global.hats = ini_read_real("Clothes","Hats",0);
Can anyone please lend me some assistance because I don't understand what I'm doing wrong.
The only thing I can imagine is that it is because I have not written in to save the clothes controller in the save script. that is because my knowledge is very limited when it comes to saving objects instead of variables.