Forum rules - please read before posting.

Checking parameter of actionlist in scene

edited December 2020 in Technical Q&A

Hi,
So basically I have a walking actionlist for my characters called "NPCWalk" that get spawned into every scene, 3 characters can be in scene at one time (so 3 parameters, they randomly come in and out of scene).
There is another actionlist timer for each character "CharacterLeaveRoom" which makes them leave the scene when it hits 0 and if they are in the same scene as the player.

The NPCWalk actionlist is in on a loop, so to stop it from pathfinding the character when they leave the scene I set the character parameter gameobject to none when said character leaves.

Problem is, when I Check Parameter of NPCWalk to see if it has the character's prefab in one of the parameters, it checks the NPCWalk in my assets folder and not the one in scene, so all my checks come back empty.

Im wondering if theres a way to check the version of the NPCWalk actionlist in scene and not the one in my assets folder?

I hope that makes sense
Thanks!

Comments

  • If I'm understanding you right, you're using an ActionList: Check parameter Action to check the parameter value of an ActionList asset - while the asset is being run. Is it running three instances (one for each NPC?) or only the once?

    This Action will read the values of the asset itself, as you've said. Such values are typically set before the asset is run, so normally these will be the same.

    Can you share screenshots that show how/when you both set and check the parameter's value? Just to confirm this is the situation, but I can see about adding a "Check instance value?" (OWTTE) option.

  • edited December 2020

    Hi Chris, yes you're right. And it's only being run once.

    This is on the OnStart cutscene and is setting the markers to the NPCWalk that belong to that scene, and then running the first out of many character actionlist clones

    This is 1 of the character actionlists, after going through this it moves onto the next character with exactly the same actions, but this is the part where it sets the characters for NPCWalk


    And here is checking whether any of the parameters contain this current character and if it does then the parameter gets sets to none and the character is deleted (they walk out the room first obviously)

    But I actually tried to drag the NpcWalk instance that was in scene while the game was running onto the Check Parameter and made it run, and it actually worked so I'm 99% sure the problem is that it's reading the asset and not the version in scene

  • If I may chip in. Hope this might help in some way.

    I've had this kind of problem too and still have with prefab objects that I add to the game at the runtime. And if I try to remove them, it removes them from the game for good, you can never add them again, only if you restart the game.

    I turned out, that I had to add to the scene the prefabed object manually, then to the action list Object: remove, and not the prefabed object in the resource folder, and then I deleted the object in scene. Object: Remove acttion instantly recorder the id of the prefab and showed it right in the actionlist.
    No rpoblems after.
    AC 1.50f

    Thought it might be related to your case.

  • Fundamentally, the Actions you've set up are doing their job. You're checking the state of an ActionList asset, but while an asset is running, it's actually a "Runtime ActionList" in the scene that's performing all the Actions. This is the NpcWalk instance you're referring to - and you're correct that this is the version you want to be reading.

    Normally, checking an asset for its parameter values is a valid approach - when using the ActionList: Run Action, for example, the asset's parameter values are updated before the scene instance is created. So long as those values aren't later changed mid-running, the values in the asset and the instance should be one and the same.

    For this situation though, you should look into having a Cutscene in your scene that references the asset's Actions. If you create a new Cutscene and set its Actions source field to Asset File, assign the NpcWalk asset in the drop-down that appears.

    Then, instead of running and referring to the asset directly, you can instead refer to the Cutscene - which will share the same parameters and Actions, but can be more easily read "live".

  • edited December 2020

    ~~Hi Chris, thanks for that!
    My only issue is that the actionlists that check Npcwalk are asset files as they are being used in like 15 scenes lol, if I made a new cutscene for every scene to assign npcwalk to it, I'm not sure how I'd be able to refer to them in the asset file?~~

    Nevermind figured it out, thanks again both of you :)

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.