Skip to main content

Attack

Striking and the attack state. Attack.State returns a fresh Types.State to drop into a brain; Attack.Strike is the blow on its own for a state of your own making.

Attack = VluxyAI.Combat.Attack.State({
	Damage = 34, Cooldown = 1.8, TargetKey = "SeenTarget", Then = "Hunt", Kill = "Live",
}),

Functions​

Strike​

Attack.Strike(
agent: Agent,
target: BasePart?,--

The victim's root; nothing happens for nil or a part with no humanoid.

damage: number,
options: StrikeOptions?
) → KillHandle?--

The kill in progress, when the blow was a kill.

Types

​

interface StrikeOptions {
Kill: KillKind?--

How a blow that would finish the victim is delivered; "Scare" makes every blow a hold that lets go. Default: plain damage.

Animation: string?--

A one-shot loaded by Locomotion to play on a plain blow. Default "Attack".

KillerAnimation: number | string?--

For a live kill or scare: an animation id for the killer, or the name of a one-shot on its Locomotion. Default none.

VictimAnimation: number?--

Animation id for the victim in a live kill or scare. Default none.

Health: HealthProvider?--

Where the victim's health lives, when not on the Humanoid.

}

Hurts the humanoid behind target. When Kill is set and the blow would bring the health to zero, a kill of that kind happens instead and its handle is returned.

State​

Attack.State(options: AttackStateOptions) → State

Types

​

interface AttackStateOptions {
Damage: number
Cooldown: number--

Seconds in the state after the blow.

TargetKey: string--

The blackboard key holding the victim's root part.

Then: string--

The state to enter when the cooldown ends (and any kill has finished).

Animation: string?--

As Attack.StrikeOptions.

KillerAnimation: number | string?--

As Attack.StrikeOptions.

VictimAnimation: number?--

As Attack.StrikeOptions.

}

A state that strikes once on entry and leaves for Then when the cooldown is over and any kill it started has finished. The agent is stopped on entry and stays stopped.

Show raw api
{
    "functions": [
        {
            "name": "Strike",
            "desc": "Hurts the humanoid behind `target`. When `Kill` is set and the blow would bring the health to\nzero, a kill of that kind happens instead and its handle is returned.",
            "params": [
                {
                    "name": "agent",
                    "desc": "",
                    "lua_type": "Agent"
                },
                {
                    "name": "target",
                    "desc": "The victim's root; nothing happens for `nil` or a part with no humanoid.",
                    "lua_type": "BasePart?"
                },
                {
                    "name": "damage",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "options",
                    "desc": "",
                    "lua_type": "StrikeOptions?"
                }
            ],
            "returns": [
                {
                    "desc": "The kill in progress, when the blow was a kill.",
                    "lua_type": "KillHandle?"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 92,
                "path": "lib/Combat/Attack.luau"
            }
        },
        {
            "name": "State",
            "desc": "A state that strikes once on entry and leaves for `Then` when the cooldown is over and any\nkill it started has finished. The agent is stopped on entry and stays stopped.",
            "params": [
                {
                    "name": "options",
                    "desc": "",
                    "lua_type": "AttackStateOptions"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "State"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 145,
                "path": "lib/Combat/Attack.luau"
            }
        }
    ],
    "properties": [],
    "types": [
        {
            "name": "StrikeOptions",
            "desc": "",
            "fields": [
                {
                    "name": "Kill",
                    "lua_type": "KillKind?",
                    "desc": "How a blow that would finish the victim is delivered; `\"Scare\"` makes every blow a hold that lets go. Default: plain damage."
                },
                {
                    "name": "Animation",
                    "lua_type": "string?",
                    "desc": "A one-shot loaded by [Locomotion] to play on a plain blow. Default `\"Attack\"`."
                },
                {
                    "name": "KillerAnimation",
                    "lua_type": "number | string?",
                    "desc": "For a live kill or scare: an animation id for the killer, or the name of a one-shot on its [Locomotion]. Default none."
                },
                {
                    "name": "VictimAnimation",
                    "lua_type": "number?",
                    "desc": "Animation id for the victim in a live kill or scare. Default none."
                },
                {
                    "name": "Health",
                    "lua_type": "HealthProvider?",
                    "desc": "Where the victim's health lives, when not on the Humanoid."
                }
            ],
            "source": {
                "line": 30,
                "path": "lib/Combat/Attack.luau"
            }
        },
        {
            "name": "AttackStateOptions",
            "desc": "",
            "fields": [
                {
                    "name": "Damage",
                    "lua_type": "number",
                    "desc": ""
                },
                {
                    "name": "Cooldown",
                    "lua_type": "number",
                    "desc": "Seconds in the state after the blow."
                },
                {
                    "name": "TargetKey",
                    "lua_type": "string",
                    "desc": "The blackboard key holding the victim's root part."
                },
                {
                    "name": "Then",
                    "lua_type": "string",
                    "desc": "The state to enter when the cooldown ends (and any kill has finished)."
                },
                {
                    "name": "Kill",
                    "lua_type": "KillKind?",
                    "desc": "As [Attack.StrikeOptions]."
                },
                {
                    "name": "Animation",
                    "lua_type": "string?",
                    "desc": "As [Attack.StrikeOptions]."
                },
                {
                    "name": "KillerAnimation",
                    "lua_type": "number | string?",
                    "desc": "As [Attack.StrikeOptions]."
                },
                {
                    "name": "VictimAnimation",
                    "lua_type": "number?",
                    "desc": "As [Attack.StrikeOptions]."
                },
                {
                    "name": "Health",
                    "lua_type": "HealthProvider?",
                    "desc": "As [Attack.StrikeOptions]."
                }
            ],
            "source": {
                "line": 52,
                "path": "lib/Combat/Attack.luau"
            }
        }
    ],
    "name": "Attack",
    "desc": "Striking and the attack state. `Attack.State` returns a fresh [Types.State] to drop into a\nbrain; `Attack.Strike` is the blow on its own for a state of your own making.\n\n```lua\nAttack = VluxyAI.Combat.Attack.State({\n\tDamage = 34, Cooldown = 1.8, TargetKey = \"SeenTarget\", Then = \"Hunt\", Kill = \"Live\",\n}),\n```",
    "source": {
        "line": 80,
        "path": "lib/Combat/Attack.luau"
    }
}