Jump to content
Sign in to follow this  
HKFlash

Improving BIS_fnc_ambientAnim

Recommended Posts

Hello,

I'd like to discuss the ambientAnim function created by BIS for A3. The following is how it operates:

/*
Author: Jiri Wainar

Description:
Play set of ambient animations on given unit.

Remarks:
* Can handle several different anims and auto-switching between them.
* Detects nearby units with the same animation set and tries to select different animations.
* 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.
* 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).
	* To position unit vertically, move its snappoint up/down.
	* A snappoint is a (cyan colored) helper "Sign_Pointer_Cyan_F".
	* This is extremely handy if the unit needs to be placed near object(s) - like on chair near a table.

Parameter(s):
0: OBJECT - unit the anim & gear changes are going to be applied to
1: STRING - animation set id, describing what the unit's action looks like.
   > "STAND"		- standing still, slightly turning to the sides, with rifle weapon
   > "STAND_IA"		- standing still, slightly turning to the sides, with rifle weapon
   > "STAND_U1-3"	- standing still, slightly turning to the sides, no weapon
   > "WATCH1-2"		- standing and turning around, with rifle weapon
   > "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.
   > "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
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:
-

Example:
[this,"SIT_HIGH2"] call BIS_fnc_ambientAnim;

As you can see the function already relieves the user of alot of workload for making an animation loop. Unfortunately this function lacks versatility, since it is only useful if you want a character to keep playing the same animation forever (unless killed of course).

Also, I'm aware of the existence of the BIS_fnc_ambientAnimCombat, which is a great function that actually allows the character to be freed, however I don't believe having two different functions is the right way to go. This one is also direct for a very specific situation which is a combat environment and lacks animation sets.

I propose the following:

A 5th parameter for BIS_fnc_ambientAnim which would be designed to terminate it, basically a condition. BIS_fnc_ambientAnimCombat, already contains such parameter:

3: CODE or STRING (optional, default {false}) - condition that if true frees the unit from the animation loop

Why not add this as a 5th parameter for BIS_fnc_ambientAnim? Would make the function much more versatile than it currently is.

Regards,

Share this post


Link to post
Share on other sites

If you're going to have a condition for the anim to break, then it would be useful to have another parameter that runs some code when it breaks.

So if for example you have parameter 5 as:

behaviour _unit == "COMBAT";

Then parameter 6 would be:

[_unit] call myTag_reactOnEnemyContact;

Share this post


Link to post
Share on other sites

Would certainly add even more versatility to the function. I support your idea.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×