AI question.(small)

Non-platform specific questions.

AI question.(small)

Postby pavel329 » Sun May 20, 2007 12:26 am

I am still working on that alliance game.
I just want to know how to make it whee the enemy just follows a path i give him.
And the when i get close enough the path is destroyed and he comes after me and attacks me.
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

well

Postby d-soldier » Sun May 20, 2007 12:41 am

There is probably a better way, but it seems that if you setup a variable (actor variable) [call it "alert"] and and setup the badguy is this way:

Create-Actor/Script:

alert=0;

Draw-Actor/Script:

if(alert == 0) {
//insert the whole path thing here;
}
if(alert == 1) {
//insert the whole move-to thing here;
}

and add an activation event (from any actor) with a script that says:

alert=1;

----------
Now the setup is complete, but you will need to add a filled/wireframe region around the bad guy. That region's needs an activation event, so right click on it, and setup an activation event [collision w/ player] and send the event to the badguy....
So basically you make the player enetering the region change the alert variable for the badguy, therby adjusting his behavior.
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score

Postby d-soldier » Sun May 20, 2007 12:46 am

heres a pic... I work better with visuals when people are helping me...
Attachments
wwii_01.jpg
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score

Postby pavel329 » Sun May 20, 2007 1:52 am

ok i get most of this.

but what do i put for the whole " move to thing here" An "Path thing here"

Do i just put the path the i want him to walk?
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 pavel329 » Sun May 20, 2007 2:01 am

ok i get what to put in move to.
But what about path?
i checked under functions but found no path.
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 pavel329 » Sun May 20, 2007 2:03 am

lol ok nm i found that out too.
Well thanx alot for the code that helped alot.
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 d-soldier » Sun May 20, 2007 4:07 am

Sounds like you got it figured out before I got back to check on you.. :D
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score

Postby Sgt. Sparky » Sun May 20, 2007 1:47 pm

yeah. :D
but I would reccomend using a code like this in a draw actor event of that enemy(make alert an actor variable.):
Code: Select all
if(distance(x, y, player.x, player.y) < 175)alert = 1;   
else alert = 0;
//then all your moving ect. here.
: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

Postby pavel329 » Sun May 20, 2007 3:54 pm

thanx alot guys.

Ugh this game is too long.


Oh also i was wondering how to make levels.


I thought maybe when you hit a certain target you do the move to option.
Like to the place where the next level is.
Also a destroy actor option so the level you just finished is destroyed making the game go faster.


Would this work?
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 d-soldier » Sun May 20, 2007 4:10 pm

See, Sparky just eliminated the need for the activation events and filled regions... I knew there would be a better way... as far as the levels go, a move-to funtion at very high velocity should do the trick, just make sure the player and the view get moved.
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score

Postby pavel329 » Sun May 20, 2007 4:29 pm

Well in my game you change chaters each l
And what i did was had a character all ready to go and when the first play got to the end,He would be destroyed.And the view would change parents to the new guy.
And the new guy would be stuck in an invvisible box.(to prevent him from movin around when you push butons at the other level)

So when the views parent changed.
You would see text saying push this button to start.
And the box would be destroyed.
There youv are at the new stage.


I hope you get what i mean.


I barely ever use codes.
I try to figure other ways.Lol


But still than for the codes guys.
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 pavel329 » Sun May 20, 2007 8:26 pm

none of these are working.
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 pavel329 » Sun May 20, 2007 11:54 pm

plz can someone tell me what to do?
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 pavel329 » Mon May 21, 2007 12:47 am

Plz?
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 d-soldier » Mon May 21, 2007 4:56 am

How about you help us with some information... whats not working? The subject of the post, or the last thing you said regarding levels?
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score

Next

Return to General

Who is online

Users browsing this forum: No registered users and 1 guest