C
Calyston00
Guest
Hi all!
I got a little problem, I got a wander behavior script that if I call it in the step event of my monster doesn't work.
If i do the same code (the whole script) in the step event of my monster it's work fine! The timer var doesnt go down in my script one know why ?
Here' is my script that i call in my step event of my monster :
Script Wander
// @Description Wander(time,force)
// @param time
// @param force
move = 0;
moveTime = argument0;
movementForce = argument1;
//FOR RANDOM MOVEMENT BEHAVIOR
show_debug_message("MoveTime :" + string(moveTime) + "move :" + string(move));
moveTime -=1; //this doesnt seem to work!!!!!
if(moveTime=0)
{
move = choose (0,1,2,3,4);
moveTime = argument0;
}
if(move = 0)
{
}
if(move = 1)
{
phy_position_y -= movementForce;
}
if(move = 2)
{
phy_position_x += movementForce;
}
if(move = 3)
{
phy_position_y += movementForce;
}
if(move = 4)
{
phy_position_x -= movementForce;
}
And here how i call it in the step event : (note you'll see that my original code that work really well in comment!!!!) :
/// @description Insert description here
// You can write your code in this editor
//CHECK HP
if(hp<=0)
{
instance_destroy();
}
Wander(120,2); //script calling!!!
/*
//FOR RANDOM MOVEMENT BEHAVIOR
moveTime -= 1;
if(moveTime=0) { move = choose (0,1,2,3,4); moveTime = 120;}
if(move = 0)
{
}
if(move = 1)
{
phy_position_y -= movementForce;
}
if(move = 2)
{
phy_position_x += movementForce;
}
if(move = 3)
{
phy_position_y += movementForce;
}
if(move = 4)
{
phy_position_x -= movementForce;
}
*/
I got a little problem, I got a wander behavior script that if I call it in the step event of my monster doesn't work.
If i do the same code (the whole script) in the step event of my monster it's work fine! The timer var doesnt go down in my script one know why ?
Here' is my script that i call in my step event of my monster :
Script Wander
// @Description Wander(time,force)
// @param time
// @param force
move = 0;
moveTime = argument0;
movementForce = argument1;
//FOR RANDOM MOVEMENT BEHAVIOR
show_debug_message("MoveTime :" + string(moveTime) + "move :" + string(move));
moveTime -=1; //this doesnt seem to work!!!!!
if(moveTime=0)
{
move = choose (0,1,2,3,4);
moveTime = argument0;
}
if(move = 0)
{
}
if(move = 1)
{
phy_position_y -= movementForce;
}
if(move = 2)
{
phy_position_x += movementForce;
}
if(move = 3)
{
phy_position_y += movementForce;
}
if(move = 4)
{
phy_position_x -= movementForce;
}
And here how i call it in the step event : (note you'll see that my original code that work really well in comment!!!!) :
/// @description Insert description here
// You can write your code in this editor
//CHECK HP
if(hp<=0)
{
instance_destroy();
}
Wander(120,2); //script calling!!!
/*
//FOR RANDOM MOVEMENT BEHAVIOR
moveTime -= 1;
if(moveTime=0) { move = choose (0,1,2,3,4); moveTime = 120;}
if(move = 0)
{
}
if(move = 1)
{
phy_position_y -= movementForce;
}
if(move = 2)
{
phy_position_x += movementForce;
}
if(move = 3)
{
phy_position_y += movementForce;
}
if(move = 4)
{
phy_position_x -= movementForce;
}
*/