I'm quite happy how far I've already got with this however I've hit a roadblock that I really need some help with from someone who knows what they're doing!
Quick summary of my situation - I have some Inventory items that change depending on how and when the player picks them up, I initially made different copies of each Inventory item to then add the relevant version of the Inventory item (I know I know, I realise this is a poor way to do things especially since there are 4 iterations of each item and so my 7 Inventory items are taking up 28 Inventory slots in the manager and new scenes that I've yet to start will add more unique items once I get onto them). So I finally noticed the Property field in the Inventory Manager and realised that I could be doing this whole thing a lot better so instead of 4 different Inventory items of the same item I thought I could simply adjust a Property value of each item instead.
So I have made a custom action that surprisingly works, I'm not sure where I stand posting the code of a custom action on PasteAll as I had to copy certain code from AC actions to get it properly working. If allowed though then I will post for clarity. The action itself is very simple, it has a drop down box where I select the Inventory item to affect as well as an integer box to enter the value of the new property.
So that action is great for setting the property however I need help with getting the property. Well, I know how to do it in a script however I'm struggling to do this in a user friendly way within an action list via an action. The way I want to do it is similar to the Variable: PopUp Switch action, so I'd like to have an action that has the Inventory item drop down box where you select the Inventory Item you want to check however it should then have 4 different nodes tied to the result of what the specific Inventory items property value is and then based on which is true determines what the next action is run (as mentioned similar to how the Variable: PopUp Switch is used).
Hopefully I've explained myself well enough, I've tried to understand how the Variable: PopUp Switch action is done inside the script however I still only understand the very basics when it comes to coding and I'm struggling to fully understand it all (there are even parts of the custom action I did that I don't fully understand)!
As ever thanks again in advance for any help given.
Comments
Have your custom "get" Action derive from ActionCheckMultiple instead of Action, and you'll then be able to alter the number of sockets in your ShowGUI function, e.g.:
numSockets = 4;
"Checking" Actions generally don't need a Run() function, as they only read data without manipulating them. What you do need, however, is an override of the End() function, which is used to determine which output socket to follow when the Action is invoked. Without null error checks in place, all it really needs to do is return a call to ProcessResult() , which generates an appropriate ActionEnd instance based on the correct socket index. For example:
override public ActionEnd End (List<Action> actions)
{
return ProcessResult (2, actions);
}
Will cause the 3rd (counting starts from 0) output socket to be followed. To make it dynamic, replace the "2" with your own integer variable, and set that integer's value to the value of your popup property.
Hi @mjbcfc - did you ever submit this to the wiki? I'm looking to do something similar so would be very interested to see what you did.