Sign in to follow this  
Followers 0
speedweasel

How to return a weapon accessory from a unit

2 posts in this topic

I want to log some more detailed information to the kill feed.  Specifically the weapon types the killer used including accessories.  I can pull the weapon class and display name easily enough:

_weapon = currentWeapon _killer;
_weaponDisplayName = getText (configfile >> "CfgWeapons" >> _weapon >> "displayName");

But the weapon accessories are proving more difficult.  I've tried the following code but _weaponScopeDisplayName always returns nothing even though the killer definitely has an optic on their rifle:

_weapon = currentWeapon _killer;
_weaponScopeName = getText (configfile >> "CfgWeapons" >> _weapon >> "LinkedItems" >> "LinkedItemsOptic" >> "item");
_weaponScopeDisplayName = getText (configfile >> "CfgWeapons" >> _weaponScopeName >> "displayName");

What am I missing?

Share this post


Link to post
Share on other sites

I was completely on the wrong track.  Got it working with the following code.

_weapon = currentWeapon _killer;  // get the class name of the killer's weapon
_weaponScope = _killer weaponAccessories currentMuzzle _killer select 2; // get the class name of the killer's optic attachment (if any)
_weaponDisplayName = getText (configfile >> "CfgWeapons" >> _weapon >> "displayName"); // get the display name of the killer's weapon (as distinct from the class name)
_weaponScopeDisplayName = getText (configfile >> "CfgWeapons" >> _weaponScope >> "displayName"); // get the display name of the killers optic

 

1 person likes this

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.