StartAnim: Difference between revisions

From Wiki G1R-MP G1 Remake Multiplayer
Jump to navigation Jump to search
Automatyczna aktualizacja dokumentacji funkcji
 
Document synchronized player animations for update 0.1.2
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
<!-- This page is generated automatically from the function definition: startAnim. -->
= startAnim =
= startAnim =
Requests a named visual animation on a player's client.
<div style="background:#fff5f5; border:1px solid #d13b3b; border-left:5px solid #d13b3b; color:#111111; padding:0.85rem 1rem; margin:0.75rem 0 1rem;">
<div style="color:#111111; font-weight:bold; letter-spacing:0.04em;">IMPROVED FROM UPDATE 0.1.2</div>
<div style="color:#111111; margin-top:0.25rem;">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.</div>
</div>
 
Starts an allowlisted scripted visual animation for a connected player and synchronizes it with relevant clients.


== Syntax ==
== Syntax ==
Line 14: Line 18:
| <code>playerId</code> || <code>int</code> || yes || The connected player identifier.
| <code>playerId</code> || <code>int</code> || yes || The connected player identifier.
|-
|-
| <code>animation</code> || <code>string</code> || yes || A safe animation alias supported by the native runtime.
| <code>animation</code> || <code>string</code> || yes || A case-insensitive alias from the [[Player animation catalog]]. Raw Unreal asset paths are not accepted.
|-
|-
| <code>looped</code> || <code>bool</code> || no || Whether the requested visual should loop; defaults to false.
| <code>looped</code> || <code>bool</code> || 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 <code>hold</code>.
|-
|-
| <code>blendSeconds</code> || <code>number</code> || no || Blend duration from 0 to 2 seconds; defaults to 0.15.
| <code>blendSeconds</code> || <code>number</code> || 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 ==
Returns <code>true</code> when the validated runtime action is accepted and queued; otherwise returns <code>false</code>.
Returns <code>true</code> 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 <code>false</code> for an invalid player, alias, argument, or inactive player session.


== Examples ==
== Examples ==
Play a non-looping wave animation:
Hold the allowlisted prayer animation until it is stopped:
<syntaxhighlight lang="lua" line>
<syntaxhighlight lang="lua" line>
startAnim(playerId, "wave", false, 0.2)
if not startAnim(playerId, "pray", true, 0.2) then
    outputDebugString("Prayer animation request was rejected")
end
</syntaxhighlight>
</syntaxhighlight>


== Notes ==
== Notes ==
* Available only in server-side resource scripts.
* Available only in server-side resource scripts.
* Experimental: the transport contract is validated, but only native-supported animation aliases are safe. Arbitrary Unreal asset paths are not accepted.
* The 27 accepted aliases, their authored <code>once</code>/<code>hold</code> modes, and hold-loop start times are listed in the [[Player animation catalog]].
* Use <code>stopAnim</code> to cancel a looping scripted animation.
* The optional <code>looped</code> argument 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 <code>stopAnim</code> to 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.


[[Category:Lua Functions]]
[[Category:Server Functions]]
[[Category:Server Functions]]
[[Category:Animation Functions]]
[[Category:Animation Functions]]
[[Category:Experimental Lua API]]

Latest revision as of 16:21, 4 September 2026

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/hold modes, and hold-loop start times are listed in the Player animation catalog.
  • The optional looped argument 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 stopAnim to 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.