Jump to content
madrussian

Getting unit's weapon object (not weapon string) - Screenshot included

Recommended Posts

Apparently (based on some quick tests in the editor) a unit and his weapon are different objects.

 

On VR map, I shot a bunch of rays though a Loon using lineIntersectsSurfaces and examined the results, which looked like this:

 

Man-and-his-Gun.png

 

In this case (per lineIntersectsSurfaces), the man is Loon and his weapon is "NOID cup_famas_f1_rail.pd3".  (Again as far as I can tell, separate & distinct objects.)  The question is:

 

How can we get this weapon object? (without using raycast commands like lineIntersectsSurfaces)?

 

Spoiler

Seems there must be a simple command for this, like getWeaponObject (or similar)?

 

Share this post


Link to post
Share on other sites

in arma, weapons are no separate entities

  • Like 1

Share this post


Link to post
Share on other sites
11 minutes ago, .kju said:

in arma, weapons are no separate entities

 

Thanks for the response.  Respectfully, again lineIntersectsSurfaces seems to consider man and his weapon as separate.  Also, when a unit dies (and thus drops his weapon), his weapon is definitely separated then (perhaps technically contained in weapon holder or similar).

 

Sounds like for living unit holding a weapon though, maybe there is no direct command to get at this weapon "object" that is apparent to lineIntersectsSurfaces?

 

Share this post


Link to post
Share on other sites

weapons/items sit in a weaponholder when not with an unit

  • Like 1

Share this post


Link to post
Share on other sites

CursorObject returns the primaryWeapon of an unit, not the unit when you point at it. That's not the case for other loadout as backpack, headgear or else.

 

getModelInfo cursorObject (pointed at primary weapon of a standing "B_Soldier_A_F"): ["mx_f.p3d","a3\weapons_f\rifles\mx\mx_f.p3d",true]
getModelInfo cursorObject (anywhere else on unit)  ["b_soldier_01.p3d","a3\characters_f\blufor\b_soldier_01.p3d",true]

 

Now, 🥁 drum roll,  deleteVehicle cursorObject

on primary weapon // nothing occurs

on unit  // bye!

 

There is no object (NOID), just string for primary weapon, which allows you a bunch of possibilities with related weapon commands.

 

  • Like 2

Share this post


Link to post
Share on other sites

Good points guys, all makes sense now. 🙂

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×