Forum rules - please read before posting.

Inventory: Action List Editor - How to add Scriptable Object to a List

I have a set of abilities that I have created for a character. These abilities are within a form of a scriptable object. When these objects are added to a script that I have attached to the player, he can then use the ability. 

Question is: How can I use the action list editor to add a scriptable object to the characters list. 

What I have done: 
-I have created and inventory object to represent this ability as an in-game pickup. 
-I have created a game object that represents this ability. 
-I have created an action list to pick up the object and add it to my inventory.

What I have tried:
In the 'Use' action list of this ability I have tried to create an action such as:
Action type: Object - Call Event
Editor and Runtime: Add a game object that contains a list of these scriptable objects. Then pass a reference to the character code as to what ability to use. 

This didn't work as the very long argument exception basically said that it failed to convert parameters. 

I know you cannot attach a scriptable object to a game object, but I thought there may be a way to call it by reference. I'm not having much success with this. Or quite possibly I need to go at this from a different angle. 

Any thoughts would be greatly appreciated!!

Comments

  • You will need to describe the contents of the ScriptableObject more clearly to get specific advice - there's no "standard" way to call a custom object like that.

    However, the general answer would be to create a custom Action that can talk to the ScriptableObject in exactly the way you want it to - see this tutorial.  If you're familiar with C# scripting, I would say that's the best way forward.
  • Interesting, I'll have to check out the custom action.

    -----
    The contents of this scriptable objects are:

    String,
    Two Game Objects,
    Texture2D,
    4 Ints and 1 Float. 
    -----

    I have a wizard that is creating these abilities wherein the ScriptableObject is then put in a folder. 

    I have a script on the character that on start fills a list of available abilities (ScriptableObjects) that are located in the folder to be used. Then on a particular input method I select the appropriate ability in the list to be used in game. 


  • In that case, you would definitely need a custom Action to communicate with it.
  • Well I rewrote the script last night and now instead of having to add the ability to the list on character. I've simply created a function to enable or disabled these abilities. By default, they are all disabled. Idea now to use the Object Call Event from the action list, attached the game object that has the script on it and then use the function that I have created. 

    Well I have done all of this and for some reason, the object: call event is not triggering the function. I have a running debug to see if the abilities have been enabled or now. And the status never changes. Thoughts on this. 


  • Is there a way to debug or step though an action list?
  • Comments and breakpoints can be assigned to Actions by clicking an Action's cog icon in the ActionList Editor window.  Checking Print Action comments in Console? will output those comments to the Console.

    Is the function correctly showing up in the Object: Call event Action, and have you tried placing a Debug line in the function itself?  You could try using the Object: Send message Action instead.
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.