So I have NPC that is added to the game on design time with Add Combatant Component. And I want to use "Set Nav Mesh Target" event step to tell NPC Combatant to go to certain waypoint.

What does the Combatant need to follow the "Set Nav Mesh Target" event step instruction?
This step works on player which shares the same base prefab with NPC.
Do I need to manually add some component ? Or is there something in move AI I need to adjust?

  • The NPC needs a navmesh agent component attached if you want it to move via navmesh. Also, since it's a combatant, you might want to not have it use the move AI (if you're using that), as having the move AI and navmesh agent do something differently will probably lead to strange results.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • I tried disabling the Move AI, and the navmesh is on. Is there like some kind of movement AI controller that it needs to have on the combatant?
    it also occurred to me just now, I have not checked if "Set Nav Mesh Target" just changes target or also tells it to start moving. I'll look at code.
  • edited September 10
    Ive had issues with move navmesh target too. It should move the target on its own though, regardless of MoveAI settings.

    It'll just choose a target based on the last update. So if the latest update came from MoveAI it'll use that target, and Visa versa.
    They can compete and cause weird issues.

    Is your navmesh set up and is the target valid? Also how are you calling the movement? Is it a separate event that searches for the combatant?
    If your combatant isn't moving at all there's a good chance the event calling the movement isn't pointing to him correctly.

    I used a separate event that searches for object Name(Clone) and then navmesh targets it.

    That seems to work pretty reliably
    Post edited by Wrofir on
  • Well I have a NavMeshWrap event beforehand and it moves correct NPC. I also tried moving player with the same node and player moves. I made separate simple command that just tells NPC to move but that didn't work either. I feel like I'm missing a simple thing but can't figure out what so far.
  • Mind posting a screencap of the event?
  • edited September 11
    I tried the simplest possible event. So, it's just wait and then NavMesh function.

    This works for player, but does not work for NPC. Either scene placed or ORK Spawned.
    The NPC and Player share the same physical prefab.

    Post edited by hellwalker on
  • edited September 11
    I think the problem is that you put wait before action. You should always put wait after the action.
    If still not working then I have no idea why. Maybe put more detailed screenshot then we will know why.

    P/S: Can you tell me how did you able to put the screenshot in here? I always have to put a link, whenever I put image via URL is always show error image.
    Post edited by Night on
  • I tried without wait. I sent Gil a video with detailed info. I feel like there is some component that needs to be added or something.
    For image you just need to use full image URL. with .jpg/.png etc at the end.
    The image upload sites usually give you URL that points to their page instead of image. You can right click image and use "Copy Image Location" to get full url.
  • I think it's due to your NavMesh agent's speed being 0 - either change that in the component or use the Set Speed settings in the node :)
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Thanks! I knew it would be something simple I missed! :D Works now. The fact player was moving was confusing me, which is likely getting speed from mouse movement script.
  • Yeah ... the player controls and move AI set the speed when moving (usually using the combatant's speed settings), so if your NPC wasn't previously moved by the move AI, the defined speed of the agent would be used :)
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Nani! Why your NavMesh agent speed is 0 in the first place anyway? (= =!)
    Also, thank for the how-to post the image.
  • Not sure. I recently upgraded from 2017.4 to 2018.4 and some component values have been set to weird values.
Sign In or Register to comment.