FATAL ERROR[SOLVED]

fxokz

Member
Code:
___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of  Step Eventobj_bullet
for object obj_puzzleblock:

local variable player_inst(100001, -2147483648) not set before reading it.
 at gml_Object_obj_puzzleblock_CollisionEvent_14_1 (line 24) - if (player_inst = noone)
############################################################################################


ERROR^

Im trying to make it so that if the player is inside a block and the block is not ignited then the bullet doesnt destroy. It works okay however if my player is inside another block seperate from the bullet i get the error..

Code:
var player_inst = instance_place(x, y, obj_player)
if (player_inst = noone)
{
    with(other)
    {
        instance_create(x, y, obj_bullet_explosion);
        instance_destroy(); //destroy the bullet
    }
}
 
M

Maximus

Guest
Simple fix:
Code:
var player_inst = instance_place(x, y, obj_player)
if (player_inst != noone) // does not equal noone is what you want
{
   with(other)
    {
        instance_create(x, y, obj_bullet_explosion);
        instance_destroy(); //destroy the bullet
    }
}
 

fxokz

Member
Simple fix:
Code:
var player_inst = instance_place(x, y, obj_player)
if (player_inst != noone) // does not equal noone is what you want
{
   with(other)
    {
        instance_create(x, y, obj_bullet_explosion);
        instance_destroy(); //destroy the bullet
    }
}
that gives this error:
Code:
___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of  Step Eventobj_bullet
for object obj_puzzleblock:

local variable player_inst(100001, -2147483648) not set before reading it.
 at gml_Object_obj_puzzleblock_CollisionEvent_14_1 (line 24) - if (player_inst != noone)
############################################################################################
What i did is partially right, i also just figured out what the exact cause of the error is. If the block is ignited and it comes in contact with a bullet it gives me the error.


SOLVED: remove the "var" when initializing the variable.
 
Last edited:
M

Maximus

Guest
do you use player_inst elsewhere? might be a name conflict
 
Top