Posted By: Lecithin
simple path following? - 03/28/10 14:24
I've searched the manual, tried the wiki, and looked at the forums for awhile now but I can't seem to figure this out. I've tried a few versions of code but each one gives a different problem :-/
I need a very simple script that allows an entity to follow a simple path. I know how to create the path but I can't seem to script the entity to follow it.
I used action patrol_path() in the manual but I get a "Crash in patrol_path" error... I added the var temp; part because w/out it I got another error.
What am I doing wrong? I'm sure this is very simple but I can't seem to put 2 + 2 together today. Thanks for your help!
I need a very simple script that allows an entity to follow a simple path. I know how to create the path but I can't seem to script the entity to follow it.
I used action patrol_path() in the manual but I get a "Crash in patrol_path" error... I added the var temp; part because w/out it I got another error.
Code:
action patrol_path() { result = path_scan(me,my.x,my.pan,vector(360,180,1000)); if (result == 0) { return; } var node = 1; path_getnode(my,node,my.skill20,NULL); while (1) { var temp; var angle[3]; result = vec_to_angle(angle,vec_diff(temp,my.skill20,my.x)); if (result < 25) { node = path_nextnode(my,node,1); path_getnode(my,node,my.skill20,NULL); } my.pan = angle[0]; c_move(me,vector(3*time_step,0,0),NULL,GLIDE); wait(1); } }
What am I doing wrong? I'm sure this is very simple but I can't seem to put 2 + 2 together today. Thanks for your help!