Hi,
after not coding in C# for at least 10 years I sat myself down yesterday to code my first custom action. I call it "MultiBoolCheck" and it is used to check a unlimited number of global boolean variables if they meet given conditions. I need this to clean up my action lists if there are to many variable state checks.
Or simply said, it can turn this:

into this:

The Action is based on the "Variable: Check" Action. It only works with global boolean variables and does not support ActionList parameters. Maybe someone else has a use for it.
Comments
This does not work for me in Unity 2018.2
I put the MultiBoolCheck.cs where the AC scripts are and nothing ...
Anything changed in scripting for 2018 this file ?
2. "Within the Custom Action scripts panel, click Set directory." checked
I do not think it is something I did wrong. What else should I check ?
I know it's been a while, but this is extremely useful... but I can't get it to work. It's telling me there's an error on line 97: ActionMultiBoolCheck.cs(97,35): error CS0115: 'ActionMultiBoolCheck.End(List)': no suitable method found to override
Any ideas?
Welcome to the community, @midnightdojo.
It's an old Action that uses the old Action API, deprecated with AC v1.73.
A guide to changes made to the API can be found here, but I've attempted to update the wiki page with the corrections - have a try now and see if it works.
Thanks @ChrisIceBox. You're epic! I got it to work, there were only two minor issues that I fixed. Maybe you can update the wiki with them.
line 51 we have:
Hits++:
I changed it to
Hits++;
Then on line 61 we have
{
ACDebug.LogWarning("The 'Variable: MultiBoolCheck' Action halted the ActionList because it cannot find the Global Variable with an ID of " + _multiBool.variableID);
return GenerateStopActionEnd();
}
I changed it to:
{
ACDebug.LogWarning($"The 'Variable: MultiBoolCheck' Action halted the ActionList because it cannot find the Global Variable with an ID of {_multiBool.variableID}");
GenerateStopActionEnd();
return false;
}
It seems to be working now! Tested it out with a few variables. This is going to save me a ton of time.
Amended - thanks for the pointers.
Cheers! I'm mostly just a composer who is working on a click adventure, so I'm not that good at coding yet, but I was able to hack around until I figured out what worked. Anyway, thanks again. It's been extremely useful.