this should do it, loaded object rotated it 180 then fixed in postion then rotated back 180 but not fixed it, object now faces you and then turns to face direction it will walk.
remstart
Rem ***** Main Source File *****
reates a single entity, adds it to the enemy team and gives it a destination of x=0, z=30
* -the entity will then return to its idle position
*
* Compiled in version 6.0
*
remend
sync on : sync rate 60
global dist# as float
AI Start
MakeBackground()
make camera 1
position camera 1,0,5,-20
set camera range .1,9999
`load object "dwarf1.dbo",1
load object "J:\Program Files\Dark Basic Professional\Help\examples\basic3d\models\model.x",1
position object 1,0,1,0
rotate object 1,0,180,0
`point object 1,30,0,30
fix object pivot 1
`color object 1,rgb(255,255,0)
AI Add Enemy 1
global waypointx# as float:waypointx#=30
global waypointz# as float:waypointz#=30
rem make a patrol path
AI Make Path 1
rem specify the points we want in our patrol in the order to visit them.
rem After the last point the first point becomes the next destination.
AI Path Add Point 1,0,0
AI Path Add Point 1,waypointx#,waypointz#
AI Set Entity Patrol Time 1,6
`AI Set Avoid Mode 1
AI Entity Assign Patrol Path 1,1
AI Set Entity Speed 1,20
rotate object 1,0,180,0
do
X1# = camera position x(1)
Y1# = camera position y(1)
Z1# = camera position z(1)
X2# = object position x(1)
Y2# = object position y(1)
Z2# = object position z(1)
`dist# = fml distance(X1#,Y1#,Z1#,X2#,Y2#,Z2#)
move camera 1,(keystate(17)-keystate(31))*1
turn camera left 1,(keystate(30)-keystate(32))*1
AI Update
ink 0,0
text 10,10,"objx:"+str$(object position x(1))
text 10,30,"objy:"+str$(object position y(1))
text 10,50,"objz:"+str$(object position z(1))
text 10,70,"objpitch:"+str$(object angle x(1))
text 10,90,"objyaw:"+str$(object angle y(1))
text 10,110,"objroll:"+str$(object angle z(1))
text 10,130,"attack:"+str$(attack)
text 10,150,"AI GET ENTITY MOVING:"+str$(AI GET ENTITY IS MOVING(1))
text 10,170,"AI GET ENTITY TURNING:"+str$(AI GET ENTITY IS TURNING(1))
Rem ***** Main Source File *****
text 10,190,"Enemy State: "+AI Get Entity State$(1)
text 10,210,"Actions state "+AI Get Entity Action$ ( 1 )
text 10,230,"dirction "+str$(AI Get Entity Destination X ( 1 ))
text 10,250,"dirction "+str$(AI Get Entity Destination z ( 1 ))
sync
loop
function AI_AttackPlayer(player,obj)
local X1# as float
local Y1# as float
local Z1# as float
local X2# as float
local Y2# as float
local Z2# as float
X1# = object position x(player)
Y1# = object position y(player)
Z1# = object position z(player)
X2# = object position x(obj)
Y2# = object position y(obj)
Z2# = object position z(obj)
`dist# = fml distance(X1#,Y1#,Z1#,X2#,Y2#,Z2#)
if dist# <= 5
attack=1
endif
if dist# > 5
attack=0
endif
if attack
select attack
case 0
AI Kill Entity 1
endcase
case 1
endcase
endselect
endif
endfunction
function MakeBackground()
load image "stripe5.png",1
rem create the background object
make object sphere 99,400,48,48
texture object 99,1
scale object texture 99,6,6
set object cull 99,0
set object light 99,0
rotate object 99,0,0,90
rem add the logo across the bottom
` load image "logo.png", 100000
` sprite 1, 0, screen height() - 60, 100000
endfunction
Dark Physics makes any hot drink go cold.