Ok. Now I´m out with my smart phone, when I go back home I,ll show you an example.
Edited
Here is the example, however, you will have to define the behavior of the enemy in all situation. In this example, if we get close to the enemy, we'll be attacked by enemy.
autocam off
sync on
//we create the waypoint objects
for i= 1 to 10
make object box i,3,3,3
next i
// making the level
make object box 1000,100,1,100
make object box 1001,100,1,100:position object 1001,100,0,0
make object box 1002,100,1,100:position object 1002,100,0,100
make object box 1003,100,1,100:position object 1003,-150,0,0
make object box 1004,100,1,100:position object 1004,-150,0,150
make object box 1005,100,1,100:position object 1005,-50,0,150
for i= 1000 to 1005
color object i,rgb(0,255,0)
next i
//-------------------------------------------------------------
x#=-200
z#=-200
make object sphere 100,20
color object 100,rgb(255,255,0)
position object 100,28,0,75
make object sphere 101,20
color object 101,rgb(255,0,0)
set object collision off 101
position camera 0,500,0
point camera 0,0,0
wp=1
// positioning waypoints manually
position object 1,-222,0,72
position object 2,-222,0,223
position object 3,12,0,228
position object 4,172,0,160
position object 5,172,0,-77
position object 6,-126,0,-77
position object 7,-73,0,-63
position object 8,-73,0,74
position object 9,24,0,74
//--------------------------------
do
if upkey() then z#=z#+0.3
if downkey() then z#=z#-0.3
if leftkey() then x#=x#-0.3
if rightkey() then x#=x#+0.3
position object 101,x#,0,z#
//CHECKING WAYPOINGS
if object collision(100,0)=wp then wp=wp+1
point object 100,object position x(wp),object position y(wp),object position z(wp)
if wp=10 then wp=1
move object 100,0.1
set cursor 5,5:print "WAYPOINT ",WP-1
set cursor 5,25:print "TRY TO APPROACH TO SOLDAT"
dx#=object position x(100)-object position x(101)
dz#=object position z(100)-object position z(101)
distancia#=sqrt((dx#*dx#)+(dz#*dz#))
if distancia#<70 and distancia#>15
point object 100,object position x(101),object position y(101),object position z(101)
move object 100,0.2
endif
sync
loop
Cheers.
I'm not a grumpy grandpa