AI im sure some 1's asked this before

Talk about making games.

AI im sure some 1's asked this before

Postby jimmynewguy » Sun Apr 01, 2007 5:16 pm

Hey guys! I'm kinda new :( and i wuz wondering is there some way to make a enemy have a mind of its own or an AI :?: Thanx I hope you guys know! :lol:
User avatar
jimmynewguy
 
Posts: 1137
Joined: Sat Mar 31, 2007 6:27 pm
Score: 89 Give a positive score

Postby Oman » Sun Apr 01, 2007 5:20 pm

What do you want the enemy to do
"Beyond a wholesome discipline, be gentle with yourself." - Max Ehrmann
User avatar
Oman
 
Posts: 268
Joined: Tue Oct 31, 2006 4:00 am
Location: Somewhere out there...
Score: 6 Give a positive score

Postby jimmynewguy » Sun Apr 01, 2007 6:12 pm

I want the enemy to move around and/or attack a character on its own
User avatar
jimmynewguy
 
Posts: 1137
Joined: Sat Mar 31, 2007 6:27 pm
Score: 89 Give a positive score

Postby Oman » Sun Apr 01, 2007 11:53 pm

ok here is what you do.

1.create 3 actors, player and enemy and ground
2.in enemy add draw actor go to player while avoiding ground
3.recieve events if out of vision: no
now the enemy will move toward the player

I am not sure about attacking...


edit: never mind this doesnt work..
Last edited by Oman on Mon Apr 02, 2007 12:01 am, edited 1 time in total.
"Beyond a wholesome discipline, be gentle with yourself." - Max Ehrmann
User avatar
Oman
 
Posts: 268
Joined: Tue Oct 31, 2006 4:00 am
Location: Somewhere out there...
Score: 6 Give a positive score

Postby pavel329 » Mon Apr 02, 2007 12:00 am

wait..
what?

while avoiding the ground?
Not sur i understand step 3.
Drugs r bad.
Mgaay?

Image
User avatar
pavel329
 
Posts: 269
Joined: Thu May 25, 2006 2:05 pm
Location: Behind you
Score: 5 Give a positive score

Postby Oman » Mon Apr 02, 2007 12:02 am

sorry, that doesnt work i have no clue how to do it...

But now i want to know too
"Beyond a wholesome discipline, be gentle with yourself." - Max Ehrmann
User avatar
Oman
 
Posts: 268
Joined: Tue Oct 31, 2006 4:00 am
Location: Somewhere out there...
Score: 6 Give a positive score

Postby pavel329 » Mon Apr 02, 2007 12:05 am

what i want to know how to do is.
the enemy just walks around.
like a normal person.
but when you get to a certain length of him
he atacks.

i was thinking.
make a large actor.
lik a circle or something.as large as you need it.
and do a collision thing.
so when yu hit the circle.(get clse enough to the enemies diameter)
He will come after you.

you understand what I mean?
Drugs r bad.
Mgaay?

Image
User avatar
pavel329
 
Posts: 269
Joined: Thu May 25, 2006 2:05 pm
Location: Behind you
Score: 5 Give a positive score

Postby Oman » Mon Apr 02, 2007 12:07 am

ya but instead of a circle use a filled region actor
"Beyond a wholesome discipline, be gentle with yourself." - Max Ehrmann
User avatar
Oman
 
Posts: 268
Joined: Tue Oct 31, 2006 4:00 am
Location: Somewhere out there...
Score: 6 Give a positive score

Postby pavel329 » Mon Apr 02, 2007 12:17 am

mhm.
but.....
idk how to do it.
i can only script it where the circle chases you.
not the enemy.

this is a script u put in script editor.



angle = direction(x, y, yourhero .x, yourhero .y);
directional_velocity = 10;



replace "yourhero" by the actor's name of your hero. replace the 10 after velocity if you want the ennemy to be faster or slower
[code][/code]
Drugs r bad.
Mgaay?

Image
User avatar
pavel329
 
Posts: 269
Joined: Thu May 25, 2006 2:05 pm
Location: Behind you
Score: 5 Give a positive score

Postby Oman » Mon Apr 02, 2007 12:24 am

ok. I guess that works too.... :)
"Beyond a wholesome discipline, be gentle with yourself." - Max Ehrmann
User avatar
Oman
 
Posts: 268
Joined: Tue Oct 31, 2006 4:00 am
Location: Somewhere out there...
Score: 6 Give a positive score

Postby pavel329 » Mon Apr 02, 2007 12:36 am

no it doesn't.

u can only use it on the enemy or the diameter.
i want to make it where when you hit the diameter or circel thing the enemy chases you.
not the circle.
Drugs r bad.
Mgaay?

Image
User avatar
pavel329
 
Posts: 269
Joined: Thu May 25, 2006 2:05 pm
Location: Behind you
Score: 5 Give a positive score

Postby Sgt. Sparky » Thu Apr 05, 2007 3:47 am

use a distance function, that way you do not need a circle,
Code: Select all
if(distance(x, y, yourhero.x, yourhero.y) < 100)
{
    angle = direction(x, y, yourhero.x, yourhero.y);
    directional_velocity = 10;
}

replace 10 with the velocity you want.
replace the 100(distance)
with what you want :D
(minimum of 75 recomended) :D
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 0 guests

cron