Stop all HUD actions within template – ShiVa Engine

Stop all HUD actions within template

This function does not stop ALL Actions like hud.stopAllActions(hUser). Instead it stops only those of the specified hud template instance (sHudName).
Don’t use it too often since it iterates over all the users actions and performs a string search on each of them.

--------------------------------------------------------------------------------
function YourAI.stopAllActionsOfHud ( hUser, sHudName )
--------------------------------------------------------------------------------
    local nNumOfActions = hud.getActionCount ( hUser )
    local hAction
    local sActionTag
    local nIndex
    for i=0, nNumOfActions - 1
    do
       hAction = hud.getActionAt ( hUser, i )
        if(hAction)
        then
            sActionTag = hud.getActionTag ( hAction )
            nIndex = string.findFirst ( sActionTag, sHudName .. ".", 0 )
            if(nIndex == 0)
            then
                hud.stopAction ( hUser, sActionTag )
            end
        end
    end
--------------------------------------------------------------------------------
end
--------------------------------------------------------------------------------



Need more answers?

  • slackBanner