Forum rules - please read before posting.

ActionList with Parameters & MoveToPoint Issue

I'm triggering an actionlist to run from code after a specific event. I pass in an AC NPC and another GameObject as a tartget position. The script runs, and the actionlist spawns the character as expected but then does nothing else - ie doesn't move to a marker, face the player etc etc.

Spent hours on this and cant figure it - any help is appreciated! No doubt a silly mistake.

Screenshot shows the ActionList.

Code to call the actionlist is:

ActionParameter paramPosition = new ActionParameter(0);
paramPosition.SetValue(m_resourceTarget);

ActionParameter paramNPC = new ActionParameter(1);
paramNPC.SetValue(NPC_Miner);

List paramList = new List();
paramList.Add(paramPosition);
paramList.Add(paramNPC);

thisAction.actionListAsset.AssignParameterValues(paramList);
thisAction.actionListAsset.RunFromIndex(0);


ActionList:

https://www.dropbox.com/s/peg44d9s4vk38qt/Screenshot 2021-04-14 at 19.01.04.png?dl=0

Comments

  • Welcome to the community, @Morphius1968.

    If the NPC is spawning, it looks like the NPCPrefab parameter is being assigned correctly - just not the NPCTarget parameter.

    If you view the ActionList asset's runtime instance in the scene Hierarchy, it should list its "live" parameter values to help confirm this.

    When an Action accepts a GameObject parameter, this object must still have the component required of it by the default field. In the case of the "Character: Move to point" Action's "Marker to reach" field, this is a Marker - so check that your m_ResourceTarget object has a Marker component attached.

    If it does, please share your AC/Unity versions, and let's see the code in the wider context - the portion you've shared makes reference to other variables declared elsewhere.

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.