Page 1 of 1

AI im sure some 1's asked this before

PostPosted: Sun Apr 01, 2007 5:16 pm
by jimmynewguy
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:

PostPosted: Sun Apr 01, 2007 5:20 pm
by Oman
What do you want the enemy to do

PostPosted: Sun Apr 01, 2007 6:12 pm
by jimmynewguy
I want the enemy to move around and/or attack a character on its own

PostPosted: Sun Apr 01, 2007 11:53 pm
by Oman
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..

PostPosted: Mon Apr 02, 2007 12:00 am
by pavel329
wait..
what?

while avoiding the ground?
Not sur i understand step 3.

PostPosted: Mon Apr 02, 2007 12:02 am
by Oman
sorry, that doesnt work i have no clue how to do it...

But now i want to know too

PostPosted: Mon Apr 02, 2007 12:05 am
by pavel329
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?

PostPosted: Mon Apr 02, 2007 12:07 am
by Oman
ya but instead of a circle use a filled region actor

PostPosted: Mon Apr 02, 2007 12:17 am
by pavel329
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]

PostPosted: Mon Apr 02, 2007 12:24 am
by Oman
ok. I guess that works too.... :)

PostPosted: Mon Apr 02, 2007 12:36 am
by pavel329
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.

PostPosted: Thu Apr 05, 2007 3:47 am
by Sgt. Sparky
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