Pathfinding doesn't activate with conditions True

Get help using Construct 2

Post » Wed Apr 17, 2013 8:15 pm

.CAPX: https://www.sugarsync.com/pf/D6025908_4317202_6764554

Following the comments in the "Event CharEnemy" event sheet, what follows SHOULD be the flow pattern of events:

PreChase -->> ChasePhase <<---->> AlertPhase
^^-----------------------------------------
When the VisionCone object overlaps the CharPlayer object, the CharEnemy object SHOULD start Pathfinding TO the Player...but it just sits there even though the two conditions are true to set the status from PreChase to ChasePhase. It isn't until AFTER the Player has left the range of the VisionCone that the Enemy starts chasing the player.
Can someone help me see what I'm missing, please?
I'm seeking Narnia. Who wants to come with me! Aslan is on the move!
B
113
S
20
G
8
Posts: 741
Reputation: 13,661

Post » Wed Apr 17, 2013 8:49 pm

Maybe because the player is still moving and every move within the cone fires off the pathfinding again so maybe it is stuck starting the pathfinding over and over until the condition is no longer true?
B
49
S
11
G
10
Posts: 1,833
Reputation: 14,428

Post » Wed Apr 17, 2013 8:54 pm

I can't get the project to run (I get javascript or plugin errors), but have you tried on collision instead of overlapping? That way it only triggers once for the cone and the player? Is overlapping will keep triggering as long as it's true. Which may be causing some issue.
B
49
S
11
G
10
Posts: 1,833
Reputation: 14,428

Post » Wed Apr 17, 2013 9:30 pm

^ try adding a trigger once while overlapping to path find, or every X seconds while overlapping
B
14
S
6
G
2
Posts: 136
Reputation: 3,210

Post » Wed Apr 17, 2013 11:07 pm

@BluePhaze - Curiously, I did have this working just fine at one point...prior to some edits and additional features I'm trying to add next. But I'll see about doing a Trigger instead of overlapping.
I'm also trying to work in @Yann's suggestion to put the VisionCone and and LOS objects in a container with the CharEnemy object...I'm getting new problems with that given my break-down of layouts and event sheets. I have a habit of making easy stuff complicated.

@wretchedshark - I did have a timer going at one time so not to overload the CPU with the Pathfinding behavior. After making some changes to a previous set-up of my events, I decided I didn't need that wait period after all (it was only checking once every fourth of a second). Now I can't recall exactly WHAT I changed that caused the new mess...
I'm seeking Narnia. Who wants to come with me! Aslan is on the move!
B
113
S
20
G
8
Posts: 741
Reputation: 13,661

Post » Thu Apr 18, 2013 2:15 am

@Rhindon - i think BluePhaze has the right idea, if you add a System Trigger Once While True condition to event 18 in "EventChar Enemy" event sheet it correctly starts chasing the player when the player is in the vision cone.

While the overlap condition is true it while continually recalculate a path to the player, and making it not chase while the overlap is true.
B
14
S
6
G
2
Posts: 136
Reputation: 3,210

Post » Thu Apr 18, 2013 5:07 am

*adds @BluePhase and @wretchedshark to my special "Thank you" list for my game's credits*

Let me go test this...I'll let you guys know if it works on my end...
I'm seeking Narnia. Who wants to come with me! Aslan is on the move!
B
113
S
20
G
8
Posts: 741
Reputation: 13,661

Post » Thu Apr 18, 2013 9:26 pm

Yeah, I had to add a time delay on checking for "Find path". It's working now. :)
Thanks, guys!
I'm seeking Narnia. Who wants to come with me! Aslan is on the move!
B
113
S
20
G
8
Posts: 741
Reputation: 13,661


Return to How do I....?

Who is online

Users browsing this forum: getplay and 22 guests