BIS fnc ambientAnim: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
m (Some wiki formatting)
 
(83 intermediate revisions by 9 users not shown)
Line 1: Line 1:
{{RV|type=function


{{Function|= Comments
|game1= arma3
____________________________________________________________________________________________
|version1= 1.00


| arma3 |= Game name
|gr1= Ambient


|1.00|= Game version
|descr= Play set of ambient animations on given unit. If the unit should react to combat, use [[BIS_fnc_ambientAnimCombat]] instead.
____________________________________________________________________________________________
{{Feature|informative|Animations can be cancelled using <sqf inline>_unit call BIS_fnc_ambientAnim__terminate</sqf>.}}


| <pre>/*
|s1= [unit, animationSet, equipmentLevel, snapTo, interpolate, attachToLogic] call [[BIS_fnc_ambientAnim]]


Description:
|p1= unit: [[Object]] - unit that will play the animations
Play set of ambient animations on given unit.


Remarks:
|p2= animationSet: [[String]] - the animation set to play. Possible values:
* Can handle several different anims and auto-switching between them.
{{{!}}
* Detects nearby units with the same animation set and tries to select different animations.
{{!}}+ style="caption-side: bottom" {{!}} ''some values are missing due to duplicate results, e.g "STAND" does the same as "STAND1"''
* A game logic is created on units position and animated unit is then attached to it, to prevent possible problems, like player pushing units around.
{{!}}- style="vertical-align: top"
* The unit can be snapped to a set snappoint to prevent game from repositioning the unit.
{{!}}
* The snappoint is automatically detected, snap distance is 2 meters (in top-down view, ignoring vertical info).
* STAND1
* To position unit vertically, move its snappoint up/down.
* STAND2
* A snappoint is a (cyan colored) helper "Sign_Pointer_Cyan_F".
* STAND_U1
* This is extremely handy if the unit needs to be placed near object(s) - like on chair near a table.
* STAND_U2
* STAND_U3
* WATCH
* WATCH2
* GUARD
* LISTEN_BRIEFING
* LEAN_ON_TABLE
* LEAN
{{!}}
* SIT_AT_TABLE
* SIT1
* SIT
* SIT3
* SIT_U1
* SIT_U2
* SIT_U3
* SIT_HIGH1
* SIT_HIGH
* SIT_LOW
* SIT_LOW_U
* SIT_SAD1
* SIT_SAD2
{{!}}
* KNEEL
* REPAIR_VEH_PRONE
* REPAIR_VEH_KNEEL
* REPAIR_VEH_STAND
* PRONE_INJURED_U1
* PRONE_INJURED_U2
* PRONE_INJURED
* KNEEL_TREAT
* KNEEL_TREAT2
* BRIEFING
* BRIEFING_POINT_LEFT
* BRIEFING_POINT_RIGHT
* BRIEFING_POINT_TABLE
{{!}}}


Parameter(s):
|p3= equipmentLevel: [[String]] - the equipment level of the unit. Possible values:
0: OBJECT - unit the anim & gear changes are going to be applied to
* NONE
1: STRING - animation set id, describing what the unit's action looks like.
* LIGHT
  > "STAND" - standing still, slightly turning to the sides, with rifle weapon
* MEDIUM
  > "STAND_IA" - standing still, slightly turning to the sides, with rifle weapon
* FULL
  > "STAND_U1-3" - standing still, slightly turning to the sides, no weapon
* ASIS
  > "WATCH1-2" - standing and turning around, with rifle weapon
* RANDOM
  > "GUARD" - standing still, like on guard with hands behing the body
  > "LISTEN_BRIEFING"  - standing still, hands behind back, recieving briefing / commands, no rifle.
  > "LEAN_ON_TABLE" - standing while leaning on the table
  > "LEAN" - standing while leaning (on wall)
  > "BRIEFING" - standing, playing ambient briefing loop with occasional random moves
  > "BRIEFING_POINT_LEFT" - contains 1 extra pointing animation, pointing left & high
  > "BRIEFING_POINT_RIGHT" - contains 1 extra pointing animation, pointing right & high
  > "BRIEFING_POINT_TABLE" - contains 1 extra pointing animation, pointing front & low, like at table
  > "SIT1-3" - sitting on chair or bench, with rifle weapon
  > "SIT_U1-3" - sitting on chair or bench, without weapon
  > "SIT_AT_TABLE" - sitting @ table, hands on table
  > "SIT_HIGH1-2" - sitting on taller objects like a table or wall, legs not touching the ground. Needs a rifle!
  > "SIT_LOW" - sitting on the ground, with weapon.
  > "SIT_LOW_U" - sitting on the ground, without weapon.
  > "SIT_SAD1-2" - sitting on a chair, looking very sad.
  > "KNEEL" - kneeling, with weapon.
  > "PRONE_INJURED_U1-2" - laying wounded, back on the ground, wothout weapon
  > "PRONE_INJURED" - laying wounded & still, back on the ground, with or without weapon
  > "KNEEL_TREAT" - kneeling while treating the wounded
  > "REPAIR_VEH_PRONE" - repairing vehicle while laying on the ground (under the vehicle)
  > "REPAIR_VEH_KNEEL" - repairing vehicle while kneeling (like changing a wheel)
  > "REPAIR_VEH_STAND" - repairing/cleaning a vehicle while standing


2: STRING - equipment level id, describing how heavily is the unit equipped.
|p4= snapTo: [[Object]] - (Optional, default [[objNull]]) the object where the unit will be snapped to
  > "NONE"  - no goggles, headgear, vest, weapon
  > "LIGHT"  - no goggles, headgear, vest
  > "MEDIUM" - no goggles, headgear
  > "FULL"  - no goggles
  > "ASIS"  - no touches to the gear
  > "RANDOM" (default) - gear is randomized according to the animation set


3: OBJECT - object unit to snap to; function won't try to search for the closest snappoint and will use this snappoint instead
|p5= interpolate: [[Boolean]] - (Optional, default [[false]]) should try to interpolate into the ambient animation. Works only for some default stances
4: BOOL - function will try to interpolate into the ambient animation, if the interpolateTo link exists
- it is not officialy supported, so it's disabled by default
- works only for transitions from (some) default A3 stances to sets "STAND", "SIT_LOW" and "KNEEL"


Returns:
|p6= attachToLogic: [[Boolean]] - (Optional, default [[true]]) [[true]] to [[attachTo|attach]] the unit to the created logic object, forcing it in one position
-


Example:
|r1= [[Nothing]]
[this,"SIT_HIGH2"] call BIS_fnc_ambientAnim;
*/


//surpress the debuglog output
|x1= <sqf>[player, "STAND1", "ASIS"] call BIS_fnc_ambientAnim;</sqf>
</pre><small>''(Placeholder description extracted from the function header by [[BIS_fnc_exportFunctionsToWiki]])''</small> |= Description
____________________________________________________________________________________________


| <!-- [] call [[BIS_fnc_ambientAnim]]; --> |= Syntax
|x2= <sqf>
 
// will search for a chair within 2 meters around the unit and will place the unit on it
|p1= |= Parameter 1
[_unit, "SIT", "NONE"] call BIS_fnc_ambientAnim;
 
</sqf>
| |= Return value
____________________________________________________________________________________________
 
|x1= <code></code> |=
____________________________________________________________________________________________
 
| |= See also


|seealso= [[BIS_fnc_ambientAnimCombat]] [[BIS_fnc_ambientAnimGetParams]]
}}
}}


<h3 style="display:none">Notes</h3>
{{Note
<dl class="command_description">
|user= PierreMGI
<!-- Note Section BEGIN -->
|timestamp= 20160219042400
<dd class="notedate">Posted on February 19, 2016 - 04:24
|text= In 3den editor, place a blufor unit (B_soldier_A_F) near a camping chair (land_campingChair_V2_F).<br>
<dt class="note">'''[[User:Pierre MGI|Pierre MGI]]'''
<dd class="note">In 3den editor, place a blufor unit (B_soldier_A_F) near a camping chair (land_campingChair_V2_F).<br>
In init field of the unit:<br>
In init field of the unit:<br>
<code>[this,"SIT2"] call BIS_fnc_ambientAnim; 0 = this spawn {waitUntil {behaviour _this == "combat"};<br>
<sqf>
_this call BIS_fnc_ambientAnim__terminate;}</code><br>
[this, "SIT2"] call BIS_fnc_ambientAnim;
0 = this spawn {
waitUntil { behaviour _this == "combat"};
_this call BIS_fnc_ambientAnim__terminate;
};
</sqf>
When this unit is aware of a threat, he will quit the "ambient animation" and will able to return fire.<br>
When this unit is aware of a threat, he will quit the "ambient animation" and will able to return fire.<br>
Note: [[BIS_fnc_ambientAnimCombat]] doesn't need this script but the list of animations is limited.
}}


<!-- Note Section END -->
{{Note
</dl>
|user= PierreMGI
|timestamp= 20160808013700
|text= To make this command working in MP (hosted server tested)
<sqf>
[this, "SIT2"] call BIS_fnc_ambientAnim; // wrong! the first JIP will throw the unit to position [0,0,0]
if (isServer) then { [this, "SIT2"] call BIS_fnc_ambientAnim; }; // wrong! only player located on server will see the animation
if (local this) then { [this, "SIT2"] call BIS_fnc_ambientAnim; }; // OK, best way
if (isServer) then { [this, "SIT2"] remoteExecCall ["BIS_fnc_ambientAnim"]; }; // OK
</sqf>
}}


<h3 style="display:none">Bottom Section</h3>
{{Note
[[Category:Function Group: Ambient|{{uc:ambientAnim}}]]
|user= Icaruk
[[Category:Functions|{{uc:ambientAnim}}]]
|timestamp= 20160811163300
[[Category:{{Name|arma3}}: Functions|{{uc:ambientAnim}}]]
|text= Be careful using this function multiple times on MP, it creates a Logic using [[createUnit]] (which is global).<br>
If you use it on 20 units, 20 additional logics will be created.
}}

Latest revision as of 13:38, 27 July 2022

Hover & click on the images for description

Description

Description:
Play set of ambient animations on given unit. If the unit should react to combat, use BIS_fnc_ambientAnimCombat instead.
Animations can be cancelled using _unit call BIS_fnc_ambientAnim__terminate.
Execution:
call
Groups:
Ambient

Syntax

Syntax:
[unit, animationSet, equipmentLevel, snapTo, interpolate, attachToLogic] call BIS_fnc_ambientAnim
Parameters:
unit: Object - unit that will play the animations
animationSet: String - the animation set to play. Possible values:
some values are missing due to duplicate results, e.g "STAND" does the same as "STAND1"
  • STAND1
  • STAND2
  • STAND_U1
  • STAND_U2
  • STAND_U3
  • WATCH
  • WATCH2
  • GUARD
  • LISTEN_BRIEFING
  • LEAN_ON_TABLE
  • LEAN
  • SIT_AT_TABLE
  • SIT1
  • SIT
  • SIT3
  • SIT_U1
  • SIT_U2
  • SIT_U3
  • SIT_HIGH1
  • SIT_HIGH
  • SIT_LOW
  • SIT_LOW_U
  • SIT_SAD1
  • SIT_SAD2
  • KNEEL
  • REPAIR_VEH_PRONE
  • REPAIR_VEH_KNEEL
  • REPAIR_VEH_STAND
  • PRONE_INJURED_U1
  • PRONE_INJURED_U2
  • PRONE_INJURED
  • KNEEL_TREAT
  • KNEEL_TREAT2
  • BRIEFING
  • BRIEFING_POINT_LEFT
  • BRIEFING_POINT_RIGHT
  • BRIEFING_POINT_TABLE
equipmentLevel: String - the equipment level of the unit. Possible values:
  • NONE
  • LIGHT
  • MEDIUM
  • FULL
  • ASIS
  • RANDOM
snapTo: Object - (Optional, default objNull) the object where the unit will be snapped to
interpolate: Boolean - (Optional, default false) should try to interpolate into the ambient animation. Works only for some default stances
attachToLogic: Boolean - (Optional, default true) true to attach the unit to the created logic object, forcing it in one position
Return Value:
Nothing

Examples

Example 1:
[player, "STAND1", "ASIS"] call BIS_fnc_ambientAnim;
Example 2:
// will search for a chair within 2 meters around the unit and will place the unit on it [_unit, "SIT", "NONE"] call BIS_fnc_ambientAnim;

Additional Information

See also:
BIS_fnc_ambientAnimCombat BIS_fnc_ambientAnimGetParams

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
PierreMGI - c
Posted on Feb 19, 2016 - 04:24 (UTC)
In 3den editor, place a blufor unit (B_soldier_A_F) near a camping chair (land_campingChair_V2_F).
In init field of the unit:
[this, "SIT2"] call BIS_fnc_ambientAnim; 0 = this spawn { waitUntil { behaviour _this == "combat"}; _this call BIS_fnc_ambientAnim__terminate; };
When this unit is aware of a threat, he will quit the "ambient animation" and will able to return fire.
Note: BIS_fnc_ambientAnimCombat doesn't need this script but the list of animations is limited.
PierreMGI - c
Posted on Aug 08, 2016 - 01:37 (UTC)
To make this command working in MP (hosted server tested)
[this, "SIT2"] call BIS_fnc_ambientAnim; // wrong! the first JIP will throw the unit to position [0,0,0] if (isServer) then { [this, "SIT2"] call BIS_fnc_ambientAnim; }; // wrong! only player located on server will see the animation if (local this) then { [this, "SIT2"] call BIS_fnc_ambientAnim; }; // OK, best way if (isServer) then { [this, "SIT2"] remoteExecCall ["BIS_fnc_ambientAnim"]; }; // OK
Icaruk - c
Posted on Aug 11, 2016 - 16:33 (UTC)
Be careful using this function multiple times on MP, it creates a Logic using createUnit (which is global).
If you use it on 20 units, 20 additional logics will be created.