Jump to content

Problems with WeaponTypeRifle keyword


vkz89q

Recommended Posts

Ok, here are some examples, I'm using Assault Rifle as my example weapon. It has NO "WeaponTypeRifle" keyword. Instead it has "WeaponTypeAssaultRifle" keyword.

 

Example 1:

 

Perk with increased damage and condition run on perk owner weapon: HasKeyword : WeaponTypeRifle. This works and increases Assault Rifles damage. Tested on Rifleman and custom perk. Both work.

 

Example 2:

 

Spell with do something on hit. Condition run on actor reference(my custom npc). WornHasKeyWord: WeaponTypeRifle. Does NOT work on Assault Rifles. Works on Hunting Rifle, because it has WeaponTypeRifle keyword and every rifle that has right keyword.

 

Example 3:

 

Script. It's not full script. This is just for test now:

Actor Fighter = OurNpcAlias.GetReference() as Actor
Weapon ourWeapon = Fighter.GetEquippedWeapon()

if(!ourWeapon.HasKeyWord(WeaponTypeAutomatic) && !ourWeapon.HasKeyWord(WeaponTypeShotgun) && ourWeapon.HasKeyword(WeaponTypeRifle))
   Debug.Notification("we have a non-automatic rifle")
endIf

Keyword Property WeaponTypeAutomatic Auto Const

Keyword Property WeaponTypeRifle Auto Const

Keyword Property WeaponTypeShotgun Auto Const

Again. This does NOT work on Assault Rifle. It works with ANY other rifle that has WeaponTypeRifle keyword.

 

So my question is: Why does the perk work and script and spells do not. I'm even using the same condition: "HasKeyword" and run on weapon. Again, WornHasKeyword doesn't work either on Assault/Gauss rifles(they do not have weapontyperifle keyword).

 

Do I really need to run conditions to check for assault and gauss rifles(they don't have weapontyperifle keyword) too? Or maybe I'm missing something again.

 

Link to comment
Share on other sites

Okay, fixed it. My problem was registering for hit event.

RegisterForHitEvent(self, MyNpcAlias, abMatch = True, akSourceFilter = _my_OnHitWeaponsKeywords)

That OnHitWeaponsKeywords is a formlist with WeaponTypePistol, WeaponTypeRifle, WeaponTypeHeavyGun. I had to put WeaponTypeAssaultRifle on there and now WeaponTypeRifle conditions work correctly. So.. uh gotta remember that in the future.

 

Edit: And wornhaskeyword works now too. So no need for getequippedweapon anymore.

Edited by vkz89q
Link to comment
Share on other sites

wornhaskeyword is the way to go when you check for object modification keywords. It will not work with haskeyword. Remember that when you try that, saves a lot of pain

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...