Hello,
I'm trying to develop a dynamic reaction system for the uses of an item with a hotspot, each item will have a different reaction (dialogue/action etc) for each hotspot.
I'm not sure about how should I propound this.
The general idea is to keep it simple: 1 item interaction per hotspot and the action itself will be the one that handles all possible cases.
Should I store all the reactions per hotspot on a custom item property class that is linked to ACs item system or should I create a lot of interactions with an action per case that are triggered by each item?
How do you handle this on your games?
Thanks in advance.
Comments
So you're looking to eliminate the need for multiple interactions per Hotspot, and just put them all into one?
Using specific Actions for each item/Hotspot combination allows you features such as lipsyncing / audio files to go along with each dialogue, but if you don't need those then it should be possible to reduce the number of Actions involved by altering the text spoken in a single Dialogue: Play speech Action dynamically.
Action field values can be changed at runtime via ActionList parameters - see the Manual as well as this tutorial.
One way you could use this would be to create a separate interaction for each Hotspot/Inventory item combination, but have them each run a single ActionList: Run Action that calls another, parameterised ActionList and sets e.g. the dialogue text dynamically.
But if you insist on having only one ActionList per Hotspot, then you could rely on the "Unhandled interaction", which will run for all items unless referenced in the list of "Inventory interactions". This Interaction ActionList would also be parameterised, but the first Action could be a custom one that sets the values of your parameters accordingly.
For example, lets say your "Parameter 2" was a String parameter tied to your Dialogue: Play speech Action's Line text field, and the relevant speech text was written in your item's "Property 1". You could have a custom Action read the last-selected item, and act accordingly:
InvItem item = KickStarter.runtimeInventory.LastSelectedItem;
string lineText = item.GetProperty (1).TextValue;
thisActionList.GetParameter (2).SetValue (lineText);
(Where thisActionList is an ActionList variable exposed in the Action's UI via the ShowGUI function).
I can help you write such an Action if necessary, but let me know if that's the route you want to go down.
Sorry for the bad explanation. The idea would be to have an interaction call different "reactions" depending on the item:
"use knife(item) on dog(hotspot) -> launch dyalogue -> "I can't kill that lovely puppy"
"use cucumber(item) on dog(hotspot) -> launch dyalogue -> "Dogs hate cucumber!"
"use ball(item) on dog(hotspot) -> launch animation -> dog running
The idea is to use the "Unhandled interaction" and filter it by the last selected item as you said.
My doubt was if relying all parameters on the items themself is the way to go.
The workflow would be something like this:
Since I have to store some special dynamic parameters (such as dyalogue systems conversation or the hotspots that the item will have special reactions to) I think I might need a custom object class that links to ACs InvItem class by it's id and call a reaction depending on the custom objects parameters.