SetDoodadAnimation

Parameters
xreal

x-coordinate (world units) of the point.

yreal

y-coordinate (world units) of the point.

radiusreal

Maximum pick distance from the point.

doodadIDinteger

The type of the doodad that should be affected.

nearestOnlyboolean

If true, only the single doodad (of the given type) closest to the point will be affected, otherwise all in the vicinity (of the given type).

animNamestring

String identifier of the animation that should be played.

See SetUnitAnimation for the list of available tokens and the rules used to look up an whichAnimation. The behavior is similar, except this function supports a set of hardcoded magic strings (see notes below) instead of token combinations.

Also, substrings that are not recognized as tokens are ignored, rather than being replaced with "stand". Because of the internal match/mismatch logic, if the argument contains no valid tokens, the function may select an animation with an arbitrary name (also containing no recognized tokens) as the best match, even over animations that do have valid tokens.

For example, if the model has two animations named "Stand" (name contains one recognizable token, see list above) and "Something" (an arbitrary name that does not contain recognizable tokens), and you use "Something" as animName, the "Something" animation will be set. However, this does not mean the function can match arbitrary words, it’s just a side effect of matching algorithm.

animRandomboolean

If true, the animation to be played will be picked from an extended set including different variations of the animName, e.g., if animName is "walk", it can also be "walk defend".

comment

Makes doodads in the vicinity of a point play an animation.

note

Only doodads whose origin is within the radius distance of the point are considered.

note

There are the special values "hide" and "show" for animName, which will hide respectively show the doodad. When a doodad is hidden this way, its animation will pause at the current time frame. Re-showing the doodad resumes the animation.

note

The animName parameter also accepts "soundon" and "soundoff" to enable or disable the doodad’s sound, respectively, without affecting the animation. Using "soundon" after "soundoff" will restart the sound from the beginning.

note

If a target does not have an animation identified by animName (and it's not one of the special animation names either), it will play its first declared animation instead.

bug

If animName is null and there is at least one target, the game will crash.

note

If animRandom is true and the picked animation is looped, it will freshly re-pick from the set when an animation ends.

patch

1.00

Source
common.j (suggest an edit or discuss on Github)
return type
nothing
Source code
native SetDoodadAnimation       takes real x, real y, real radius, integer doodadID, boolean nearestOnly, string animName, boolean animRandom returns nothing