Untitled

mail@pastecode.io avatar
unknown
plain_text
24 days ago
2.3 kB
3
Indexable
Never
--[[
    Basic response setup config time boys
    - Triggers: The key words that will trigger this response, make sure it's specific as if that term matches in the query then that response will be picked.
    Add a ~ to have it check if that term is matching within the sentance, and not just "specific"
    - Responses: A list of responses that the AI will randomly pick from when responding to a query (As long as it's not overwritten by the customAction return).
    - customCheck: A custom check of whether a player can *actually* run that query. Return true if you want a player to be able to run it, false if not.
    - customAction: You can have the bot run a customAction if you want. Return false to have the bot pick a random response from the Responses setting,
    return a string to have that overwrite the response with one of your own.
]]--

ASBaseAI.Responses = {
    {
        triggers = {
            "Hello",
            "~Hi"
        },

        responses = {
            "Welcome back",
        },

        customCheck = function(ply,txt)
            return true
        end,

        customAction = function(ply,txt)
            return false
        end,

        canSee = function(ply,txt,activator)
            return true
        end,
    },

    {
        triggers = {
            "System Call, Toggle Main Base Gate",
            "System Call, Toggle Main Gate",
        },

        responses = {
            "Confirmed %n, now toggling Main Gate",
            "Understood, Main Gate now toggling...",
        },

        customCheck = function(ply,txt)
            return ply:HasAccessNumber(3) or ply:InVehicle()
        end,

        customAction = function(ply,txt)
            local gate = ents.GetMapCreatedEntity(3251)
            local button = ents.GetMapCreatedEntity(3214)
            if IsDoorOpen(gate) then
                gate:Fire("Close")
                button.ButtonToggled = false
                return "&7Toggled &f - Main Gate closing..."
            else
                gate:Fire("Open")
                button.ButtonToggled = true
                return "&7Toggled &f - Main Gate opening..."
            end
            return false
        end,

        canSee = function(ply,text,activator)
            return ply == activator
        end,
    },
}
Leave a Comment