# JUTPSActions Lib Scripting Reference

## JUTPSAction

This class keeps references for easy alteration during actions, it itself doesn't have functions/methods to use, it just keeps this references.

| Properties   | Description             |
| ------------ | ----------------------- |
| TPSCharacter | JU Character Controller |
| anim         | Animator Controller     |
| rb           | Rigidbody               |
| coll         | Collider                |
| cam          | Camera                  |

## JUTPSAnimatedAction

See below for virtual methods you can override

| Virtual Methods          | Description                                                                                       |
| ------------------------ | ------------------------------------------------------------------------------------------------- |
| void ActionCondition()   | called every frame, override this to check conditions                                             |
| void OnActionStarted()   | override this to call some code once the action starts                                            |
| void OnActionIsPlaying() | override this to call some code while action is playing                                           |
| void OnActionEnded()     | override this to call some code once the action ends                                              |
| void OnNoAction()        | override this to call some code while action state is none                                        |
| void Update()            | Unity's update method, override if you want to use it, but keep the `base.Update();` line of code |

See below the functions that a class that inherits the JUTPSAnimatedAction class can call:

<table><thead><tr><th width="373">Virtual Methods</th><th>Description</th></tr></thead><tbody><tr><td>PlayAnimation(<mark style="color:blue;">string</mark> AnimationStateName, <mark style="color:blue;">int</mark> LayerID, <mark style="color:blue;">float</mark> normalizedTime)</td><td>Play an animation in a layer and specific time</td></tr><tr><td>SwitchAnimationLayer(<mark style="color:green;">ActionPart</mark> BodyPartLayer)</td><td>Switch target body part</td></tr><tr><td>GetCurrentAnimationLayer()</td><td>Get index of layer of the target body part </td></tr><tr><td>DisableCharacterMovement(<mark style="color:blue;">float</mark> duration = 0)</td><td>Disable character movement for a limited time</td></tr><tr><td>SetCurrentItemIndexToLastUsedItem()</td><td>Save the current item Switch ID</td></tr><tr><td>DisableItemOnHand()</td><td>Unequip item</td></tr><tr><td>EnableLastUsedItem()</td><td>Equip item with the saved item switch ID</td></tr></tbody></table>


---

# Agent Instructions: 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:

```
GET https://julhiecio.gitbook.io/ju-tps-documentation/game-development/how-to-use-actions-skill-and-animation-events/jutpsactions-lib-scripting-reference.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
