Forum rules - please read before posting.

Create "families" so that one interaction can be used for multiple objects of the same type

I don't know what else to call it but this is what I used before in Construct:

https://www.construct.net/en/make-games/manuals/construct-3/project-primitives/objects/families

For example, you might have a family called "Enemies", for which you create a single interaction that works for each and every individual enemy. If the interaction says "Delete (Enemies)", it will not delete them all but rather only the one you're interacting with at the moment.

My particular case is that I want to have multiple identical poppy flowers spread across the floor of my scene. You can pick any of them up and it will add the item "Poppy" to your inventory. So following a tutorial I saw, I can create this actionlist where I teleport the picked up flower on the scene far away to give the illusion that it disappeared into my inventory:

https://imgur.com/a/tzVxgyG (Sorry I wasn't able to add the image to the post, idk why)

Is there any way I can apply this single actionlist to every poppy by making some sort of poppy family, instead of having to make dozens of separate actionlists? The idea is that only the one I'm picking up would disappear.

(I don't have any problem with making it so that it's only added to the inventory once btw, I know how to do that with the inventory check node)

Comments

  • Oh sorry that I posted under the wrong category : ( I can't edit it anymore and couldn't find a delete button either

  • edited March 19

    For your given use-case, the AC equivalent of handling this would be to rely on ActionList parameters.

    ActionList parameters allow you to make Action field values dynamic - so that you can "recycle" them and have them affect different objects each time they're run. They're particularly useful whenever you want to run the same set of Actions multiple times, but have them affect different objects.

    In your case, you can open up your Interaction in the ActionList Editor, and then use the Properties panel to define a new GameObject parameter to override the Object: Teleport Action's Object to move field.

    You could do the same with the Hotspot: Enable or disable Action - but if the object is off-screen you can likely remove this Action.

    This single Interaction can now be referenced by each of your Hotspots. If you want to prefab this, use an ActionList asset file instead of an Interaction - and set your Hotspot's Interaction source to Asset File.

    It's then a case of setting your parameter value(s) at the time of the interaction.

    If you only have one GameObject parameter - and it's the same object as the Hotspot being interacted with - you can set the Hotspot parameter value directly in the Hotspot's Interaction panel.

    Otherwise, you can attach the Set Interaction Parameters component to the Hotspot, to specify the values of multiple parameters.

    Parameters are a powerful feature, but they can take a bit of time to be understood fully to get the most out of them. An introductory tutorial can be found here. A more in-depth video tutorial, that covers a few practical use-cases, can be found here.

  • Oh, that's cool! I never knew there was a properties panel there before, haha.
    This seems to be exactly what I needed o:) thank you
    (PS: Glad you could fix the post category!)

    Is there any way to use a similar thing on an NPC's inventory interactions? For example if I have multiple different flower items in my inventory, but I want to create one single interaction for giving the NPC any of those. (I mean the interaction as set in the inspector, not the ActionList for the interactions). I thought inventory item categories might help for this but couldn't find any way to use them.

  • Yes, categories will be key here - create a pair of Categories, e.g. "Default" and "Flower", and assign the Flower items to the latter.

    In this case, you'd use the Hotspot's Unhandled inventory interaction type - which will be run if you use an Item on a Hotspot but no Inventory interaction for that specific Item exists above.

    Then, in the ActionList, you can use the Inventory: Check selected Action - with Include last-selected? checked - to check if the used Item is in the Flower category.

  • Thanks! That's really neat with the inventory, what I thought had to be multiple different actionlists can actually just be one with everything in it.

    I finally got around to following the parameter tutorial (sorry that I'm going slowly with everything) and:

    -What about the hotspot? shouldn't I create a parameter for it too?
    Or is it somehow automatically linked to the object? Mine aren't so maybe i did something wrong if that's the case.

    -If i have, say, a thousand flowers (I actually don't but to make use of it in the future), do I still have to create an actionlist for each individual one to then call my parameter actionlist? What I was looking for was something that replaced that entirely with only one actionlist for the "category", but maybe it's not possible. I believe it would require a way to tell the actionlist to do stuff with "the object I'm interacting with"

  • What about the hotspot? shouldn't I create a parameter for it too?

    In the tutorial?

    Assuming the Hotspot and Renderer being hidden are attached to the same GameObject, you can just use one parameter to represent them both. A GameObject parameter isn't component-specific - if you pass it to a Hotspot Action, it'll use the associated Hotspot.

    Just looking over the tutorial now, I see that it omits the use of the parameter with the Hotspot Action - I'll amend this, the Hotspot: Enable or disable Action needs to be similarly overridden with the "Object to hide" parameter.

    If i have, say, a thousand flowers (I actually don't but to make use of it in the future), do I still have to create an actionlist for each individual one to then call my parameter actionlist?

    Sorry, for which interaction type? The use of Hotspots? You say "still", but the workflow I covered above doesn't need individual ActionLists for the use-case mentioned earlier.

  • Oh sorry, I'm not sure if i'm creating confusion by having these 2 issues dicussed here together.

    The inventory part works perfectly for putting everything into one single ActionList, since I can use the Inventory: Check selected function inside it to include every possible case scenario of what flower the player is using.

    On the other hand, the issue of my first question, which is about having multiple flower objects in the scene which disappear when the player picks them up sharing the same ActionList, is not completely solved with the parameter solution, assuming I'm understanding correctly:

    I can create an ActionList with parameters as learned, but I still need to create another short ActionList for each of the individual flowers to actually set the parameters to it, don't I? Since there appears to be no "The item I'm interacting with" function equivalent to the Inventory: Check selected one. So I can't make use of one single Actionlist and tell it to go "Ok, now do this and set the parameters to whatever I'm interacting with at the moment".

    Is that correct?

  • edited March 25

    You're welcome to share screenshots to clarify your set up, but it sounds like you can make use of the Set Interaction Parameters component here, to avoid creating such "mini" ActionLists for each object.

    Attaching this component to a Hotspot lets you configure all parameters associated with a given Interaction - so you can use the same Interaction ActionList for all flowers and use the component to modify its parameters each time it's run.

  • Otherwise, you can attach the Set Interaction Parameters component to the Hotspot, to specify the values of multiple parameters.

    I'm so sorry, it seems I missed this part before! Now I understand perfectly, I tried it and it's working like I intended. Thank you very much ദ്ദി・ᴗ・)✧

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.