> For the complete documentation index, see [llms.txt](https://cjcrafter.gitbook.io/weaponmechanics/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cjcrafter.gitbook.io/weaponmechanics/trigger.md).

# Trigger

```yaml
  Trigger:
    Main_Hand: <TriggerType>
    Off_Hand: <TriggerType>
    Dual_Wield:
      Main_Hand: <TriggerType>
      Off_Hand: <TriggerType>
    Circumstance:
      Reloading: <DENY/REQUIRED>
      Zooming: <DENY/REQUIRED>
      Sneaking: <DENY/REQUIRED>
      Standing: <DENY/REQUIRED>
      Walking: <DENY/REQUIRED>
      Riding: <DENY/REQUIRED>
      Sprinting: <DENY/REQUIRED>
      Dual_Wielding: <DENY/REQUIRED>
      Swimming: <DENY/REQUIRED>
      In_Midair: <DENY/REQUIRED>
      Gliding: <DENY/REQUIRED>
      Ammo_Empty: <DENY/REQUIRED>
      Deny_Mechanics: <Mechanics>
```

For `TriggerType`, you have the following options:

* `start_sneak`
* `end_sneak`
* `double_sneak`
* `start_sprint`
* `end_sprint`
* `right_click`
* `left_click`
* `drop_item`
* `jump`
* `double_jump`
* `start_swim`
* `end_swim`
* `start_glide`
* `end_glide`
* `swap_hands`
* `start_walk`
* `end_walk`
* `start_in_midair`
* `end_in_midair`
* `start_stand`
* `end_stand`

#### Main\_Hand

The trigger used when the weapon is held in the main hand.

#### Off\_Hand

The trigger used when the weapon is held in the off hand.

#### Dual\_Wield

When dual-wielding weapons, you may want to change the trigger. For example, you may want to change the scoping trigger from `left_click` to `start_sneak`.

* `Main_Hand` -> Dual wielding trigger for main hand.
* `Off_Hand` -> Dual wielding trigger for off hand.

#### Circumstance

Allows you to deny or force certain actions for the trigger to work. For example, you can deny shooting while sprinting or scoping while dual-wielding.

For the following options, use:

1. `DENY` to prevent the trigger from working with this condition.
2. `REQUIRED` to force the entity to use this condition before the trigger works.
3. Delete the config line to allow the action.

* `Reloading` -> If the shooter is reloading the weapon.
* `Zooming` -> If the shooter is currently scoping.
* `Sneaking` -> If the shooter is holding shift.
* `Standing` -> If the shooter is not moving.
* `Walking` -> If the shooter is walking.
* `Riding` -> If the shooter is riding a mount.
* `Sprinting` -> If the shooter is sprinting.
* `Dual_Wielding` -> If the shooter is using 2 weapons.
* `Swimming` -> If the shooter is currently submerged underwater or sprint swimming.
* `In_Midair` -> If the shooter is not on the ground.
* `Gliding` -> If the shooter is gliding with an elytra.
* `Ammo_Empty` -> If the held weapons are empty

#### Deny\_Mechanics

The mechanics to play when the trigger is denied. Usually, this is a sound queue (like an angry villager) or an action bar alerting the user that they cannot perform that action. Use the [Mechanics](https://cjcrafter.gitbook.io/mechanics/) wiki.

* `@Source{}` -> The player who attempted to use the trigger
* `<deny_reason>` -> Which "action" caused the denial.
  * This will be 1 option from [#circumstance](#circumstance "mention"), but lowercase.
  * For example, `Dual_Wielding` -> `dual wielding`.

## Example

```yaml
  Scope:
    Trigger:
      Main_Hand: "LEFT_CLICK"
      Off_Hand: "LEFT_CLICK"
      Circumstance:
        Dual_Wielding: "DENY"
        Deny_Mechanics:
          - "ActionBar{message=<red><i>You cannot scope while <deny_reason>!}"
```

This example is taken from the `50_GS`, and will let players scope with the pistol by punching. If they are holding 2 weapons, players will not be able to scope.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://cjcrafter.gitbook.io/weaponmechanics/trigger.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
