r/gamemaker • u/SkullnSkele • 3h ago
Help! Save System saves and loads, but after loading I can't click on the item anymore
My save system is
function save_game()
{
var buff = buffer_create(1024,buffer_grow,1);
buffer_write(buff,buffer_u64,global.dad_points);
buffer_write(buff,buffer_u16,global.noise.Kazoo.cost);
buffer_write(buff,buffer_u16,global.noise.Kazoo.win_amount);
buffer_write(buff,buffer_u16,global.kazoo_more);
buffer_write(buff,buffer_bool,global.noise.Kazoo.unlocked);
buffer_save(buff,"SaveFile.dat");
buffer_delete(buff);
}
function load_game(){
if !file_exists("SaveFile.dat"){
return;
}
var buff = buffer_load("SaveFile.dat")
buffer_seek(buff,buffer_seek_start,0);
global.dad_points = buffer_read(buff,buffer_u64);
global.noise.Kazoo.cost = buffer_read(buff,buffer_u16);
global.noise.Kazoo.win_amount = buffer_read(buff,buffer_u16);
global.kazoo_more = buffer_read(buff,buffer_u16);
global.noise.Kazoo.unlocked = buffer_read(buff,buffer_bool);
buffer_delete(buff);
}And it saves and loads all those thigns as it should, but when I load and try to klick on the item again, it doesn't work anymore. I have this code in the "Left-Release" of the object
if !global.paused {
if !noise_type.unlocked and global.dad_points >= noise_type.cost {
if global.kazoo_more = 0 {
part_system_create(p_sparkle)
part_system_position(global.spark,x+60,y+80)
noise_type.unlocked = true
global.dad_points -= noise_type.cost
global.kazoo_more += 1
noise_type.cost += 45
alarm[0] = 30
}
}
else if noise_type.unlocked and global.dad_points >= noise_type.cost {
if global.kazoo_more = 1 {
global.dad_points -= noise_type.cost
global.kazoo_more += 1
noise_type.cost += 50
noise_type.win_amount += 10
if !part_system_exists(global.spark){
part_system_create(p_sparkle)
part_system_position(global.spark,x+60,y+80)
alarm[0] = 30
}
}
else if global.kazoo_more = 2 {
global.dad_points -= noise_type.cost
global.kazoo_more += 1
noise_type.cost += 100
noise_type.win_amount += 10
if !part_system_exists(global.spark){
part_system_create(p_sparkle)
part_system_position(global.spark,x+60,y+80)
alarm[0] = 30
}
}
else if global.kazoo_more = 3 {
global.dad_points -= noise_type.cost
global.kazoo_more += 1
noise_type.cost += 200
noise_type.win_amount += 10
if !part_system_exists(global.spark){
part_system_create(p_sparkle)
part_system_position(global.spark,x+60,y+80)
alarm[0] = 30
}
}
else if global.kazoo_more = 4 {
global.dad_points -= noise_type.cost
global.kazoo_more += 1
noise_type.cost += 400
noise_type.win_amount += 10
if !part_system_exists(global.spark){
part_system_create(p_sparkle)
part_system_position(global.spark,x+60,y+80)
alarm[0] = 30
}
}
else if global.kazoo_more = 5 {
global.dad_points -= noise_type.cost
global.kazoo_more += 1
noise_type.cost += 200
noise_type.win_amount += 10
noise_type.bar_speed += 0.2
if !part_system_exists(global.spark){
part_system_create(p_sparkle)
part_system_position(global.spark,x+60,y+80)
alarm[0] = 30
}
}I think the problem is that the else if doesn't happen anymore after loading, but i can't figure out how to fix it
