StartAnim
Jump to navigation
Jump to search
startAnim
IMPROVED FROM UPDATE 0.1.2
This function is available in earlier releases and has corrected or expanded behavior in G1R:MP 0.1.2 and later. The contract below describes the updated behavior.
Starts an allowlisted scripted visual animation for a connected player and synchronizes it with relevant clients.
Syntax
bool startAnim(int playerId, string animation [, bool looped = false, number blendSeconds = 0.15])
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
playerId |
int |
yes | The connected player identifier. |
animation |
string |
yes | A case-insensitive alias from the Player animation catalog. Raw Unreal asset paths are not accepted. |
looped |
bool |
no | Whether to hold and replay the animation from its catalog loop point. The compatible default remains false, even for aliases whose authored mode is hold.
|
blendSeconds |
number |
no | Requested owning-player native montage transition/stop duration from 0 to 2 seconds; defaults to 0.15. When this request replaces an existing scripted animation, it controls that outgoing montage and is then retained for a later stop of the new animation. |
Returns
Returns true when the server validates the request, records the authoritative animation state, and attempts reliable delivery. This is not a client playback or transport acknowledgement. Returns false for an invalid player, alias, argument, or inactive player session.
Examples
Hold the allowlisted prayer animation until it is stopped:
if not startAnim(playerId, "pray", true, 0.2) then
outputDebugString("Prayer animation request was rejected")
end
Notes
- Available only in server-side resource scripts.
- The 27 accepted aliases, their authored
once/holdmodes, and hold-loop start times are listed in the Player animation catalog. - The optional
loopedargument explicitly controls the request. Omitting it always requests a one-shot animation; the catalog mode is an authored recommendation, not an implicit override. - Starting another scripted animation replaces the player's current scripted animation. Normal replicated gameplay actions retain their own presentation rules.
- Use
stopAnimto end the tracked scripted animation. Clients use bounded loading and presentation retries for the newest accepted revision; a terminal miss is written to the animation diagnostic log instead of retrying forever. - The requested blend is applied to the owning player's exact native montage. Remote proxy handoff is immediate and does not guarantee an interpolated blend.