hello, I am trying to set up a level up step event, I have a ds_grid I have added all the values to and use it to display the weapon stats I have called it eqip_inventory and is defined as global using globalvar.
in the player step event I have some code:
in the player step event I have some code:
Code:
if (ds_grid_get(eqip_inventory,13,0) > ds_grid_get(eqip_inventory,28,0)) {level_up = true ds_grid_set(eqip_inventory,11,0,ds_grid_get(eqip_inventory,11,0)+1)}
if (level_up=true){ds_grid_set (eqip_inventory,14,0,ds_grid_get(eqip_inventory,13,0) *2);
ds_grid_set (eqip_inventory,24,0,ds_grid_get(eqip_inventory,24,0) + (ds_grid_get(eqip_inventory,21,0)div 3));
ds_grid_set (eqip_inventory,25,0,ds_grid_get(eqip_inventory,25,0) + (round(ds_grid_get(eqip_inventory,22,0)/3)));
ds_grid_set (eqip_inventory,27,0,ds_grid_get(eqip_inventory,27,0) + (irandom_range(1,5)));
ds_grid_set (eqip_inventory,28,0,ds_grid_get(eqip_inventory,14,0));
level_up=false;
}
[code/]
but I get this error:
DoAdd :2: undefined value
at gml_Object_obj_player_Step_0 (line 284) - ds_grid_set (eqip_inventory,24,0,ds_grid_get(eqip_inventory,24,0) + (ds_grid_get(eqip_inventory,21,0)div 3));
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Object_obj_player_Step_0 (line 284)
all the entries in the grid are numbers, some are set using code that refers to other parts of the grid or from a variable that uses code to do calculations and then sets the grid to the result.
I think its the way im writing the code that is causing the error, like I need brackets some where I haven't got them or I cant do all this math and code where im putting it and I need to put the answers into a local var and then use that to do the rest of the code?
can any one help, I just cant work out what I have done wrong?