Enemy AI behaviour to a specific position.

Get help using Construct 2

Post » Tue May 09, 2017 5:52 pm

Greetings there! ^_^
So i have been looking through the tutorials on AI behaviour and there are some great ones! But however not what i need.

I need the enemy to walk up to the Player and perform an attack when nearby.
Basically so far;

When Player is in LOS of enemy.
If enemy is greater than the Players X, toggle Right
If enemy is lesser than the Players X, toggle Left.

But now, i want the enemy to attack at X+100 or X-100 of Players position, depending on which way they are coming from, left or right.
However the other toggle right or left are interfering with this.

I just want the enemy to walk up to u and start attacking when close enough. Anyone can help with this?
Thanks in advance! ^_^
B
12
S
3
Posts: 164
Reputation: 1,530

Post » Tue May 09, 2017 7:05 pm

@Greaver


Capx: https://www.dropbox.com/s/31xgr61zygs4dqk/shoot%20to%20angle2.capx?dl=0


You can also do the same with just two line of sight

line of sight 1 range to ( wich ever you like to star following) the player

line of sight 2 range to (100) to trigger the attack
B
39
S
22
G
81
Posts: 297
Reputation: 44,710

Post » Sat May 13, 2017 2:27 pm

tarek2 wrote:@Greaver


Capx: https://www.dropbox.com/s/31xgr61zygs4dqk/shoot%20to%20angle2.capx?dl=0


You can also do the same with just two line of sight

line of sight 1 range to ( wich ever you like to star following) the player

line of sight 2 range to (100) to trigger the attack


Hey there! Thanks for taking ur time, but the sample u provided has few errors. If u just jump behind the enemy, he stops.. And he is always moving towards the character no matter distance, we need it via LOS.

I will try 2 different line of sights, maybe that helps. But i still need help with this however.
B
12
S
3
Posts: 164
Reputation: 1,530

Post » Sat May 13, 2017 3:20 pm

Greaver wrote:
tarek2 wrote:@Greaver


Capx: https://www.dropbox.com/s/31xgr61zygs4dqk/shoot%20to%20angle2.capx?dl=0


You can also do the same with just two line of sight

line of sight 1 range to ( wich ever you like to star following) the player

line of sight 2 range to (100) to trigger the attack


Hey there! Thanks for taking ur time, but the sample u provided has few errors. If u just jump behind the enemy, he stops.. And he is always moving towards the character no matter distance, we need it via LOS.

I will try 2 different line of sights, maybe that helps. But i still need help with this however.



With two Line Of Sight Capx:
https://www.dropbox.com/s/eg64fvd0psq5qd8/Two%20Line%20Of%20Sights.capx?dl=0

Sorry about the distance to start following the player my fault I did it quick just to give you an idea.

About the second error is not really an error it meant to be to stop the enemy going crazy when is at the same x & y of the player, I left it open now so you can see why I did that, when the enemies starts to follow the player and the player stops at the same x, y you will see how starts going crazy. let me know if it helps
B
39
S
22
G
81
Posts: 297
Reputation: 44,710

Post » Sat May 13, 2017 3:47 pm

@Greaver


You can do it swell by checking the distance maybe looks cleaner and easier to read the events:

Here are a few Examples:

https://www.dropbox.com/s/v6u3v1xaac8yao6/Diferent%20Options.capx?dl=0
B
39
S
22
G
81
Posts: 297
Reputation: 44,710

Post » Sat May 13, 2017 7:48 pm

tarek2 wrote:@Greaver


You can do it swell by checking the distance maybe looks cleaner and easier to read the events:

Here are a few Examples:

https://www.dropbox.com/s/v6u3v1xaac8yao6/Diferent%20Options.capx?dl=0


Wow cant believe u took the time to help this much! ^_^
Thank u so much! Its perfect! No error, i understand now what u were doing ^_^
Thanks a bunch! ^_^
B
12
S
3
Posts: 164
Reputation: 1,530

Post » Sat May 13, 2017 11:38 pm

@Greaver


Yw sir, Im glad it helped you
B
39
S
22
G
81
Posts: 297
Reputation: 44,710


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 9 guests