Page tree
Skip to end of metadata
Go to start of metadata


Introduced in

Version:3.7

Description

Description: Starts the playback of a UPRStartRecording for an AI unit.

The playback will start at the unit's current location and orientation. If the location and orientation of the recording should be used, then those values will have to be read via UPRGetMetaInfo, and applied beforehand.
Units performing a playback will go through the same animations as the original recording unit (even if they may not have the same weapons), and will clip through any obstacles that may be in the path.
If the recorded animation is not available for the type of playback unit selected (e.g. a path was recorded with an adult, but played back for a child, or recorded with a human, but played back as an animal), then the unit will stay in its current animation, and slide towards the next location.
The playback is stopped in the following situations:

  • The unit dies
  • Any body part is getAmputation. Injuries which did not cause an amputation (even if they would prevent the unit from canStand) are not simulated, and the playback will continue nevertheless.
  • The unit runs into an enemy (unless disabled via the 'endOnEnemy' playback option).

Once the playback has finished, the unit will resume its previous behavior (e.g. orient itself in the original direction, continue with its current waypoint or re-engage the enemy), and the event UPRPlaybackEnd will fire.

An ongoing playback can be stopped via UPRStopPlayback, or by starting a different playback.

Syntax

Syntax: unit UPRStartPlayback recording
Parameters:
  • unit: Unit - AI unit to replay recording.
  • recording: String - Path to recording. Can be either an absolute path, or a file name, in which case the command will first look in the mission folder, and then in %userprofile%\Documents\VBS3\RecordedPaths.
Return Value: Boolean - If true, the playback was started. If false, then either the recording or the unit didn't exist (or was dead or amputated), and playback wasn't started.

Alternative Syntax

Syntax:unit UPRStartPlayback [recording, snapToSurface, endOnEnemy, allowDamage]
Parameters:
  • unit: Unit - AI unit to replay recording.
  • recording: String - Path to recording. Can be either an absolute path or a file name, in which case the command will first look in the mission folder, and then in %userprofile%\Documents\VBS3\RecordedPaths.
  • snapToSurface: Boolean - If true, then the unit will use the nearest roadway beneath it, even if that roadway is lower than the vertical position originally recorded. If false, then the unit will move at the originally recorded elevations, even if there is no roadway underneath. (optional, default: true)
  • endOnEnemy: Boolean - If true, then playback will be aborted if an enemy is spotted. If false, then enemies are ignored. (optional, default: true)
  • allowDamage: Boolean - If true, then the unit can be killed or injured during playback. If false, then unit is invincible during playback. (optional, default: true)
Return Value:Boolean - If true, the playback was started. If false, then either the recording or the unit didn't exist (or was dead or amputated), and playback wasn't started.

Examples

Examples:
soldier1 UPRStartPlayback "rec1.upr"
_stat = soldier1 UPRStartPlayback "c:\bi\rec1.upr"
_stat = soldier1 UPRStartPlayback ["c:\bi\rec1.upr",true,false,false]

Additional Information

See also: UPRStopPlayback, UPRStartRecording, UPRPlaybackUnits, UPRPlaybackEnd
Multiplayer: 
Problems: 

Notes