Jump to content
Sign in to follow this  
Llano

Get CurrentWeapon classname without attachment

Recommended Posts

Hello!

If a player is having a laserpointer at the current weapon, and i run this code

_weaponClass = currentWeapon player;

what will it return?

For example, a MXM rifle (without any attachment) classname is "arifle_MXM_F", but with a laserpointer attached it is "arifle_MXM_Hamr_pointer_F".

How do i only retrieve the classname without any attachment on?

Thanks.

Share this post


Link to post
Share on other sites

After playing around in the editor, i find that if i spawn with a MXM rifle equipt with a laser pointer, it returns "arifle_MXM_Hamr_pointer_F", but if i remove the laser pointer, it still returns "arifle_MXM_Hamr_pointer_F". Weird?

Share this post


Link to post
Share on other sites

It technically counts as a separate weapon to the unmodified version. The only difference, though, is the pre-attached attachments (obviously). However, removing these will not change what the weapon is (that would be akin to an MXM suddenly turning into a Katiba).

I hope that helps explain it.

Share this post


Link to post
Share on other sites
It technically counts as a separate weapon to the unmodified version. The only difference, though, is the pre-attached attachments (obviously). However, removing these will not change what the weapon is (that would be akin to an MXM suddenly turning into a Katiba).

I hope that helps explain it.

Aha, alright i see. Thanks for the explanation.

Is any chance that i can get the unmodified version classname of that weapon?

For example, if i have equipt a MXM with laser pointer it will return arifle_MXM_F?

Share this post


Link to post
Share on other sites
Aha, alright i see. Thanks for the explanation.

Is any chance that i can get the unmodified version classname of that weapon?

For example, if i have equipt a MXM with laser pointer it will return arifle_MXM_F?

Only if it was originally created as the base arifle_MXM_F, then the laser pointer added afterwards.

Either that, or you could try experimenting with string handling (but I wouldn't recommend that).

Share this post


Link to post
Share on other sites
Only if it was originally created as the base arifle_MXM_F, then the laser pointer added afterwards.

Either that, or you could try experimenting with string handling (but I wouldn't recommend that).

Aha, i see. So aslong i spawn the weapons without any attachment, i will get the unmodified version? Hm, that might work for me. Thanks :)

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
Sign in to follow this  

×