I need to store specific values for AC hotspots that are enabled/disabled from a Playmaker FSM (PM is used for game logic - it enables/disables hotspots and assigns specific actions to them according to various conditions), so that when the player clicks on these (at any time later in the game), the actions that follow are dynamic.
I want to store this information in an AC popup variable with an index specific to the hotspot (I change the data in the popup at that index). My issue is that AC doesn't seem to be able change a popup's content within an ActionList. If I use the Variable - Set or Variable Copy operations on a popup, I can only impact it's index, not the content to which it refers. I know I could write a script such as:
GlobalVariables.SetPopupValue (int variableID, int value); (I need to set the second value)
But wouldn't it be possible in the ActionList editor to have the ability to specify a value for the Variable - Set operation when the variable is a popup?
A few other questions if anyone has done this before and could help:
- Call an AC ActionList from a Playmaker FSM (I'm currently using variables and an AC ActionList running in the background to interface the plugins, but would be easier to be able to directly call an AC ActionList, possibly with parameters). Didn't find anything like this on the AC Wiki
- A script that retrieves the Constant ID number of a "Remember Hotspot" component attached to a hotspot. The idea is to be able to have the "Use" and "Examine" interactions of a hotspot call a generic ActionList to retrieve the hotspot's ID, instead of having to create an ActionList for each hotspot (I have many) which then calls a generic ActionList to pass parameters (trying to do something similar to the object ID passed on for the "Inventory Interactions"). An alternative to this would be to add an ID by default to AC hotspots which would be always passed on to a called ActionList as the first parameter.
Comments
If you want total control over the storage of information in a variable, use a String. Through code, you can divide your "sub-content" with a special character such as a colon, and then split into an array again when you need to read it. AC does this itself when saving certain data types - see for example, the GetSaveData and LoadData functions of ActiveList.cs.
Any AC ActionList or ActionListAsset can be invoked by calling its Interact() method - see Section 5.19 (Interaction scripting) in the Manual.
An object's Constant ID number can be retrieved with:
myGameObject.GetComponent <ConstantID>().constantID;
(For a complete reference of all AC public functions and variables, see the Scripting Guide).
If a Hotspot's Interaction has a GameObject parameter, then the Hotspot can be linked to that parameter within the Hotspot Inspector.
The conversion between a string and a string array is fairly trivial, and only needs to be done at the point of saving / loading. The actual play-by-play management of the variables can be handled in a separate script, and the values can then be sent to the String Variable with the OnBeforeSaving custom event.
It's also the case that while PopUp labels are translated, these translations cannot be modified at runtime either - so I'm not sure of the benefit of using PopUps would allow.
displayed when player clicks on the hotspot (this is where I need to link a given hotspot ID with
a given index in the popup which contains the dialogue texts). The dialogue text displayed can change for a same hotspot during different parts of the game (managed by the PlayMaker FSM)
I see your point about keeping within AC / PM, as obviously AC itself is a visual-scripting tool. But the line does have to be drawn somewhere - and you are trying to achieve something it wasn't expressly designed for, as well as involving another asset.
IMO scripting is the better option over trying to fit AC around your needs. I don't know what your coding experience is, but I can help if you need it. The general principle, as I see it, is as follows:
However, I'm not sure if this is even the only approach. Have you considered e.g. altering the value of, say, an ActionList's Integer parameter value that determines what Actions play following an "ActionList: Check parameter" Action? I'm not completely clear on the fundamental need for this, so please feel free to offer a more detailed explanation on the initial scenario.