edited December 2015 in ORK Support
imagei've got four characters who can potentially join the Player Group

they're all placed in one scene, and they all have their own Interaction Events to get them to join up (they should all share a single Event, but when i started hitting this problem i thought maybe i was doing something wrong with passing data into the Event, so i simplified things back so that each of them have their own separate Event for now)

they all have a "Follow Leader" AI Movement Setting, which has a Component Type of "Default", and they all have a "Place On Ground" component manually added to their prefabs

if i disable three of the NPCs, so that only one is active, i can initiate an Interaction Event with that one active NPC, and he'll join the Party, and follow the Player. if the Player goes outside, the NPC follows him. if the two of them return to the original scene, then the NPC follows, and the NPC prefab is no longer there in the scene

so far, so good, all working as expected. this works for any of the four NPCs, as long as only one is active in the original scene

but, i want all four active in the scene and potentially able to join the Group

so, i make all four active. let's call them NPCA, NPCB, NPCC, and, um, NPCD

go up to NPCB, and ask him to join the Group. he agrees, and then... NPCA suddenly starts sliding all over the place (with no animation). NPCB doesn't move at all

take the Player outside, and at that point he's joined by NPCB, and everything then works as expected. NPCB follows him around. go back inside, and NPCB's prefab is no longer there (and NPCA has returned to their original position)

it's not specific to NPCA either. disable NPCA, and go up to NPCC and ask him to join the Group, and after he's joined up... NPCD slides all over the place

and so on and so forth

this happens if i run from the scene in which the four NPCs are, or if i run from the Main Menu

i'm pretty sure it's related to the NPCs' Movement AI somehow, because if i disable that on all the actors, then i don't get the slidy thing happening (although obviously the Group NPCs then don't follow the Player at all, except when he changes scene). if i check "Use Move AI' for each combatant, but uncheck "Follow Leader" in the MoveAI "Group" settings, then i also don't get the slidy thing happening (although again the Group NPCs don't follow the Player)


the only (clunky) solution i've been able to come up with so far is to make four separate scenes for each of the different NPCs, but that's obviously not what i want, and it leaves the issue of why this is happening unresolved

any suggestions welcome, because i've already spent two or three days banging my head against this particular brick wall without getting anywhere





Post edited by gamingislove on
  • Kinda depends on your setup - e.g. are the combatants already added to the NPCs (through Add Combatant components) or are they added in the event?
    Might be that you're joining the wrong NPC?
    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!
  • i'm currently adding the Combatant Component within the Interaction Event, but i've also tried adding it manually to each of the NPCs in the past (and removing the add from the Interaction Event). when i do that it displays similar, although not identical, error behaviour - in that the wrong character slides around the scene, but that same wrong character then joins the Player on subsequent screens. that happens whether or not "Own Move AI" is selected on the Add Combatant Component

    in my current confiuguration (adding the Component from within the Interaction Event), i'm pretty sure i'm joining the correct NPC, because, as i said originally, the correct NPC joins the player once he leaves the scene, and then follows him around correctly in the new scene. that happens whichever one of the four i ask to join the Group

    one extra piece of information that i've just now discovered, is that the NPC who slithers around the scene, will be the first active character to appear in the Scene Hierarchy window. in other words, if i change their order around, the problem will effect different characters each time

    (i've just checked, and the first character in the scene Hierarchy is also the one who will follow the Player around using the manually added Combatant Component configuation)
  • Hm, very mysterious ... think you can send me a small Unity test project with your setup?
    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 November 2015
    it's taken a while, because i had to create a drastically pared down version of the original project (which is around 5gig), but i've just now pm'd you a link to a version which displays the error behaviour

    i'm hoping you'll take one look and say "ah HA! what were you thinking?", but i've been playing around with it for days now without seeming to get anywhere near solving it
    Post edited by HarryOminous on
  • edited November 2015
    i think i've stumbled on a solution:

    change "Component Type", in "Move AIs/Move Component Settings" from "Default" to "Nav Mesh Agent" and the NPCs all then act as expected. none of them go sliding across the floor

    there are some other things to sort out when using the NavMesh approach (for example, in the sample i sent, the joining NPC now floats slightly above the floor), but i think those will be soluble with a small bit of experimentation

    all of my scenes have NavMeshes defined in them anyway, so it's not going to be that big a deal to swap to using them from my point of view, so it's really then a case of whether you think it worth spending any time on working out why the Default setting has that undesirable side-effect
    Post edited by HarryOminous on
  • *sigh*

    well, i THOUGHT i'd solved the problem. it certainly seemed that way

    but, i went away and manually added Nav Mesh Agent components to all the NPCs, and tested again


    and, wouldn't you know it, the stoopid things are sliding around the place again...
  • edited November 2015
    no, wait!

    if i take off the manually added Nav Mesh Agents, and leave ORK to add them to the NPCs itself, then everything does seem to work correctly

    BUT, ORK is just using default values for the Nav Mesh Agent parameters, which i need to override in order to stop that "floating off the ground" thing, specifically the "Base Offset" value (which was why i'd gone off and started adding all the Nav Mesh Agents manually)

    AND, using the NavMesh and suddenly all the battles go screwy, with combatants running off screen, never to return, so, um...

    something something something... time to call it a night, and try again tomorrow...
    Post edited by HarryOminous on
  • ok, so i've tried again this morning

    the one sure way i've found that works to stop the slidy problem, is to change "Component Type", in "Move AIs/Move Component Settings" from "Default" to "Nav Mesh Agent"

    AND to let ORK do it. it's no use adding the NavMeshAgent component to the NPCs manually, because otherwise the slidy problem returns (possibly something to do with the order in which the Components appear on the NPCs?)

    to fix the problem that was occurring in the Turn Based Battles where combatants were running off screen, i needed to tweak "Change Position" in the "RunToTarget" battle event, to set a positive "Stop Distance", (otherwise i guess they didn't know WHEN to stop)

    so far so good. the problem, as outlined in some of the above posts, is that when ORK adds the NavMeshAgent, it does so using the default NavMesh settings, with an Offset of 0, which results in the NPC floating above the ground, as so:

    image

    what i WANT is for the NavMeshAgent Offset to be about -0.07, as here:

    image

    so, frustratingly close to a solution, but as yet, no banana
  • yay!

    ok, sooooo, i'm sure there must be a better way to do this, but for now i've created a new Event Function, attached to all NPCs and run automatically every second

    it checks whether they have a NavMeshAgent, if they do it checks whether baseOffset is zero, and if it is, it sets it to -0.07

    bish bash bosh. almost like real programming...
  • Will look into it today/within the next days :D
    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!
  • Lol - ok, very strange looking problem with a simple solution :)
    You've put all your actors as child objects of another object - somehow the move AI seems to move the wrong object (since they're pretty much all a single big object from the same child object). Will investigate why that's happening.

    To fix this, simply don't parent the actors to a game object - or use a Mount Object step to unmount the actor before adding the combatant/joining the group.
    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!
  • thanks for looking into that gil

    i like to keep my scenes neat and tidy, and it never occurred to me that putting all the NPCs into a higher level object would cause any problems

    i wonder if there are any other similar potential nasties lurking? i tend to put things like waypoints and spawners and so forth in their own higher level objects too, in order to keep the hierarchy window uncluttered

    anyway, i've added a Mount Object step to unmount the NPCs before getting them to join the Group, and that's fixed this particular problem


    (i do have a couple of other problems i've been struggling with for the past few days, including another "slidy" problem affecting victorious combatants when the player loses the game, just before the scene switches to the game over screen - but i'll leave those for another day)

    thanks for the help again
  • Usually it doesn't make problems - unless you're moving stuff around. Moving parented stuff can behave different than moving free game objects.
    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!
Sign In or Register to comment.