Forum rules - please read before posting.

ActionCharPathFind.CreateNew not working

my script
action = ActionCharPathFind.CreateNew(character,marker,PathSpeed.Walk,false);
action.Run();

character and marker has value, but
action.runtimeChar is null
and also
action.runtimeMarker is null

i think we should check this function ActionCharPathFind.CreateNew
thank you

Comments

  •     public static ActionCharPathFind CreateNew (Char charToMove, Marker marker, PathSpeed pathSpeed = PathSpeed.Walk, bool usePathfinding = true, bool waitUntilFinish = true, bool turnToFaceAfter = false)
        {
            ActionCharPathFind newAction = CreateNew<ActionCharPathFind> ();
            newAction.charToMove = charToMove;
            newAction.TryAssignConstantID (newAction.charToMove, ref newAction.charToMoveID);
            newAction.marker = marker;
            newAction.TryAssignConstantID (newAction.marker, ref newAction.markerID);
            newAction.speed = pathSpeed;
            newAction.pathFind = usePathfinding;
            newAction.willWait = waitUntilFinish;
            newAction.faceAfter = turnToFaceAfter;
            newAction.runtimeChar = charToMove;
            newAction.runtimeMarker = marker;
            return newAction;
        }
    

    i add two line and it works

  • Thanks for sharing - though runtimeChar and runtimeMarker are both set by the Action's AssignValues function, which should be called before it gets Run.

    How are you running the Action / ActionList after calling CreateNew, and what is your AC version?

  • my script
    action = ActionCharPathFind.CreateNew(character,marker,PathSpeed.Walk,false);
    action.Run();

    ac version: 1.85.5

  • edited March 9

    Actions will not run correctly done this way. You instead need to add them to an ActionList, and then run the ActionList.

    See the Manual's "Generating Actions through script" chapter for details, as well as the ScriptedActionListExample script for a guided example.

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.