BIS fnc target: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(Fix arguments,)
m (Some wiki formatting)
 
(20 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{wip}}
{{RV|type=function
{{Function|Comments=


|game1= arma3
|game1= arma3
|version1= 1.00
|version1= 1.00


|descr= [[File:A3 BIS fnc target.jpg|300px|thumb|right|Target Board display]]
|gr1= Interaction
Handles the shooting targets in the Bootcamp DLC, statistics, animation, etc. (targets such as <tt>TargetBootcampHuman_f</tt>)


|descr= [[File:A3 BIS_fnc_target.jpg|300px|thumb|right|Target Board display]]
Handles the shooting targets in the Bootcamp DLC, statistics, animation, etc. (targets such as {{hl|TargetBootcampHuman_f}})


|s1= [action, parameters] call [[BIS_fnc_target]] |SYNTAX=
{{{!}} class="wikitable mw-collapsible mw-collapsed" style="min-width: 50em"
 
{{!}}+ Action/Parameter Table
|p1= action: [[String]] - one of:
! Action ([[String]])
<div style="columns: 3">
! Parameters ([[Array]]) arguments
* initialize
{{!}}-
* terminate (does nothing(?))
{{!}} '''initialize'''<br>Initializes the target and sets it to the "up" position
* animate
{{!}}
* getAnimationPhase
* target: [[Object]] - Target object of type "TargetBootcamp_base_F"
* getAnimationPhaseString
* getAnimatedSelection
* hit
* hitPart
* getShooterDataIndex
* getShooterData
* setShooterData
* getShotsData
* getShotsDataFromTargets
* getShotsDataWithFilter
* setShotsData
* getShootersData
* setShootersData
* resetShootersData (clears all data on object)
* getShooterTemplate
* getShotTemplate
* getShooterByUid
* uiOpen
* uiOnLoad (internal)
* uiFillTable (internal)
* uiFillTableRow (internal)
</div>


|p2= parameters: [[Array]] - array of data, depending on ''action'':<br>
{{!}}-
'''initialize''' - Initializes the target and sets it to the "up" position
{{!}} '''terminate'''<br>Doesn't do anything {{!}}{{!}} {{n/a}}
* target: [[Object]] - Target object of type "TargetBootcamp_base_F"


'''terminate''' - Doesn't do anything
{{!}}-
'''animate''' - Animate the object to the given position ("up" or "down")
{{!}} '''animate'''<br>Animate the object to the given position ("up" or "down")
{{!}}
* target: [[Object]] - Target object of type "TargetBootcamp_base_F"
* target: [[Object]] - Target object of type "TargetBootcamp_base_F"
* position: [[String]] - "up" or "down" (default)
* position: [[String]] - "up" or "down" (default)


'''getAnimationPhase''' - Returns (Integer) 0 (up) or 1 (down) depending on current state
{{!}}-
{{!}} '''getAnimationPhase'''<br><br>'''Return Value:''' [[Number]] - 0 (up) or 1 (down) depending on current state
{{!}}
* target: [[Object]] - Target object of type "TargetBootcamp_base_F"
* target: [[Object]] - Target object of type "TargetBootcamp_base_F"


'''getAnimationPhaseString''' - Returns (String)"up" or "down" depending on current state
{{!}}-
{{!}} '''getAnimationPhaseString'''<br><br>'''Return Value:''' [[String]] - "up" or "down" depending on current state
{{!}}
* target: [[Object]] - Target object of type "TargetBootcamp_base_F"
* target: [[Object]] - Target object of type "TargetBootcamp_base_F"


'''getAnimatedSelection''' - Returns (String) the name of the "animatedSelection" from object config
{{!}}-
{{!}}'''getAnimatedSelection'''<br><br>'''Return Value:''' [[String]] - the name of the "animatedSelection" from object config
{{!}}
* target: [[Object]] - Target object of type "TargetBootcamp_base_F"
* target: [[Object]] - Target object of type "TargetBootcamp_base_F"


'''hit''' - Handles the hit event to animate the target down and up again
{{!}}-
{{!}} '''hit'''<br>Handles the hit event to animate the target down and up again
{{!}}
* target: [[Object]] - Target object of type "TargetBootcamp_base_F"
* target: [[Object]] - Target object of type "TargetBootcamp_base_F"
* unit: [[Object]] - Unit which shot the target
* unit: [[Object]] - Unit which shot the target
* damage: [[Number]] - Amount of damage done to the target
* damage: [[Number]] - Amount of damage done to the target


'''hitPart''' - Handles the hit event and stores the data
{{!}}-
{{!}} '''hitPart'''<br>Handles the hit event and stores the data
{{!}}
* partsList: [[Array]] - Contains list of all parts which got hit (see [[Arma 3: Event Handlers#HitPart|HitPart EH]] format) to format [target, shooter]:
* partsList: [[Array]] - Contains list of all parts which got hit (see [[Arma 3: Event Handlers#HitPart|HitPart EH]] format) to format [target, shooter]:
** target: [[Object]] - Target object of type 'TargetBootcamp_base_F'
** target: [[Object]] - Target object of type 'TargetBootcamp_base_F'
** shooter: [[Object]] - Unit which shot the target
** shooter: [[Object]] - Unit which shot the target


'''getShooterDataIndex''' - Get (Integer) index from Shooter Data for specific unit
{{!}}-
{{!}} '''getShooterDataIndex'''<br><br>'''Return Value:''' [[Number]] - index from Shooter Data for specific unit
{{!}}
* target: [[Object]] - Target object of type "TargetBootcamp_base_F"
* target: [[Object]] - Target object of type "TargetBootcamp_base_F"
* uid: [[String]] - Player UID of unit who shot the target
* uid: [[String]] - Player UID of unit who shot the target


'''getShooterData''' - Get (Array) all data from Shooter Data for specific unit
{{!}}-
{{!}} '''getShooterData'''<br><br>'''Return Value:''' [[Array]] - all data from Shooter Data for specific unit<br>
Format: {{hl|<nowiki>[["uid", ""], ["name", ""], ["shots", [[["time", 0], ["distance", 0], ["weapon", ""], ["direct", 0]]]]]</nowiki>}}
{{!}}
* target: [[Object]] - Target object of type "TargetBootcamp_base_F"
* target: [[Object]] - Target object of type "TargetBootcamp_base_F"
* uid: [[String]] - Player UID of unit who shot the target
* uid: [[String]] - Player UID of unit who shot the target


'''setShooterData''' - Set Shooter Data for specific unit
{{!}}-
{{!}} '''setShooterData'''<br>Set Shooter Data for specific unit
{{!}}
* target: [[Object]] - Target object of type "TargetBootcamp_base_F"
* target: [[Object]] - Target object of type "TargetBootcamp_base_F"
* uid: [[String]] - Player UID of unit who shot the target
* uid: [[String]] - Player UID of unit who shot the target
* data: [[Array]] - Shooter Data
* data: [[Array]] - Shooter Data


'''getShotsData''' - Return (Array) Shots Data for specific unit
{{!}}-
{{!}} '''getShotsData'''<br><br>'''Return Value:''' [[Array]] - Shots Data for specific unit
{{!}}
* target: [[Object]] - Target object of type "TargetBootcamp_base_F"
* target: [[Object]] - Target object of type "TargetBootcamp_base_F"
* uid: [[String]] - Player UID of unit who shot the target
* uid: [[String]] - Player UID of unit who shot the target


'''getShotsDataFromTargets''' - Return (Integer) total amount of shots hit
{{!}}-
{{!}} '''getShotsDataFromTargets'''<br><br>'''Return Value:''' [[Number]] - total amount of shots hit
{{!}}
* targets: [[Array]] of [[Object]] - List of target objects of type "TargetBootcamp_base_F"
* targets: [[Array]] of [[Object]] - List of target objects of type "TargetBootcamp_base_F"
* uid: [[String]] - Player UID of unit who shot the target
* uid: [[String]] - Player UID of unit who shot the target


'''getShotsDataWithFilter''' - Return (Array) Shot Data after custom filter
{{!}}-
{{!}} '''getShotsDataWithFilter'''<br><br>'''Return Value:''' [[Array]] - Shot Data after custom filter
{{!}}
* target: [[Object]] - Target object of type "TargetBootcamp_base_F"
* target: [[Object]] - Target object of type "TargetBootcamp_base_F"
* uid: [[String]] - Player UID of unit who shot the target
* uid: [[String]] - Player UID of unit who shot the target
Line 96: Line 96:
* code: [[Code]] - Custom code to validate the shot. _this is the value of filtered data
* code: [[Code]] - Custom code to validate the shot. _this is the value of filtered data


'''setShotsData''' - Set Shots Data for specific unit
{{!}}-
{{!}} '''setShotsData'''<br>Set Shots Data for specific unit
{{!}}
* target: [[Object]] - Target object of type "TargetBootcamp_base_F"
* target: [[Object]] - Target object of type "TargetBootcamp_base_F"
* uid: [[String]] - Player UID of unit who shot the target
* uid: [[String]] - Player UID of unit who shot the target
* data: [[Array]] - Shots Data
* data: [[Array]] - Shots Data


'''getShootersData''' - Return (Array) full Shooters Data
{{!}}-
{{!}} '''getShootersData'''<br><br>'''Return Value:''' [[Array]] - full Shooters Data
{{!}}
* target: [[Object]] - Target object of type "TargetBootcamp_base_F"
* target: [[Object]] - Target object of type "TargetBootcamp_base_F"


'''setShootersData''' - Set full Shooters Data
{{!}}-
{{!}} '''setShootersData'''<br>Set full Shooters Data
{{!}}
* target: [[Object]] - Target object of type "TargetBootcamp_base_F"
* target: [[Object]] - Target object of type "TargetBootcamp_base_F"
* data: [[Array]] - Shooter Data
* data: [[Array]] - Shooter Data


'''resetShootersData''' - Remove all data from Shooters Data array
{{!}}-
{{!}} '''resetShootersData'''<br>Remove all data from Shooters Data array
{{!}}
* target: [[Object]] - Target object of type "TargetBootcamp_base_F"
* target: [[Object]] - Target object of type "TargetBootcamp_base_F"


'''getShooterTemplate''' - Return (Array) template for Shooter Data
{{!}}-
{{!}} '''getShooterTemplate'''<br><br>'''Return Value:''' [[Array]] - template for Shooter Data
{{!}}
* target: [[Object]] - Target object of type "TargetBootcamp_base_F"
* target: [[Object]] - Target object of type "TargetBootcamp_base_F"
* uid: [[String]] - Player UID of unit who shot the target
* uid: [[String]] - Player UID of unit who shot the target


'''getShotTemplate''' - Return (Array) template for Shot Data (see [[Arma 3: Event Handlers#HitPart|HitPart EH]] format)
{{!}}-
{{!}} '''getShotTemplate'''<br><br>'''Return Value:''' [[Array]] - template for Shot Data (see [[Arma 3: Event Handlers#HitPart|HitPart EH]] format)
{{!}}
* target: [[Object]] - Target object of type "TargetBootcamp_base_F"
* target: [[Object]] - Target object of type "TargetBootcamp_base_F"
* shooter: [[Object]] - Unit who shot the target
* shooter: [[Object]] - Unit who shot the target
Line 128: Line 140:
* isDirect: [[Boolean]] - [[true]] if object was directly hit, [[false]] if it was hit by indirect/splash damage.
* isDirect: [[Boolean]] - [[true]] if object was directly hit, [[false]] if it was hit by indirect/splash damage.


'''getShooterByUid''' - Return (Object) unit
{{!}}-
{{!}} '''getShooterByUid'''<br><br>'''Return Value:''' [[Object]] - corresponding shooter unit
{{!}}
* uid: [[String]] - Player UID of unit who shot the target
* uid: [[String]] - Player UID of unit who shot the target


'''uiOpen''' - Opens the Target Board display
{{!}}-
{{!}} '''uiOpen'''<br>Opens the Target Board display
{{!}}
* target: [[Object]] - Target object of type "TargetBootcamp_base_F"
* target: [[Object]] - Target object of type "TargetBootcamp_base_F"


'''uiOpenToAll''' - Opens the Target Board display for all connected players
{{!}}-
{{!}} '''uiOpenToAll'''<br>Opens the Target Board display for all connected players
{{!}}
* target: [[Object]] - Target object of type "TargetBootcamp_base_F"
* target: [[Object]] - Target object of type "TargetBootcamp_base_F"


'''uiOnLoad''' - Triggered when display is opened (internal)
{{!}}-
{{!}} '''uiOnLoad'''<br>Triggered when display is opened (internal)
{{!}}
* display: [[Display]]
* display: [[Display]]


'''uiFillTable''' - Triggered when display is opened, fills UI with Shooters Data (internal)
{{!}}-
{{!}} '''uiFillTable'''<br>Triggered when display is opened, fills UI with Shooters Data (internal)
{{!}}
* target: [[Object]] - Target object of type "TargetBootcamp_base_F"
* target: [[Object]] - Target object of type "TargetBootcamp_base_F"
* control: [[Control]] - "_listBox"
* control: [[Control]] - "_listBox"


'''uiFillTableRow''' - Triggered when display is opened, fills UI with Shooter Data (internal)
{{!}}-
{{!}} '''uiFillTableRow'''<br>Triggered when display is opened, fills UI with Shooter Data (internal)
{{!}}
* target: [[Object]] - Target object of type "TargetBootcamp_base_F"
* target: [[Object]] - Target object of type "TargetBootcamp_base_F"
* control: [[Control]] - "_listBox"
* control: [[Control]] - "_listBox"
* data: [[Array]] - Shooter Data
* data: [[Array]] - Shooter Data
{{!}}}


|s1= [action, parameters] call [[BIS_fnc_target]]


|x1= <code>{{cc|open the Score Board through addAction}}
|p1= action: [[String]]
["uiOpen", [myTarget]] [[call]] [[BIS_fnc_target]];</code>


|x2= <code>{{cc|open the Score Board for all players in MP}}
|p2= parameters: [[Array]]
["uiOpenToAll", [myTarget]] [[call]] [[BIS_fnc_target]];</code>


|x3= <code>{{cc|clear all data from Score Board}}
|r1= See [[#Description|above table]]
["resetShootersData", [myTarget]] [[call]] [[BIS_fnc_target]];</code>


|seealso= [[doTarget]]
|x1= <sqf>
}}
// open the Score Board
["uiOpen", [myTarget]] call BIS_fnc_target;
</sqf>


<h3 style="display:none">Notes</h3>
|x2= <sqf>
<dl class="command_description">
// open the Score Board for all players in MP
<!-- Note Section BEGIN -->
["uiOpenToAll", [myTarget]] call BIS_fnc_target;
</sqf>


<!-- Note Section END -->
|x3= <sqf>
</dl>
// clear all data from Score Board
["resetShootersData", [myTarget]] call BIS_fnc_target;
</sqf>


<h3 style="display:none">Bottom Section</h3>
|seealso= [[doTarget]]
[[Category:Functions|{{uc:target}}]]
}}
[[Category:{{Name|arma3}}: Functions|{{uc:target}}]]

Latest revision as of 11:27, 13 January 2023

Hover & click on the images for description

Description

Description:
Target Board display

Handles the shooting targets in the Bootcamp DLC, statistics, animation, etc. (targets such as TargetBootcampHuman_f)

Action/Parameter Table
Action (String) Parameters (Array) arguments
initialize
Initializes the target and sets it to the "up" position
  • target: Object - Target object of type "TargetBootcamp_base_F"
terminate
Doesn't do anything
N/A
animate
Animate the object to the given position ("up" or "down")
  • target: Object - Target object of type "TargetBootcamp_base_F"
  • position: String - "up" or "down" (default)
getAnimationPhase

Return Value: Number - 0 (up) or 1 (down) depending on current state
  • target: Object - Target object of type "TargetBootcamp_base_F"
getAnimationPhaseString

Return Value: String - "up" or "down" depending on current state
  • target: Object - Target object of type "TargetBootcamp_base_F"
getAnimatedSelection

Return Value: String - the name of the "animatedSelection" from object config
  • target: Object - Target object of type "TargetBootcamp_base_F"
hit
Handles the hit event to animate the target down and up again
  • target: Object - Target object of type "TargetBootcamp_base_F"
  • unit: Object - Unit which shot the target
  • damage: Number - Amount of damage done to the target
hitPart
Handles the hit event and stores the data
  • partsList: Array - Contains list of all parts which got hit (see HitPart EH format) to format [target, shooter]:
    • target: Object - Target object of type 'TargetBootcamp_base_F'
    • shooter: Object - Unit which shot the target
getShooterDataIndex

Return Value: Number - index from Shooter Data for specific unit
  • target: Object - Target object of type "TargetBootcamp_base_F"
  • uid: String - Player UID of unit who shot the target
getShooterData

Return Value: Array - all data from Shooter Data for specific unit

Format: [["uid", ""], ["name", ""], ["shots", [[["time", 0], ["distance", 0], ["weapon", ""], ["direct", 0]]]]]

  • target: Object - Target object of type "TargetBootcamp_base_F"
  • uid: String - Player UID of unit who shot the target
setShooterData
Set Shooter Data for specific unit
  • target: Object - Target object of type "TargetBootcamp_base_F"
  • uid: String - Player UID of unit who shot the target
  • data: Array - Shooter Data
getShotsData

Return Value: Array - Shots Data for specific unit
  • target: Object - Target object of type "TargetBootcamp_base_F"
  • uid: String - Player UID of unit who shot the target
getShotsDataFromTargets

Return Value: Number - total amount of shots hit
  • targets: Array of Object - List of target objects of type "TargetBootcamp_base_F"
  • uid: String - Player UID of unit who shot the target
getShotsDataWithFilter

Return Value: Array - Shot Data after custom filter
  • target: Object - Target object of type "TargetBootcamp_base_F"
  • uid: String - Player UID of unit who shot the target
  • filter: String - One of "time", "distance", "weapon" or "direct"
  • code: Code - Custom code to validate the shot. _this is the value of filtered data
setShotsData
Set Shots Data for specific unit
  • target: Object - Target object of type "TargetBootcamp_base_F"
  • uid: String - Player UID of unit who shot the target
  • data: Array - Shots Data
getShootersData

Return Value: Array - full Shooters Data
  • target: Object - Target object of type "TargetBootcamp_base_F"
setShootersData
Set full Shooters Data
  • target: Object - Target object of type "TargetBootcamp_base_F"
  • data: Array - Shooter Data
resetShootersData
Remove all data from Shooters Data array
  • target: Object - Target object of type "TargetBootcamp_base_F"
getShooterTemplate

Return Value: Array - template for Shooter Data
  • target: Object - Target object of type "TargetBootcamp_base_F"
  • uid: String - Player UID of unit who shot the target
getShotTemplate

Return Value: Array - template for Shot Data (see HitPart EH format)
  • target: Object - Target object of type "TargetBootcamp_base_F"
  • shooter: Object - Unit who shot the target
  • projectile: Object - ("_bullet" not used)
  • position: Array format Position - ("_position" not used)
  • velocity: Array - ("_velocity" not used)
  • selection: Array - ("_selection" not used)
  • ammo: Array - ("_ammo" not used)
  • vector: Array - ("_direction" not used)
  • radius: Array - ("_radius" not used)
  • surfaceType: String - ("_surface" not used)
  • isDirect: Boolean - true if object was directly hit, false if it was hit by indirect/splash damage.
getShooterByUid

Return Value: Object - corresponding shooter unit
  • uid: String - Player UID of unit who shot the target
uiOpen
Opens the Target Board display
  • target: Object - Target object of type "TargetBootcamp_base_F"
uiOpenToAll
Opens the Target Board display for all connected players
  • target: Object - Target object of type "TargetBootcamp_base_F"
uiOnLoad
Triggered when display is opened (internal)
uiFillTable
Triggered when display is opened, fills UI with Shooters Data (internal)
  • target: Object - Target object of type "TargetBootcamp_base_F"
  • control: Control - "_listBox"
uiFillTableRow
Triggered when display is opened, fills UI with Shooter Data (internal)
  • target: Object - Target object of type "TargetBootcamp_base_F"
  • control: Control - "_listBox"
  • data: Array - Shooter Data
Execution:
call
Groups:
Interaction

Syntax

Syntax:
[action, parameters] call BIS_fnc_target
Parameters:
action: String
parameters: Array
Return Value:
See above table

Examples

Example 1:
// open the Score Board ["uiOpen", [myTarget]] call BIS_fnc_target;
Example 2:
// open the Score Board for all players in MP ["uiOpenToAll", [myTarget]] call BIS_fnc_target;
Example 3:
// clear all data from Score Board ["resetShootersData", [myTarget]] call BIS_fnc_target;

Additional Information

See also:
doTarget

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