Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / simple ai help

Author
Message
aks74u
20
Years of Service
User Offline
Joined: 2nd Jun 2004
Location: arizona
Posted: 24th Jun 2004 03:47
how do i make it do if an object is within a certain distance to me,the player in fisrt person, it will run away untill it is out of the distance.
also how do i handle multiple objects at once to run away from me

i.e. a hunting type game

thx

mulletman47@aol.com
dj BlackDragon
20
Years of Service
User Offline
Joined: 23rd Sep 2003
Location: who knows
Posted: 24th Jun 2004 05:13
check the tutorials(monster hunt)They have a simpel ai program that might help



Current project:Quest for the Five Staffs of Draconia
aks74u
20
Years of Service
User Offline
Joined: 2nd Jun 2004
Location: arizona
Posted: 24th Jun 2004 08:35
kk

mulletman47@aol.com
Physics coder
20
Years of Service
User Offline
Joined: 25th May 2004
Location: United States
Posted: 25th Jun 2004 09:15
Hey, you could check to see if the object was within a certain radius of the player and if so, turn the object away and move it away.
I've attached a simple example to show how you could do this.
The AI uses a finite state machine. Usually the AI characters with walk randomly in a "NORMAL" state. When you get to close to them they will turn and run away in a "FLEE" mode.

mouselook and WASD controls

Delete the bug, delete the code
aks74u
20
Years of Service
User Offline
Joined: 2nd Jun 2004
Location: arizona
Posted: 25th Jun 2004 09:19
this helps alot thx

could you explain globals to me...plz

mulletman47@aol.com
aks74u
20
Years of Service
User Offline
Joined: 2nd Jun 2004
Location: arizona
Posted: 25th Jun 2004 09:20
it says this doesnt work or something


if enemy_player_dist#max_enemy_distance#


at line 76

mulletman47@aol.com
Physics coder
20
Years of Service
User Offline
Joined: 25th May 2004
Location: United States
Posted: 25th Jun 2004 09:31
Quote: "
if enemy_player_dist#max_enemy_distance#
"

umm there should be a > sign between enemy_player_dist# and max_enemy_distance#, like:
if enemy_player_dist#>max_enemy_distance#
that line is there so the enemy knows when to stop running, or else it would keep running away forever.

globals are variables that can be accessed in functions. I didn't have any functions so I didn't need to use global variables in the example. I just did that because it is a nice way to define variables.

arrays are global.

Delete the bug, delete the code
aks74u
20
Years of Service
User Offline
Joined: 2nd Jun 2004
Location: arizona
Posted: 25th Jun 2004 09:46
how did you make the texture if you dotn have media?

mulletman47@aol.com
aks74u
20
Years of Service
User Offline
Joined: 2nd Jun 2004
Location: arizona
Posted: 25th Jun 2004 09:49
thx for using your time when you could have been doing something to write that prgram for me

mulletman47@aol.com
Physics coder
20
Years of Service
User Offline
Joined: 25th May 2004
Location: United States
Posted: 25th Jun 2004 18:21
this part makes the image:

rem quick grass texture
for x=0 to 100
for y=0 to 100
ink rgb(0,rnd(255),0),0
dot x,y
next y
next x
get image 1,1,1,100,100

it just make a 100 by 100 box filled with different shades of green. Later in the code it uses the image as a texture for the matrix:
prepare matrix texture 1,1,1,1
the first "1" is the matrix number to texture, the second "1" is the image number used to texture it, and i think the last two 1s are scaling stuff that control how the texture is scaled on the matrix.

Delete the bug, delete the code
aks74u
20
Years of Service
User Offline
Joined: 2nd Jun 2004
Location: arizona
Posted: 27th Jun 2004 00:17


mulletman47@aol.com

Login to post a reply

Server time is: 2024-09-22 14:25:38
Your offset time is: 2024-09-22 14:25:38