pathfinding sometimes will not activate

0 favourites
  • 5 posts
From the Asset Store
Units do not overlap each other and use different ways if there are several free ways.
  • hello everyone ages ago i brought the Top-Down CGA Shooter from the store and at first everything seemed to work perfectly, but every now and again when I would place an enemy they would not activate when a player approaches them, they would just stand there the code is just if the enemy(zombie) has line of sight with player find path move along path

    any help would be appreaciated

  • Pretty poor code you bought... The store should have some kind of quality control.

    This is not how pathfinder works. In C2 start a new project and select "Pathfinder demo" template to see how events should be organized.

    Also, events 14-16 in your screenshot are executed on every tick, which is not good.

  • Have to agree with dop2000 that the code is wrong, I suspect you might have tweaked it?

    But anyway the issue in regards to the path finding is almost certainly in event 14, you don't use path finding like that. The reason is that path finding for objects are actually done separably outside your main program as far as I know. So your program actually keeps executing code while the path finding is done in the background.

    Therefore you have several Trigger conditions called "On path found" and "On failed to find path" which will trigger when either a path have been found or it failed to find one.

    Which should make you wonder why the "move along path" action is placed in event 14, since the path might actually not have been found yet.

    So what you need to do is add an "On path found" and move the "Move along path" action to here instead.

    But as dop2000 mentioned the 15-16 events are incorrect as well, but shouldn't prevent the path finding from working.

  • Did some testing and it does seem to be working the way it were made. However I would still do it as its suggested in the manual using the "On path found". I might suspect that its the line of sight then, have you tried to disable that and see if all zombies move correctly? And if they do, try to disable every thing in the condition except the Every dt*2 and see if it works?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • thanks everyone its been so long since I first started this project before I picked it up again the other day I can't remember which parts of the code are mine and which are the original project I got from the store, but I am pretty certain line 14 has not been altered I have to go to work now I will experiment making the alterations you suggested later todays thank you all for your time

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)