I asked another question in another thread, but I've come across something else I don't understand, so I'd like to ask a question.

I'm trying to create a mob character that can walk around and talk, like the townspeople you often see in RPGs.

I have no idea how to do this.

Even when I add a move AI component to a character that can talk, like the ones in the 3D playground demo scene, it doesn't move.

I think this is because the character is not a combatant.

Conversely, even if I attach an interaction machine to a spawned combatant and set the conversation schematics to disable combat, no conversation occurs.

What is a typical way to do this?
I'd appreciate some advice.
  • If they aren't going to be used in combat its honestly easier to just make a "NPC controller" auto machine, one that handles movement and idle behavior, and a interaction machine for conversations. You can use navmesh to handle pathfinding easily as well.

    As to why the interaction machine isn't working could be various things.
    Does it have a trigger collider and the player an interaction controller, first thing to check.

    Miuratale : coming March 29 2025
    Miuratale
  • Thank you for your advice.

    I tried various things and found that it was not the machine but the schematics that were being executed that were not working.

    It was just a schematic that displayed a dialogue, but it didn't seem to work.

    I don't know why this is.

    I changed the faction of the monsters that appeared to the spawning combatants to allies
    to prevent combat from occurring.

    I added an interaction machine and interaction controller to that and set up the schematics to be executed.

    I'm also thinking about an NPC controller,
    but since I'm using ORK, I want to avoid writing code.

    Do you know of any good assets?
  • Move AI requires a combatant (currently), so you need to make NPCs into combatants by adding an Add Combatant component in order to use them. Putting them in an allied faction (or the player faction) will prevent battles from happening with them - though they could still be part of battles with enemies if you have set up to allow others to join in battles (e.g. being nearby a starting battle).

    The 2D quickstart series has an NPC setup like this.


    As for the interaction not working, that's hard to say without knowing the details of your setting. The interaction controller needs to be on your player, not the NPC (or other objects you want to interact with). Interactions need a collider to be recognized by the interaction controller of the player (i.e. for Unity physics to notice it entering the trigger).
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Since Casual_Bald in front of the wolf statue in the 3D Playground demo has an interaction controller attached, I thought the interaction machine would work with NPCs and objects other than the player.

    I'm able to create conversation schematics like in the tutorial, but I'd like the character to be able to walk around the town freely.

    Even when I try to move it around using Dotween, it starts moving in the middle of a conversation, so it's not good.
  • In the end, I attached an AI script to the object so that it would wander around automatically while animating with mecanim.
    I was also able to generate conversation events with the interaction machine.

    But I have an additional question.
    As a next step, I would like to have combat with wandering NPCs instead of conversation.
    I would like the scene to be the place where the enemy was encountered.
    How can I do this?
    There are nodes to specify the scene in Schematics,
    but I don't know how to keep the scene the player was in and the position the player was in.

    There is an NPC with a similar behavior in the 3D Playground demo,
    but when I change the spawned enemy character, the movement becomes strange when moving or they don't move at all, so I don't really want to use it.
    I also don't know how the Combatant Spawner sends the parameters used in mecanim, so I don't know how to improve it.

    So could you tell me how to set the scene used in battle to the current location?

    Thank you for your support in the new year.
  • One more thing to add:
    I would like to fight multiple wandering NPCs that are near the player at once.
    Is this possible?
    The battle range settings are different, right?
    I tried it, but only one enemy appeared.
  • I managed to solve the issue of fighting the enemy at the location of the scene where it was encountered.
    I attached my own script to the combatant prefab that is summoned by the spawner.

    All that's left is, as I mentioned in the previous comment, to fight all wandering NPCs near the player at once.
  • To stop wandering NPCs during the interaction, you need to somehow stop the wandering mechanic. When using the NPC as a combatant with move AI solution, you can just block the move AI (either globally or for specific game objects).
    For other solutions you'll need to handle this differently. E.g. schematics handling this would need to be based on some conditions, e.g. a game state or variable on the game object being set. For custom scripts, you could e.g. call a function on the script via Call Function node to let it know to stop or resume movement.


    The 2D and 3D quickstart tutorials use such 'teleport' battles, i.e. encountering an enemy remembers the position at the start of the battle and load the battle scene. After battle, the game returns to the remembered position and scene.
    There are also separate schematic tutorials for such a setup, see here for battle start and here for battle end.


    As for fighting multiple NPCs, that depends on how you start the battle.
    General, there are the Auto Join Settings found in Battles > Battle System > General Settings that allow enemies around a starting battle to automatically join at the start of a battle, or even join an already running battle when coming in range.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited January 14
    #GIL

    Stopping wandering NPCs during combat worked well.
    As I asked in another thread
    other scripts couldn't read global variables
    so instead I attached an empty component at the start of combat
    and used that as a trigger to stop them.

    As for the spawn position,
    I set it to the same as in the 3D Playground tutorial,
    so this problem has been solved for now.

    Also, it is now possible to fight multiple wandering NPCs at once with the settings I was taught.

    https://x.com/LoneWolf_Cat/status/1879095369285726406

    As a next step,
    I would like to place multiple NPCs at the encounter locations.
    Does this require grid battles?

    Thanks for your support
    Post edited by lonewolf_cat on
  • lonewolf_cat said: I would like to place multiple NPCs at the encounter locations.
    Does this require grid battles?
    No - this is generally handled by battle spots when not using battle grids.
    However, if you want combatants to remain where they are, you can simply not place them at the battle spots in your battle start schematic.

    Also, battle spots are actual game objects, so you can update their positions.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited 7:38PM
    Disabling the "Place at Stop" node indeed made the enemies stay at the encounter location. Additionally, by setting the "Place at Stop" node to only the player, I was able to form a formation with only the player group.
    Thanks for the advice.

    Now, my concern is the range of attacks and magic.
    I've confirmed that allies who are left behind by the leader and positioned far away cannot attack when they join the battle.

    I believe there might be a setting for the range, but I couldn't find such a setting in the abilities or weapons.

    Is there a setting for the attack range?_

    With this setting, if characters can move locations with commands during combat, a combat system similar to Wizardry 8 can be created.

    Post edited by lonewolf_cat at
Sign In or Register to comment.