Hello,
I'm having some trouble getting this code to work.
What I'm trying to do:
I'm trying to get a model to follow a path after another model colides with it's trigger. There are 3 models together, the player model, the ball model, and an invisible box I'm using as a trigger to start the ball on its path. I'm using a trigger so I can control which side of the ball the player has to be.
here is the code:
Code:
action Ball_path
{
counter = 0; // there are 23-24 waypoints in path
temp.pan = 360; // scanning radius horizontal
temp.tilt = 180;// scanning radius vertical
temp.z = 1000; // scanning distance
result = scan_path (my.x, temp); scanning for path
if (result == 0) //if the scan finds no paths
{
return;
}
ent_waypoint(my._TARGET_X,1); //1st waypoint found
while (counter<24)//counts the number of waypoints
{
temp.x = my._TARGET_X - my.x; //distance to next waypoint
temp.y = 0;
temp.z = my._TARGET_Z - my.z;
result = vec_to_angle(my_angle,temp);
if (result < 100) // if point found within distance
{
ent_nextpoint (my._TARGET_X);
counter+=1;
}
//move the ball on the path
c_move(my, vector(temp.x, 0, temp.z), nullvector,ignore_passable);
wait(1);
}
score_basket();
}
function Ball_Path_linker()
{ //if impact between trigger and player and the mouse button is pressed
if( (event_type == event_impact)&&(mouse_left==1) )
{
beep(); //test
ball_path(); //call function for ball to follow path
}
}
action Trigger_Ball_path
{ //model set for impact event
my.enable_impact=on;
my.event= ball_path_linker;
}
summary of code operation (or expected operation):
action Trigger_ball_path is attached to the trigger in WED
action ball_path is attached to the ball
function ball_path_linker is called when an impact between the player and trigger occur.
Does anyone see why this doesn't work.
I'm trying to trigger an action after an impact, but trying to control what side of the model the impact occurs.
Thanks