NVSE & GetWeaponHasScope

Post » Tue May 01, 2012 8:42 pm

I need to determine if a weapon has a scope.

The NVSE function "GetWeaponHasScope" seems to not function correctly. .ie As long as the weapon has a scope by default OR if it can be attached by means of a weapon mod, the function returns true.

for instance, i run the call on an unmodded varmint rifle, the function returns true. not what i need at all. I need to know if the weapon CURRENTLY has a scope.

any workaround for this?
User avatar
Dawn Porter
 
Posts: 3449
Joined: Sun Jun 18, 2006 11:17 am

Post » Wed May 02, 2012 5:11 am

The NVSE function works correctly, but it does something different that what you are thinking.

GetWeaponHasScope refers to the GECK Weapon Form, Art and Sound tab, "Has Scope" checkbox.

Since a scope can come from a weapon mod (e.g. Varmint Rifle) this function is not sufficient for your needs because it does not tell you if the scope has actually been installed or not.

For what you want, you need to test if a given Item Mod had been applied to your Varmint Rifle.

Sorry, that I don't know how to do, or even if it can be done.

There is a sort of equivalent for actors and actor effects, its called HasMagicEffect, but it only works on actors and not on items. IDK if there is an equivalent for items.
User avatar
April
 
Posts: 3479
Joined: Tue Jun 20, 2006 1:33 am

Post » Wed May 02, 2012 3:11 am

There's some functions that aren't documented on the NVSE page:
000014F2 0001 GetEquippedWeaponModFlags
000014F3 0001 SetEquippedWeaponModFlags
000014F4 0000 GetWeaponItemModEffect
000014F5 0000 GetWeaponItemModValue1
000014F6 0000 GetWeaponItemModValue2

Also you can check out the weapon mod menu to see how he did it : http://newvegas.nexusmods.com/downloads/file.php?id=44515
User avatar
Naomi Lastname
 
Posts: 3390
Joined: Mon Sep 25, 2006 9:21 am

Post » Wed May 02, 2012 3:31 am

There's some functions that aren't documented on the NVSE page ...

Thanks RHK, I copied those notes to my personal NVSE notes in case I ever want to use them. I remembered that mod from the past but had forgotten the name and couldn't find it to confirm if it did what the fellow was looking for. But yeah, it would be the best reference for anyone wanting to use those functions.
User avatar
sas
 
Posts: 3435
Joined: Thu Aug 03, 2006 8:40 am


Return to Fallout: New Vegas