ok I`v had a go at it again, and this is what I`v come up with.
`*** Enter number of objects ***
input "Enter the number of AI NPCs you wont: ",NPC :` enter the nomber of objects needed
while NPC < 1 or NPC > 1000 :` this is the limit of object playable on my laptop at fps 15
input "Re-enter the number of AI NPCs you wont: ",NPC :` re-enter the nomber of objects needed
endwhile
`*** Enter load object string ***
input "Enter object file name, or press enter to skip: ",load_object$
`*** Start Physic and AI
ai start
`AI Set Radius 2.5
phy start
`*** this for the randome number generatore ***
rndsize as integer :` this is used to scale the size of the object
`*** User AI setup ***
type AI :` name of user type
Alive as boolean :` to see if the AI object is alive or not
Size as integer :` how big the AI object is
speed# as float
endtype :` end of user type
`*** ***
dim AI_NPC(NPC) as AI
`*** for loop, for AI array type info ***
for i = 1 to NPC :` start of for loop
`*** randome timer ***
randomize timer() :` randome timer using internal clock
`*** random size integer for AI object ***
rndsize = rnd(49)+51 :` random nombers
`*** the size of the AI object ***
AI_NPC(i).Size = rndsize :` how big the AI object will be
`*** the life span of a AI object ***
AI_NPC(i).Alive = 1 :` if the AI object is alive its state will = 1, if the AI object is dead it state will = 0
next i :` end of for loop
`*** ***
string_no as integer :` this integer is the number of letters in the load object string,
` it help to trigger the load an object, if it = 0 then a primative made insted
`*** to let the pc know if a string has bin enter, and outputs a number ***
string_no = len(load_object$)
`*** this is to load an AI object ***
if string_no > 0 :` this the integer that used the (len) commarnd
`*** this is to show the user input info, this one show that the AI objects have bin loaded ***
object_loaded_on_off = 1
`*** load AI objects ***
for i = 1 to NPC
` this where we load are object and scale them
load object load_object$,i :` to load a object from a file
scale object i,AI_NPC(i).Size,AI_NPC(i).Size,AI_NPC(i).Size :` scale the size of the object
next i
load_object_AI(NPC) :` function for Loaded AI objects
endif
`*** this to billed a primative AI object, in this case I`ve optied for a cube ***
if string_no = 0 :` this is the integer thats used (len) commarnd
`*** this is to show the user input info ***
object_loaded_on_off = 2
`*** make AI objects ***
for i = 1 to NPC
make object cube i,1
scale object i,AI_NPC(i).Size,AI_NPC(i).Size,AI_NPC(i).Size
position object i,rnd(40)-rnd(40),0,rnd(40)-rnd(40)
next i
make_primative_object(NPC) :`function for primative AI objects
endif
`*** make floor ***
make object cube 1001,1
scale object 1001,5000,5,5000
position object 1001,0,-10,0
phy make rigid body static box 1001
`*** set up sync ***
sync on : sync rate 0
cls
autocam off
position camera 0,0,-5
`*****************************************************************************************************************
`*************************************************(start loop)****************************************************
`*****************************************************************************************************************
`*** start loop ***
do
`AI Debug Show Paths 2.5
`*** print out info ***
set cursor 0,0 : print "number of AI objects: ";NPC
set cursor 0,15 : print "string number: ";string_no
if object_loaded_on_off = 1
set cursor 0,30 : print "The file that was input to string is: ";load_object$
else
set cursor 0,30 : print "no objects loaded"
endif
if object_loaded_on_off = 2
set cursor 0,45 : print "AI primative objects made"
else
set cursor 0,45 : print "AI primative objects not made"
endif
for i = 1 to NPC
set cursor 0,60 : print "AI X movement: ";AI Get Entity Move X ( i )
set cursor 0,75 : print "AI Z movement: ";AI Get Entity Move Z ( i )
set cursor 0,90 : print "AI object moving: ";AI Get Entity Is Moving ( i )
next i
camera_control()
`if spacekey()=1
move_AI_object(NPC)
`endif
`*** Update Physic and AI ***
ai update
phy update
sync
loop
`***************************************************************************************************************
`***************************************************(End Loop)**************************************************
`***************************************************************************************************************
`*** Load AI object functions ***
function load_object_AI(NPC)
for i = 1 to NPC
color object i,rgb(255,0,0)
phy make rigid body dynamic box i
next i
endfunction
`*** Make AI object functions ***
function make_primative_object(NPC)
` make a patrol path
AI Make Path 1
AI Path Add Point 1,10,10
AI Path Add Point 1,-10,10
AI Path Add Point 1,-10,-10
AI Path Add Point 1,10,-10
for i = 1 to NPC
color object i,rgb(255,0,0)
rem add them to the enemy team and set their speed (in units per second)
AI Add Enemy i
AI Set Entity Speed i,1.00000000
AI Set Entity Aggressive i
AI Set Entity View Arc i,90,180
AI Set Entity View Range i,60
AI Set Entity Hearing Range i,100
`AI Set Avoid Mode 1
`assign entities their patrol paths (entityNum, pathNum)
AI Entity Assign Patrol Path i,1
`phy make rigid body dynamic box i :`????????????????
`phy make box character controller i,0,0,0,object size x(i)/2,object size y(i)/2,object size z(i)/2,1, 1.5, 45.0
phy make capsule character controller i,0,0,0,object size x(i),object size y(i),1,1.5,45.0
next i
endfunction
function move_AI_object(NPC)
for i = 1 to NPC
AI_movement = AI Get Entity Is Moving ( i )
AI_Move_X# = AI Get Entity Move X ( i )
AI_Move_Z# = AI Get Entity Move z ( i )
`AI_Move_Z# = object position y(i)
if AI_movement = 1 then AI_NPC(i).speed# = 1.00000000
if AI_movement = 0 then AI_NPC(i).speed# = 0.00000000
phy move character controller i,AI_NPC(i).speed# :` this how it works but I cant fix it
` work how to make nice move ment for the AI object :speed#*sin(AI_Move_X#)
`phy set rigid body linear velocity i,speed#*sin(AI_Move_Z#)*cos(AI_Move_X#),object position y(i),speed#*cos(AI_Move_Z#)*cos(angX#) :`object position y(i) :`speed#*sin(AI_Move_X#)
next i
endfunction
`************************************************************************************************************************
function camera_control()
`speed# = 10
`angY# = camera angle y()
`angX# = -camera angle X()
yrotate camera camera angle y() + mousemovex()*0.3
xrotate camera camera angle x() + mousemovey()*0.3
rem stops mouse from going upside down
if wrapvalue(camera angle x(0))>100 and wrapvalue(camera angle x(0))<120 then xrotate camera 0,100
if wrapvalue(camera angle x(0))>180 and wrapvalue(camera angle x(0))<280 then xrotate camera 0,280
rem camera position
`position camera x#,y#,z#
if mouseclick()=2 then move camera 0,-0.5
if mouseclick()=1 then move camera 0,0.5
`if upkey()=1 then move camera 0,0.5
`if downkey()=1 then move camera 0,-0.5
endfunction
`***********************************************************************************************************************
`****************((( end physics )))************
`***********************************************************************************************************************
`*** end phy ***
phy end
they don`t pile up like last time quite as much, but not how I would like them to work in my game, but I need sleep now cos I`v bin working on this of 4 hours, and it 1/2 one in the morning, hope this helps bergice.
if any one else can sort this out, or just give us a hint or two it would be most appreciated.
bergice how did you take the pic of my program?
if its from a program, could you add a link or a download?
soul sucking devils, twisted body of the damed, slivering slim drips from ever poor, sin licking at your ears, and the smell stinging your eyes, and if you don't like it, get out of my kitchen!....