Forum rules - please read before posting.
Tech questions during the weekend? Drop in on the community Discord channel!

Moving characters randomly

Hi Chris,

I try to use you "Moving characters randomly" from Wiki, but I got this message with AC crash.

Assets\AdventureCreator\Scripts\Actions\ActionCharMoveRandom.cs(564,30): error CS0115: 'ActionCharMoveRandom.AssignConstantIDs(bool)': no suitable method found to override

My Unity version: 2019.2.9f1
My AC version: v1.70.1

Can you help me with it?

Comments

  • Try copy/pasting it again. I've updated the wiki script to work with the latest release - thanks for the alert.

  • Thank you Chris, now it's in without error.:) (Your fast cooperation is amazing like always)

    How is it works? When my NPC reachs a random target after it stops and don't searches another target point. I've tried to do that too: I put a Engine: Wait node after it and give back the job like looping, but that isn't work well good.

    What I want to make finally, my NPC is going to a random point, after wait in idle state after search another point etc...I know how it looks like in loop, but now when I try to check the basic works of this script, I don't understand why my NPC stops when reaches the random point and don't search again.

    Have you any suggestion for it?

  • A single instance of the Action will only make the character move once - you will need to have it run on a loop to keep moving randomly.

    What exactly is the behaviour when you do that? Make sure that Wait until finish? is checked.

    This isn't the only way to move randomly, though. You can also create a Path object, give it many nodes, and set its Path type to Is Random. If a character then moves along it using the Character: Move along path Action, they'll randomly pick a node each time, and this will continue without need for further Actions.

  • Thank you, yes I know your second advice and I used that way in an other project.:)

    Now, I would like a more random solution. Of course I put in a loop, so Character: Move Random ->Engine: wait (f.e.: 3 seconds)-> back to Character: Move Random.

    The behaviour what I see now, my npcs once go to the target and after stay there forever in that target point. No more movement to other point. I checked the node in Play mode, the Character: Move Random is green.

  • Is this in a 2D or a 3D game, and do you get any new Console messages? I cannot recreate any such issue.

  • It's 3d game, I don't have any issue messages, I see it works only when I don't check "wait until finish?" and put after a Engine: wait 3(for example) second, it can loops, after 3 seconds npc changes the target, but if the target is too far, it never reaches its target. After if I check "wait until finish?" my npc reaches the target once, and after it stucked. ( The node stay in green, so it can't finishes)

  • Thank you, Chris! Same issue yet.:/

  • It may be an issue with your character.

    Try dropping in the 3D Demo's "Brain" NPC prefab, and having him move instead. What then?

    If he shows the same problem, temporarily switch your Settings Manager to the 3D Demo - Demo_SettingsManager. What about now?

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.
Do NOT follow this link or you will be banned from the site!