Forum rules - please read before posting.

Two instances of the same ActionList

Hey all,

I have a trigger volume that when an NPC enters it runs a set of actions that affect the NPC, the problem is that when a second NPC enters the trigger and the action list runs it then simply restarts the action list with this new NPC that enters the trigger and completely leaves the first NPC in limbo.

Logically I can see that only one instance of each action list can run at one time therefore if the action list that is running for the first NPC hasn't finished by the time the second NPC enters the trigger then I can understand exactly what is happening in that the action list starts again with the second NPC. I'm just trying to figure out if there is something I'm doing wrong or a setting I can change to enable two instances of the same action list to run together?

For a bit more context when the NPC enters the trigger they are told to stop moving (all these are done using parameters and the character to animate is the collision object - by the way Chris this feature is insanely so big thanks for that). The NPC/collision object is then animated to simulate them picking up some food, talking etc and then after a time they are told to resume their last path. This all works perfectly as long as only 1 NPC is within the trigger at any one time. So is there a way for me to ensure that when a second NPC enters the trigger it doesn't stop the first NPC's action list?

Hopefully I've explained myself well enough and thanks in advance for any answers provided!

p.s. Unity version is 5.6.0f3 and AC is 1.57

Comments

  • An ActionList cannot run more than one instance of itself, as you've correctly stated - however you should be OK with ActionList assets.

    You can convert any scene-based ActionList (such as a Trigger) to an ActionList asset via the "cog" menu at the top of its Inspector.

    If you then amend your Trigger to just have a single "ActionList: Run" Action, you can then pass your GameObject parameter to the new asset.
  • @ChrisIceBox

    Thanks again for your quick support. I'm still however running into the same problem as before, when the second NPC enters the trigger it runs the newly converted actionlist asset however I'm guessing that actionlist assets can also only have one instance of themselves running at a time and therefore the second running of this cancels the first one and leaves the first NPC in limbo as before.

    Apologies if I have misunderstood your advice, I'm guessing that neither scene based or asset based ActionLists can run two instances of itself therefore I have a feeling that I somehow misunderstood your advice as the way I have it setup I am still trying to run two instances of the same action list (albeit now they are asset based rather than scene based).
  • Actually this was my fault - ActionList assets can't currently have multiple instances of them run at once.  However, I believe that this ought to be possible - so I intend to implement this as an upcoming feature.
  • @ChrisIceBox

    Fantastic, thanks again!
  • Hey Chris, I now see that the ActionList Asset has the 'Can Run Multiple Instances?' checkbox however I'm struggling with one particular aspect. I intend to use this to send different NPCs on the same routes, so I've created an ActionList asset which will send an NPC to a few different markers. I'm doing this by making the NPC a parameter and so I run the ActionList to send NPC01 to Marker01, then Marker02 and finally Marker03 (so this is simply Character: Send to Marker01, wait until finish then Character: Send to Marker02 etc).

    The problem I am having is that whilst the ActionLists are getting instanced as desired the wait until finish seems to be waiting for all instanced ActionList actions to finish. So during my testing I run the ActionList to start sending NPC01 to Marker 01, a few seconds later I'll then run the ActionList again with NPC02 as the new paramater to send them to Marker01. NPC01 however upon reaching Marker01 will wait there until NPC02 gets to Marker02 - at that point both NPCs will then proceed to Marker02 at the same time. So NPC01 is waiting for NPC02 to finish before continuing their instanced ActionList.

    I've tried unchecking the 'Wait Until Finished' checkbox and simply adding a 'Engine: Wait' and waiting for 10 seconds before sending the NPC to Marker02 and in this scenario it all works perfectly - so I'll send NPC01 to Marker01 via the ActionList and then a few seconds later I'll send NPC02 and both instanced ActionLists behave as expected with NPC01 always staying ahead of NPC02 and not waiting around until NPC02 has finished their actions.

    Hopefully I've explained myself well enough here - the Engine: Wait, whilst technically allowing the ActionLists to work properly, isn't ideal as I need NPCs to reach a marker and then proceed to the next marker properly and seamlessly continuing along to the next marker (I'd have no idea how long to wait and it would vary for each NPC anyway).

    Thanks again in advance as always!

  • What're your AC and Unity versions, and how are you setting the parameters?

    If you can create a single scene test package with the NPC prefabs / ActionList assets necessary to recreate it on my end, I'll have a look.

  • Thanks Chris.

    I've created a new scene with the bear minimum (just the NPCs and path markers). I've then exported the scene as a package, I presume that is what you wanted? The package is 215MB, if this is what you were wanting then how would be best for me to send you this securely?

    As for versions I believe my AC is the latest version as it is 1.66.1 and I'm using Unity 2018.3.0f2 and in particular I'm using the new HDRP.

  • Did you uncheck Include dependencies?? It shouldn't be that large. Either way, you can upload it to a file-sharing service e.g. Dropbox and PM me the link.

  • Apologies, I thought I needed to keep that checked to ensure that you had the exact same scene as I do to help recreate the problem. Re-exported and now only 20MB - I'll PM you the link now. Thanks again.

  • Thanks, recreated. I'll look into it.

  • Nice one, thanks again Chris. Have a good weekend mate.

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.