BIS fnc unitPlaySimple: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Generated by BIS_fnc_exportFunctionsToWiki)
 
m (Text replacement - "(Optional, default {{hl|[]}})" to "(Optional, default <sqf inline>[]</sqf>)")
 
(49 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{RV|type=function


{{Function|= Comments
|game1= arma2oa
____________________________________________________________________________________________
|version1= 1.50


| arma2oa |= Game name
|game2= tkoh
|version2= 1.00


|1.00|= Game version
|game3= arma3
____________________________________________________________________________________________
|version3= 0.50


| <pre>
|gr1= Scenes
/*
File: fn_UnitPlaySimple.sqf


Description:
|descr= Plays back input movement data on input unit. Simplified.
Plays back input movement data on input unit. Simplified.


Parameters:
|s1= [unit, data, varDone, stateIngnore, debug, sleep, skipTime] spawn [[BIS_fnc_unitPlaySimple]]
Unit - Unit to play movement data on
Data - Movement data to use
OPT:[Object, Variable] - OPTIONAL: Variable to set on specified Object once playback has finished
OPT:IgnoreDisabled - OPTIONAL: Whether to ignore if the Unit is dead and/or cannot move
OPT:Debug - OPTIONAL: Whether to give debug information on played frames per second
OPT:Sleep - OPTIONAL: Time to Sleep between frames. This is if you want to be recording another unit
  and playing back movement data on another as well. Limit is 0-1 seconds.
OPT:SkipTime - OPTIONAL: Amount of time to skip at the start of playback. For example if you wish to
  play the data from halfway instead of the start.


Examples (used in a script):
|p1= unit: [[Object]] - unit to play movement data on
a) _capturedData = [[0,[8208.26,1953.13,296.04],67]];
[BIS_Vehicle, _capturedData, [BIS_Object, "DoneRecording"], true, false, 0.2, 5] spawn BIS_fnc_UnitPlay;
Which would play back the captured data in the _capturedData array (containing only one frame in this example)
onto a unit named BIS_Vehicle. Playback will play even if the unit is dead or disabled. Debug information would
not show and playing back would update once every 0.2 seconds. Once the playback finished, an object named
BIS_Object would have a variable called "DoneRecording" set to TRUE. Playback would skip the first 5 seconds
of data.
b) _capturedData = [[0,[8208.26,1953.13,296.04],67]];
[BIS_Vehicle, _capturedData, [], false, true] spawn BIS_fnc_UnitPlay;
Which would play back the captured data in the _capturedData array (containing only one frame in this example)
onto a unit named BIS_Vehicle. Playback will play only while the unit is alive and can move. Debug information
would show.
c) _capturedData = [[0,[8208.26,1953.13,296.04],67]];
[BIS_Vehicle, _capturedData] spawn BIS_fnc_UnitPlay;
Which would play back the captured data in the _capturedData array (containing only one frame in this example)
onto a unit named BIS_Vehicle.
Note that in a very large captured sequence, it is a better idea to preprocess the data prior to mission start, or
a short freeze would occur as it reads the data. For example using the following in the mission's init:
UnitData = compile preprocessFile "PlayBackUnit.sqf";


..And then later start the sequence like this:
|p2= data: [[Array]] - movement data to use
// Start the sequence
_result = [] call UnitData;
*/


</pre><small>''(Placeholder description extracted from the function header by [[BIS_fnc_exportFunctionsToWiki]])''</small> |= Description
|p3= varDone: [[Array]] - (Optional, default <sqf inline>[]</sqf>) variable to set on specified Object once playback has finished in format:
____________________________________________________________________________________________
* 0: [[Object]], [[Group]] or [[Namespace]] - target
* 1: [[String]] - variable name


| <!-- [] call [[BIS_fnc_UnitPlaySimple]]; --> |= Syntax
|p4= stateIgnore: [[Boolean]] - (Optional, default [[false]]) whether to ignore if the Unit is dead and/or cannot move


|p1= |= Parameter 1
|p5= debug: [[Boolean]] - (Optional, default [[false]] whether to give debug information on played frames per second


| |= Return value
|p6= sleep: [[Number]] - (Optional, default 0) time to sleep between frames. This is if you want to be recording another unit and playing back movement data on another as well. Limit is 0-1 seconds.
____________________________________________________________________________________________


|x1= <code></code> |=
|p7= skipTime: [[Number]] - (Optional, default 0) amount of time to skip at the start of playback. For example if you wish to play the data from halfway instead of the start.
____________________________________________________________________________________________


| |= See also
|r1= [[Script Handle]] - script handle


}}
|exec= spawn


<h3 style="display:none">Notes</h3>
|x1= <sqf>
<dl class="command_description">
private _capturedData = [[0, [8208.26, 1953.13, 296.04], 67]];
<!-- Note Section BEGIN -->
[BIS_Vehicle, _capturedData, [BIS_Object, "DoneRecording"], true, false, 0.2, 5] spawn BIS_fnc_unitPlaySimple;
</sqf>


<!-- Note Section END -->
|seealso= [[BIS_fnc_unitCaptureFiring]] [[BIS_fnc_unitCaptureSimple]] [[BIS_fnc_unitPlayFiring]] [[BIS_fnc_unitPlay]] [[BIS_fnc_unitCapture]]
</dl>
}}
 
<h3 style="display:none">Bottom Section</h3>
[[Category:Function Group: Scenes|{{uc:UnitPlaySimple}}]]
[[Category:Functions|{{uc:UnitPlaySimple}}]]
[[Category:{{Name|arma2oa}}: Functions|{{uc:UnitPlaySimple}}]]
[[Category:{{Name|tkoh}}: Functions|{{uc:UnitPlaySimple}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:UnitPlaySimple}}]]

Latest revision as of 18:09, 8 November 2023

Hover & click on the images for description

Description

Description:
Plays back input movement data on input unit. Simplified.
Execution:
spawn
Groups:
Scenes

Syntax

Syntax:
[unit, data, varDone, stateIngnore, debug, sleep, skipTime] spawn BIS_fnc_unitPlaySimple
Parameters:
unit: Object - unit to play movement data on
data: Array - movement data to use
varDone: Array - (Optional, default []) variable to set on specified Object once playback has finished in format:
stateIgnore: Boolean - (Optional, default false) whether to ignore if the Unit is dead and/or cannot move
debug: Boolean - (Optional, default false whether to give debug information on played frames per second
sleep: Number - (Optional, default 0) time to sleep between frames. This is if you want to be recording another unit and playing back movement data on another as well. Limit is 0-1 seconds.
skipTime: Number - (Optional, default 0) amount of time to skip at the start of playback. For example if you wish to play the data from halfway instead of the start.
Return Value:
Script Handle - script handle

Examples

Example 1:
private _capturedData = [[0, [8208.26, 1953.13, 296.04], 67]]; [BIS_Vehicle, _capturedData, [BIS_Object, "DoneRecording"], true, false, 0.2, 5] spawn BIS_fnc_unitPlaySimple;

Additional Information

See also:
BIS_fnc_unitCaptureFiring BIS_fnc_unitCaptureSimple BIS_fnc_unitPlayFiring BIS_fnc_unitPlay BIS_fnc_unitCapture

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