Better NPC AI:
I'm not sure how you were controlling this before but here is what
I'm doing in my RPG:-
In my level editor, I can add in waypoints. I then assign each NPC
to a group of about 4. You then point the NPC at the first 1 and
move him towards it. When he collides with it, he moves to the next
1.
Here is a small example(not tested):-
Rem Setup display
Set Display Mode 800,600,32
Set Window Off
Hide Mouse
AutoCam Off
Rem Create an NPC object
Make Object Box 1,50,50,50
Set Object Collision On 1
Set Object Collision To Polygons 1
Rem Create Waypoints
Dim Waypoints(5)
Global CurrentWaypoint As Integer
CurrentWaypoint=1
Global LastObj As Integer
LastObj=2
For X=1 To 10
For Z=1 To 10
Read Waypoints
If Waypoints>0
Make Object Box LastObj,50,50,50
Position Object LastObj,X*50,0,Z*50
Hide Object LastObj
Set Object Collision On LastObj
Set Object Collision To Polygons LastObj
Waypoints(CurrentWaypoint)=LastObj
LastObj=LastObj+1
CurrentWaypoint=CurrentWaypoint+1
Next X
Next Z
Rem Reset current waypoint
CurrentWaypoint=1
Point Object 1,Object Position X(CurrentWaypoint),0,Object Position Z(CurrentWaypoint)
TargetAng#=Object Angle Y(1)
YRotate Object 1,0
Rem Setup manual synchronization
Sync On
Sync Rate 0
Rem Start main loop
Do
Rem Print frame rate
Set Cursor 0,0
Print Screen FPS()
Rem Control NPC
Move Object 1,2
YRotate Object 1,CurveAngle(TargetAng#,Object Angle Y(1),15)
If Object Collision(1,CurrentWaypoint)>0
CurrentWaypoint=CurrentWaypoint+1
If CurrentWaypoint>4 Then CurrentWayoint=1
OldAng#=Object Angle Y(1)
Point Object 1,Object Position X(CurrentWaypoint),0,Object Position Z(CurrentWaypoint)
TargetAng#=Object Angle Y(1)
YRotate Object 1,OldAng#
EndIf
Rem Control Camera
Set Camera To Follow Object Position X(1),Object Position Y(1),Object Position Z(1),Object Angle Y(1),100,100,5,0
Point Camera Object Position X(1),Object Position Y(1),Object Position Z(1)
Rem Update the screen
Sync
Rem End the main loop
Loop
Rem Data holding positions of waypoints
Waypoints:
Data 0,0,1,0,0,0,0,0,0,0
Data 0,0,0,0,0,0,0,0,0,0
Data 0,0,0,0,0,0,0,0,0,0
Data 0,0,0,0,0,0,0,0,0,0
Data 0,0,0,0,0,0,0,3,0,0
Data 0,0,2,0,0,0,0,0,0,0
Data 0,0,0,0,0,0,0,0,0,0
Data 0,0,0,0,0,0,0,0,0,0
Data 0,0,0,0,4,0,0,0,0,0
Data 0,0,0,0,0,0,0,0,0,0