D
DNgames
Guest
-I want to make save system for my buildings but it wont work so here are the codes.
name = obj_const_wall;
for(var i = 0; i < obj_stats.maxstructures; i++)
{
if(obj_stats.structure[i, 0] == -1 and obj_stats.structure[i, 1] == -1)
{
obj_stats.structure[i, 0] = name;
obj_stats.structure[i, 1] = x;
}
}
-Code above is set in objects create event. When created i want to place it in 2D array and store its x coordinate and object name so later i can place it again in same place.
if(room == rm_test)
{
for(var i = 0; i < maxstructures; i++)
{
if(structure[i, 0] != -1)
{
instance_create(structure[i, 1], 288, structure[i, 0]);
}
}
}
-This code above when room starts if its that specific room it creates all those structures that are stored in array and place them in their x coordinate but it seems like it wont work. Idk what is the problem saving or placing objects.
-And in create event of that obj_stats i set all of 2D array to -1.
for(var i = 0; i < maxstructures; i++)
{
for(var j = 0; j < maxstructures; j++)
{
structure[i, j] = -1;
}
}
name = obj_const_wall;
for(var i = 0; i < obj_stats.maxstructures; i++)
{
if(obj_stats.structure[i, 0] == -1 and obj_stats.structure[i, 1] == -1)
{
obj_stats.structure[i, 0] = name;
obj_stats.structure[i, 1] = x;
}
}
-Code above is set in objects create event. When created i want to place it in 2D array and store its x coordinate and object name so later i can place it again in same place.
if(room == rm_test)
{
for(var i = 0; i < maxstructures; i++)
{
if(structure[i, 0] != -1)
{
instance_create(structure[i, 1], 288, structure[i, 0]);
}
}
}
-This code above when room starts if its that specific room it creates all those structures that are stored in array and place them in their x coordinate but it seems like it wont work. Idk what is the problem saving or placing objects.
-And in create event of that obj_stats i set all of 2D array to -1.
for(var i = 0; i < maxstructures; i++)
{
for(var j = 0; j < maxstructures; j++)
{
structure[i, j] = -1;
}
}