I would like to ask if anyone would like to help me with a problem in the game i'm making I placed an enemy guard which is a turtle he guards the territory and I have to get passed him he moves back and forward in a guard like state.

I managed to fix a script for the turtle to move forward and when it hits this invisiblewall.mdl that is not passable nor visible he goes the other direction.

What I want is for when the turtle in my game hits the invisiblewall.mdl that the animation of the turtle turns into turtle facing other direction.
I already made an animation for the turtle which i call turtleturnleft.
The problem is I don't know how to script on my game if turtle collisions with invisiblewall, ent_animate(turtle_left.mdl) it's something like this I aint sure.

also this may seem simple but if an entity is moving and I want him to stop what would be the code for this, just to completely stop and stand still.

This is my script on the turtle guard and the invisible wall.

I would appreciate any help.

action invisible_wall
{
wait(1);
my.invisible=on;
my.passable=on;
}

function get_shot
{
if(event_type==event_impact) // entity was hit by a bullet
{
sleep(0); //wait 4 seconds
my.invisible=on; //turn invisible
my.passable=on; //turn passable
}
}

action turtle
{
// 1 is up, -1 is down
my.health=40;
my.gegner=on;
var direction = 1;
var speed = 5;

while (1)
{

// move ball in the right direction
my.y += direction * speed;

// change direction if obstacle is in the way
if (my.health==0)
{
my.enable_entity=on; //make the enemy sensible to getting hit with c_move
my.event=get_shot; // run this function when hit
ent_morph(me,"turtle hit.mdl");
}
wait(1);

vec_set(temp,my.x);
temp.z+=direction * speed;
trace_mode = IGNORE_ME;

while (1)
{

my.enable_impact=on;
my.event=lev_2_event;
break;
}

if (trace(my.x, temp) != 0)
{
direction *= -1;
}
wait(1);
}
}

Last edited by tek; 06/09/06 04:50.