Input:ActionFilter

When I use this on flow graph in multiplayer it doesn’t have any selections under the filter section, but if I’m in GameSDK it has a bunch. How can I get those filters into the filters in the multiplayer game? Also where is it all located in the code? @Ajia @Datouwan @Jason @AMZN_Rob @Jamie

Hi @silentchurch,

The action filters are not loaded by default. To use them in a non-GameSDK project you can add the action filters to the dev//config/input/actionmaps.xml file and then modify your game’s ::LoadActionMaps() function to create action filters like this:

    void ExampleGame::LoadActionMaps(const char* fileName)
{
if (g_Game->GetIGameFramework()->IsGameStarted())
{
CryLogAlways("[Profile] Can't change configuration while game is running (yet)");
return;
}
XmlNodeRef rootNode = m_gameFramework->GetISystem()->LoadXmlFromFile(fileName);
if (rootNode && ReadProfile(rootNode))
{
IActionMapManager* actionMapManager = m_gameFramework->GetIActionMapManager();
actionMapManager->SetLoadFromXMLPath(fileName);
m_defaultActionMap = actionMapManager->GetActionMap("default");
// LOAD ACTION FILTERS - START
int nChildren = rootNode->getChildCount();
for (int i = 0; i < nChildren; ++i)
{
XmlNodeRef child = rootNode->getChild(i);
if (!strcmp(child->getTag(), "actionfilter"))
{
const char* actionFilterName = child->getAttr("name");
const char* actionFilterType = child->getAttr("type");
IActionFilter* pActionFilter = actionMapManager->CreateActionFilter(actionFilterName, !stricmp(actionFilterType, "actionPass") ? eAFT_ActionPass : eAFT_ActionFail);
if (pActionFilter)
{
bool bResult = pActionFilter->SerializeXML(child, true);
if (!bResult)
{
AZ_Printf("ActionFilter","Failed to serialize action filter");
continue;
}
}
}
}
// LOAD ACTION FILTERS - END
}
else
{
CryLogAlways("[Profile] Warning: Could not open configuration file");
}
}

Here’s an example actionfilter xml node:

	  <actionfilter name="ExampleFilter" type="actionFail">
<!-- actions that should be filtered -->
<action name="moveleft" />
<!-- actions end -->
</actionfilter>

The code that actually gets the filter from the ActionMapManager and sets it in the global UI enums that Flowgraph uses is in dev/Code/CryEngine/CryAction/EditorUIEnums.h in EditorUIEnums::InitActionFilterEnums(). The action maps are also passed to the global UI enums in EditorUIEnums.h as well.

Cheers!