1. ## Simple sky-view AI

[size:20pt][color:#009900]AI Rocks!![/color][/size]

Why does it rock? Isn't it obvious? No? Well maybe? If you don't think so then don't read this article.

[size:14pt]What is AI?[/size]

Most people already know this, but what is it in MMF? its the way an object sees another object and then follows it around.
In this article you'll find out how to Make an object follow you when you get too close, make the object stop following you when it can't see you anymore, and making the object able to shoot you while following you.

[size:14pt]Starting with AI[/size]

Ok to get started, create 2 active objects. Put one of them in the "Bouncing Ball" movement, have it in a speed of 10. The other needs to either be the "Eight Directions" Movement or a custom movement. Create one more active object and call it "Notice".

The "Notice" object needs to be bigger than the player and a wide enough range to be a good detector. We'll be using the "notice" Object to alert the enemy and make him follow you.

[size:14pt]Now for our Feature presentation[/size]

Ok now we can actually get into the fun part right? I’m pretty sure.

To start put in these events: [color:#6600CC]<[/color] = condition [color:#33CC00]->[/color] = action

[color:#6600CC]<[/color] Always
[color:#33CC00]->[/color] set position of "notice" at (0,0) from player.
[color:#33CC00]->[/color] Make "notice Invisible
[color:#6600CC]<[/color] Collision between "Notice" and Enemy
[color:#33CC00]->[/color] Set alterable value A of enemy to 1

[color:#6666CC]<[/color] Alterable value A of enemy = 1
[color:#33CC00]->[/color] Enemy; Look in the direction of (0,0) from Player

What’s happening? Well the "notice" is under the player at all times so if the "notice" Hits the Enemy the enemy's alterable value A will go on. If the Enemy's alterable value A is on it will move in the player direction.

Its not natural for a person to see someone 100 miles away and know exactly where they are. There is a way we can fix this though.

Enter these events:

[color:#6666CC]<[/color] X position of enemy = 100+X("Player")
[color:#33CC00]->[/color]Set alterable value A of enemy to 0

[color:#6666CC]<[/color] Y position of enemy = 100+Y("Player")
[color:#33CC00]->[/color]Set alterable value A of enemy to 0

[color:#6666CC]<[/color] X position of enemy = 100-X("Player")
[color:#33CC00]->[/color]Set alterable value A of enemy to 0

[color:#6666CC]<[/color] Y position of enemy = 100-Y("Player")
[color:#33CC00]->[/color]Set alterable value A of enemy to 0

Now when the player gets 100 pixels away from the enemy the enemy won't see him anymore because alterable value A is 0.

[size:14pt]Just some extra stuff[/size]

I don't know if your game is a shooting game or not. If you don't want to or already know how to do this then skip this section.

To create a way to have an enemy shoot you while following you create an active object named "bullet", then use these events:
[color:#6666CC]<[/color] Every 1 seconds (or any time)
[color:#6666CC]<[/color] Alterable value A of enemy = 1
[color:#33CC00]->[/color] Enemy; Shoot "bullet" at (0,0) from Player

[color:#CC33CC][size:20pt]You’re Done[/size][/color]

I hope your journey of learning simple AI helps you. Of Course You can do thousands of things with AI, these are just the basics
in creating a very realistic game.

2. ## Re: Simple sky-view AI

hi, is there a way to do this GREAT stuff in paint shop pro?

3. ## Re: Simple sky-view AI

Originally Posted by fish20
[color:#6600CC]<[/color] Always
[color:#33CC00]->[/color] set position of "notice" at (0,0) from player.
[color:#33CC00]->[/color] Make "notice Invisible
[color:#6600CC]<[/color] Collision between "Notice" and Enemy
[color:#33CC00]->[/color] Set alterable value A of enemy to 1

[color:#6666CC]<[/color] Alterable value A of enemy = 1
[color:#33CC00]->[/color] Enemy; Look in the direction of (0,0) from Player
Why bother using an alterable value? Couldn't you just:

[color:#6600CC]<[/color] Always
[color:#33CC00]->[/color] set position of "notice" at (0,0) from player.
[color:#33CC00]->[/color] Make "notice Invisible

[color:#6666CC]<[/color] Enemy is overlapping "notice"
[color:#33CC00]->[/color] Enemy; Look in the direction of (0,0) from Player

4. ## Re: Simple sky-view AI

YOu should make the notice a circle so that it is more accurate.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•