Jump to content
Maffine

Is it possible to get the object information of player's weapon?

Recommended Posts

Hello guys, I'm working on a script and need to identify the object info of the player's weapon (that in the format 11111: dummyweapon.p3d). I have already tried using lineIntersectsSurface but it does not respond to human units. I also tried using cursorObject for Biki says it will return the p3d info when pointing at other units' weapons, but no result so far. I remember that there is a line of command that can return that info of player's backpack and vest (backpackContainer and so), but no counterpart for other proxy. So I am currently out of options. Does anyone know whether the weapon's object info can ever be retrieved by someone other than the engine itself? Thanks

Share this post


Link to post
Share on other sites

You can get the weapon config that has all the data of the weapon like this:

_weaponConfig = configfile >> "CfgWeapons" >> (primaryWeapon player);


hint (getText (_weaponConfig  >> "displayname"));

 

So to get info of the weapon config you need to use getText, getNumber, getArray commands

 

 

Hope I didn't typo anything 🙂

 

 

 

 

Share this post


Link to post
Share on other sites
1 hour ago, gc8 said:

You can get the weapon config that has all the data of the weapon like this:


_weaponConfig = configfile >> "CfgWeapons" >> (primaryWeapon player);


hint (getText (_weaponConfig  >> "displayname"));

 

So to get info of the weapon config you need to use getText, getNumber, getArray commands

 

 

Hope I didn't typo anything 🙂

 

 

 

 

Thanks gc8😄Sorry that maybe I'm not expressing myself very precisely, what I want to do is to get the instance instead of the class, or put it another way, the piece of code that represents "the" exact gun held by player like for example a chair spawn in a mission, instead of the class name telling all the attributes about the gun.

Hope I am anywhere close to saying something meaningful, for I am really not good at describing something so nuanced.

Thanks again for your help!

Share this post


Link to post
Share on other sites

If you name something, like an in-game Object, then that's its name. It's then a Global Variable.

 

You can set Names in the Field in the Editor.

 

Also you may be interested in setVariable and getVariable, etc

https://community.bistudio.com/wiki/setVariable

 

(guessing there is a translation issue here?)

Share this post


Link to post
Share on other sites
36 minutes ago, Von Quest said:

If you name something, like an in-game Object, then that's its name. It's then a Global Variable.

 

You can set Names in the Field in the Editor.

 

Also you may be interested in setVariable and getVariable, etc

https://community.bistudio.com/wiki/setVariable

 

(guessing there is a translation issue here?)

Well, I want to assign a handle to the weapon player is holding. Is it possible that way?

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

×