Thanks for the code.
I tried incorporating this into my code and it's still not working.
In WED the Trigger_ball_path is the action attached to the invisible box model I'm using for the trigger.
The player who colides with the trigger has the following code:
He moves on his own in one direction and the camera follows him.This code works pretty good but I think it is trigger the "Trigger_Ball_path action prematurely.
Code:
action b_ball_Player_move
{
var temporaryValue=0;
while(me)
{
//animate walk image sequence
ent_animate(my,walk_animate,walk_percent,anm_cycle );
walk_percent += 2* time;
// move forward
c_move(my,vector(3,0,0), nullvector, activate_trigger);
//Call function to allow camera view to follow the player around
move_view_3rd_2(); //note: changed variable in function from 16 to 1
// if left mouse button pressed turn left
if(mouse_left == 1)
{
temporaryValue.pan = 3;// pan or turn left, if it were -=1 then he would turn right
c_rotate (my, temporaryValue, activate_trigger);
//move in new direction
c_move(my,vector(0,0,0), nullvector,activate_trigger);
//clear mouse button setting
mouse_left =0;
}
wait(1);
}
}
your corrections incorporated into my code:
Code:
//////////////////////////////
// Event and action to throw ball into net
//////////////////////////////
var counter =0;
function Ball_path()
{
// scanning for path
counter = 0; //number of waypoints
temp.pan = 360;
temp.tilt = 180;
temp.z = 1000;
result = scan_path (my.x, temp);
if (result == 0)
{
return;
}
ent_waypoint(my._TARGET_X,1);
//loop for ball to travel path
while (counter<24)
{
temp.x = my._TARGET_X - my.x;
temp.y = 0;
temp.z = my._TARGET_Z - my.z;
result = vec_to_angle(my_angle,temp);
if (result < 23)
{
ent_nextpoint (my._TARGET_X);
counter+=1;
}
//move ball model along path
c_move(my, vector(temp.x,0,temp.z), nullvector,ignore_passable);
wait(2);
}
score_basket();
}
function Ball_Path_linker()
{
//if impact between trigger and player and the mouse button is pressed
if( (event_type == event_impact || event_type == event_entity)&&(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.enable_entity = on;
my.event = ball_path_linker;
}
I tried using break points on the last line in the Trigger_Ball_path (line my.event = ball_path_linker;). The breakpoint stopped here but was triggered at the very start of the game. I think the activate_trigger mode ,in the cmove()calls from the b_ball_player_move, tripped this. I set a breakpoint at the functions and neither were called.
any other ideas to help.
Thanks