How do I Pathfinding Objects Stunned or Shooting w/ Lineof

Get help using Construct 2

Post » Wed Jul 27, 2016 5:10 pm

Quick rundown. Enemy guys are coming from the right, good guys that the player controls on the left.

Enemy guys are picking a random target point on the left side of the map and finding a path to that after the on create event. Good guys for sake of arguement will throw rocks at the enemy as they approach, and when hit by the rock they are stunned which should cause them to pause for 1-2 seconds before proceeding if and only if they do not have a line of sight to the good guy.

My problem is I can only get one of those solutions working at a time. So its either I can get the enemy to stop for a brief moment after being hit by a rock, and then they proceed until they are hit again, or I can get them to stop when they have line of sight and throw their own rocks. I can never get it to where the enemy is stunned if they dont have line of sight and also the enemy will stop to throw rocks if there is line of sight to the player and after the enemy or line of sight is no longer there to start moving again. It almost seems like invert has line of sight (doesn't have line of sight) to object doesn't work after they had line of sight.

I can get the enemy to throw rocks when they have line of sight, but then the event that causes the stun overides them being stopped and sends them moving again, or I can get them to stop when line of sight is there, but cannot get them to move again after the line of sight is no longer there.

Any ideas?
B
9
S
3
Posts: 50
Reputation: 804

Post » Thu Jul 28, 2016 2:59 pm

Bump for more visibility. Anyone have any ideas?
B
9
S
3
Posts: 50
Reputation: 804

Post » Fri Jul 29, 2016 2:01 am

Hm…
If you add a timer and two private Booleans (I’ll use “stunned” and “LeroyJenkins”) to the enemy, you could say


1. (Inverted) ENEMY is stunned
ENEMY has LOS to PLAYER
Trigger once
-> ENEMY set LeroyJenkins true
-> ENEMY stop

2. PLAYERROCK on collision with ENEMY
-> ENEMY stop timer “OhNose”
->ENEMY start timer “OhNose” for 1 second
-> ENEMY stop
-> ENEMY set stunned true
-> ENEMY set LeroyJenkins false

3. ENEMY on timer “OhNose”
-> ENEMY set stunned false

4. ENEMY is LeroyJenkins
-> (the logic you use for shooting the player)

5. Else
-> ENEMY move along path

Where "ENEMY stop" is the pathfinding "stop" action.
Eh, Steve!
B
115
S
54
G
13
Posts: 113
Reputation: 16,151


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 16 guests