Feature #5316

unit GetWeaponIndexes "weaponname"

Added by Mandoble over 5 years ago. Updated over 2 years ago.

Status:Assigned Start date:10/21/2009
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:Scripting: New command
Target version:-
Affected ArmA II version: First affected ArmA II version:
Reproduced by another DH user:Yes Single / Multi Player?:
I am using some Mods:No BIForumURL:
I am using: NGUrl:
Reproducible for you:No WIKIurl:
Related to content of DLC:

Description

Request for a new GetWeaponIndexes command returning an array with weapon indexes for the indicated weapon name and unit. These indexes are the numbers currently used by action "USEWEAPON".

CIT_#5316.7z (1.7 kB) rocko, 03/19/2012 10:27

History

Updated by Fireball over 5 years ago

  • Status changed from New to Assigned

Updated by kju over 4 years ago

  • Affected ArmA II version deleted (1.04.59026)
  • Audio card set to Please specify!
  • Size of OS swap file set to Please specify!

Updated by rocko about 3 years ago

  • I am using some Mods set to No
  • Reproducible for you set to No

This command is really needed.
Once you change your loadout (weapons and items) any script relying on the first given index fails, because the weapons and items are re-ordered and you would have to "find" the current weapon muzzle/mode you wish to fire - which you cannot with the given commands.

There is no way to use the "USEWEAPON" action command properly. It's useless.

Alternatively - if too complex to fix.
Supply a similar command: _unit action ["useWeapon", <currentMuzzle _unit / specified muzzle / current weapon / weapon specified>] (Given currentMuzzle or any other current... command work properly on non local units).

Ref: http://community.bistudio.com/wiki/ArmA_2:_Actions#UseWeapon

Updated by rocko about 3 years ago

  • Reproduced by another DH user changed from No to Yes

Updated by rocko about 3 years ago

Does it need a repro mission or some more detailed information about why this is bugged to get attention?

Updated by zGuba about 3 years ago

A repro showing how USEWEAPON becomes useless would be useful :)

Updated by rocko about 3 years ago

Added a sample mission.

Short explanation in addition to the mission.

- USEWEAPON currently relies on the fact that you have to supply an index, that represents the current muzzle of the weapon you want to fire

- We intend to fire the primary weapon with it's first muzzle, which is 0.

- USEWEAPON on a player unit works as long as the weapons array is not touched.

- If the weapons are changed, the weapon array changes. See this in your RPT. The primary weapon is now at the end of the array.

- To get the mentioned index that USEWEAPON uses you have to know that the index number is generated by every muzzle from each weapon in the weapons array - in a consequent order.

- E.g
(weapons array before shifting)
ARRAY: [*"M16A4"*,"ItemMap","ItemWatch","ItemRadio","NVGoggles"]
MUZZLE COUNTS for each weapon: 1,1,1,1,1
RELATIVE: 0,1,2,3,4

(weapons array after shifting)
ARRAY: ["ItemMap","ItemWatch","ItemRadio","NVGoggles",*"M16A4"*]
MUZZLE COUNTS for each weapon: 1,1,1,1,1
RELATIVE: 0,1,2,3,4

The index for an untouched weapons array is 0
The index after changing gear would be 4

- The problem is now that "PUT" and "THROW" are also in the weapons array, but invisible, therefore they do not show up with scripting commands, but they exist
(Simply do a 'player hasweapon "Throw"' check)

- Now you just need to find out where PUT and THROW sit in the real array, which you cannot tell unless probably comparing CONFIG weapons array with the SCRIPT weapons array and compare positions of each weapon.

Updated by kju almost 3 years ago

  • Category changed from Scripting: Problem to Scripting: New command

Updated by Nou over 2 years ago

Please add this, its very much needed.

Also available in: Atom PDF