• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

PUSH ERROR VARIABLE GET

S

sernad ssiro81

Guest
############################################################################################
FATAL ERROR in
action number 1
of Step Event0
for object obj_enemy1B:

Push :: Execution Error - Variable Get 100041.VelocidadHorizontal(100125, -2147483648)
at gml_Object_obj_enemy1B_StepNormalEvent_1 (line 25) - repeat (abs(VelocidadHorizontal)){
############################################################################################
I can't find where is this error.
 

Alexx

Member
Basically it means that
Code:
VelocidadHorizontal
is undefined at that point in the Step Event.
Try declaring with a starting / default value in the Create Event.
 
S

sernad ssiro81

Guest
Basically it means that
Code:
VelocidadHorizontal
is undefined at that point in the Step Event.
Try declaring with a starting / default value in the Create Event.

my create event is this

///variables
Camina = false;
Ataca = false;
Dir = -1;
MoveSpeed = 5;
Estado = 0;
VelocidadHorizontal = 0;
VelocidadVertical = 0;
Grav = 0.2;
 
S

sernad ssiro81

Guest
That looks OK.
What's the full code in the Step Event?

step event
/// Displacement

if distance_to_object(obj_player) < 200{

VelocidadHorizontal = 0;

}

// Horizontal colision

repeat (abs(VelocidadHorizontal)){

// cuesta arriba
if (place_meeting(x + sign(VelocidadHorizontal),y, obj_roca))&& place_meeting(x+ sign(VelocidadHorizontal),y -1, obj_roca)&& !place_meeting(x+ sign(VelocidadHorizontal),y -2, obj_roca) y -= 2;
if (place_meeting(x + sign(VelocidadHorizontal),y, obj_roca))&& place_meeting(x+ sign(VelocidadHorizontal),y -1, obj_roca)&& !place_meeting(x+ sign(VelocidadHorizontal),y -3, obj_roca) y -= 3;
if (place_meeting(x + sign(VelocidadHorizontal),y, obj_roca))&& place_meeting(x+ sign(VelocidadHorizontal),y -1, obj_roca)&& !place_meeting(x+ sign(VelocidadHorizontal),y -4, obj_roca) y -= 4;
if (place_meeting(x + sign(VelocidadHorizontal),y, obj_roca))&& place_meeting(x+ sign(VelocidadHorizontal),y -1, obj_roca)&& !place_meeting(x+ sign(VelocidadHorizontal),y -1, obj_roca) y -= 1;
else if (place_meeting(x + sign(VelocidadHorizontal),y, obj_roca))&& !place_meeting(x+ sign(VelocidadHorizontal),y -1, obj_roca) y--;

//cuesta abajo
if !place_meeting(x+ sign(VelocidadHorizontal), y, obj_roca) && !place_meeting(x + sign(VelocidadHorizontal), y +1, obj_roca) && !place_meeting(x + sign(VelocidadHorizontal), y +2, obj_roca)&& place_meeting(x + sign(VelocidadHorizontal),y + 3, obj_roca) y += 2;
if !place_meeting(x+ sign(VelocidadHorizontal), y, obj_roca) && !place_meeting(x + sign(VelocidadHorizontal), y +2, obj_roca) && !place_meeting(x + sign(VelocidadHorizontal), y +3, obj_roca)&& place_meeting(x + sign(VelocidadHorizontal),y + 4, obj_roca) y += 3;
if !place_meeting(x+ sign(VelocidadHorizontal), y, obj_roca) && !place_meeting(x + sign(VelocidadHorizontal), y +3, obj_roca) && !place_meeting(x + sign(VelocidadHorizontal), y +4, obj_roca)&& place_meeting(x + sign(VelocidadHorizontal),y + 5, obj_roca) y += 4;
if !place_meeting(x+ sign(VelocidadHorizontal), y, obj_roca) && !place_meeting(x + sign(VelocidadHorizontal), y +1, obj_roca) && !place_meeting(x + sign(VelocidadHorizontal), y +2, obj_roca)&& place_meeting(x + sign(VelocidadHorizontal),y + 3, obj_roca) y += 1;
else if !place_meeting(x+ sign(VelocidadHorizontal), y, obj_roca) && !place_meeting(x + sign(VelocidadHorizontal), y +1, obj_roca) && place_meeting(x + sign(VelocidadHorizontal),y +2, obj_roca) y++;


if (!place_meeting(x + sign (VelocidadHorizontal), y, obj_roca))
{

x += sign (VelocidadHorizontal);
}
else
{
VelocidadHorizontal = 0;
Dir *= -1;
break;
}
}
// ====================

if Ataca = false{
if Camina = false
{
if (obj_player.x)> x
{

sprite_index = spr_mercenary_IdleR;

}
else
{

sprite_index = spr_mercenary_IdleL;

}
}
else
{

if VelocidadHorizontal > 0
{
VelocidadHorizontal = Dir * MoveSpeed ;
VelocidadVertical += Grav ;
sprite_index = spr_MercenaryP;
image_speed = 1;
}
else
{
sprite_index = spr_MercenaryP2;
image_speed = 1;
}
}
}
// acciones con el jugador-------------
if distance_to_object(obj_player) < 200

{


//mp_potential_step_object(objetP.x,y,2.5,objetP);

if Estado = 0{
Estado = 1;
alarm[0] = 25;
}
}


// gravedad -----------
//if place_meeting(x,y +1, obj_roca)
if place_free(x,y +1)
{
Grav = 1;
}
else
{
Grav = 0;
}
 
D

dannyjenn

Guest
I don't see the problem either, so I'm thinking it's probably not your code. Try clicking the 'clean' icon (next to the 'play' icon... it looks like a broom or dustpan). Or if that doesn't work, restart GameMaker or reboot your computer. Other than that, I have no idea.
 
N

NeonBits

Guest
I think GM is searching for an object named "VelocidadHorizontal" or an object that contains the variable "VelocidadHorizontal" or something.

I am not certain that brackets can be opened after "repeat". Maybe it's that.
Code:
 repeat (abs(VelocidadHorizontal))
            {
and you should clean the lines a little bit
Code:
if ((place_meeting(x + sign(VelocidadHorizontal), y, obj_roca))
    && (place_meeting(x + sign(VelocidadHorizontal), y -1, obj_roca))
    && !(place_meeting(x + sign(VelocidadHorizontal), y -2, obj_roca)))
    {y -= 2;}
And a detail
Code:
if Estado = 0
 if (Estado == 0)
And easy on the computer reboot; it was never required for me.

-
.... o. O
Now that I'm trying to understand your code, why are you checking for a collision above at "y -1" and then if there's not at "y -2"....

Code:
place_meeting(x + sign(VelocidadHorizontal),y, obj_roca) --- checks for a collision in front;
place_meeting(x+ sign(VelocidadHorizontal),y -1, obj_roca) --- checks for a collision in front and above;
!place_meeting(x+ sign(VelocidadHorizontal),y -2, obj_roca) --- checks if there's *none* in front and above;
Everything, all at once; confusing.
 
Last edited by a moderator:
S

sernad ssiro81

Guest
Thanks
those checks what they seek is that the enemy object can walk the ramps and slopes in addition to attacking the player depending on the distance in which the player
 
S

sernad ssiro81

Guest
at the beginning it worked very well until this error appeared that has paralyzed me the project, it is frustrating I have done everything to erase that object and program it again, I am really baffled.
 
S

sernad ssiro81

Guest
I think GM is searching for an object named "VelocidadHorizontal" or an object that contains the variable "VelocidadHorizontal" or something.



I am not certain that brackets can be opened after "repeat". Maybe it's that.
Code:
 repeat (abs(VelocidadHorizontal))
            {
and you should clean the lines a little bit
Code:
if ((place_meeting(x + sign(VelocidadHorizontal), y, obj_roca))
    && (place_meeting(x + sign(VelocidadHorizontal), y -1, obj_roca))
    && !(place_meeting(x + sign(VelocidadHorizontal), y -2, obj_roca)))
    {y -= 2;}
And a detail
Code:
if Estado = 0
 if (Estado == 0)
And easy on the computer reboot; it was never required for me.

-
.... o. O
Now that I'm trying to understand your code, why are you checking for a collision above at "y -1" and then if there's not at "y -2"....

Code:
place_meeting(x + sign(VelocidadHorizontal),y, obj_roca) --- checks for a collision in front;
place_meeting(x+ sign(VelocidadHorizontal),y -1, obj_roca) --- checks for a collision in front and above;
!place_meeting(x+ sign(VelocidadHorizontal),y -2, obj_roca) --- checks if there's *none* in front and above;
Everything, all at once; confusing.
Thanks
those checks what they seek is that the enemy object can walk the ramps and slopes in addition to attacking the player depending on the distance in which the player
 
N

NeonBits

Guest
if the object is necessary, you don't have to delete it, just edit its code.
If an event makes it disapear when another object is looking for it, an error can return.
Code:
if (instance_exists(your_object))
{}
can prevent conflicts.

But if it's bad coding, and you're not certain where the problem is, put everything in between "/* your code */"; select a part in it, place it outside the "/* */", test your code and work your code piece by piece.

Code:
 repeat (abs(VelocidadHorizontal))
            {
try to remove the brackets { } of your "repeat" as a test and run your game; you'll see if it's related.

Code:
place_meeting(x + sign(VelocidadHorizontal),y, obj_roca) --- checks for a collision in front;
place_meeting(x+ sign(VelocidadHorizontal),y -1, obj_roca) --- checks for a collision in front and above;
!place_meeting(x+ sign(VelocidadHorizontal),y -2, obj_roca) --- checks if there's *none* in front and above;
Here, you are saying : if my object collides with "roca" (in front and on top), do something.... but only if my
object doesn't collide with "roca" one pixel higher than what I was checking. It's like saying: if my head hits the wall and the ceiling, but doesn't touch anything higher than that, I can walk. You could just write:
Code:
if ((place_meeting(x, y, obj)) && !(place_meeting(x, y -1, obj)))
{y -= 2;}
 
Last edited by a moderator:
I

immortalx

Guest
Do yourself a favor and cleanup the code as Neonbits suggested. You have to be able to read the code yourself before trying to debug anything. In the first group of ifs, you're enclosing only the first condition in parentheses, the others are not enclosed and the whole thing isn't enclosed either. In the second group of ifs, you follow a different scheme.
Other than that I can't spot anything obvious. I'm sure the more experienced users will be able to help you out. But first please help them help you by doing some housekeeping.
 
Top