Jump to content

Need help with SKSE GameData.GetAllWeapons()


palingard

Recommended Posts

This is actually probably the entire "GetAll" suite. I have the following code, but the Weapons array, while not equal to none, has a length of 0 after the call to GetAllWeapons. This is the case with Skyrim.esm, Dawnguard.esm, and Dragonborn.esm, which I know all have weapons to pull. Has anyone had experience with this function and can help me find what I am doing wrong? I have tried this both with and without a keyword array. When I used the keyword array, I manually set element 0 to be VendorItemWeapon.

 

 

 

if GameData.GetAllWeapons(Modname) != none
Debug.Notification("There are weapons in " + ModName)

 

Form[] Weapons = GameData.GetAllWeapons(Modname)

 

Debug.Notification("Located " + Weapons.Length + " weapons in " + ModName)
endif

 

 

 

The first notification fires indicating that we have a non-none return, but the second notification states "Located 0 weapons in Skyrim.esm" as an example.

 

Any help or guidance is greatly appreciated. I am stumped.

 

Palingard

Link to comment
Share on other sites

So, after some more experimentation, I found the problem. Apparently, it did not like comparing the result from the function to none. I changed the code as follows and it is working like a charm.

 

 


if GameData.GetAllWeapons(Modname).length > 0
Debug.Notification("There are weapons in " + ModName)

Form[] Weapons = GameData.GetAllWeapons(Modname)

Debug.Notification("Located " + Weapons.Length + " weapons in " + ModName)
endif

 

Link to comment
Share on other sites

Good point and I will keep that in mind. That portion is all working properly now. Now I am building potions. Apparently a magic effect on one ingredient is not equal to the equivalent on another ingredient. For example, the Resist Frost on Thistle Branch is not equal to the Resist Frost on Snowberries. I think this is because the get magic effect function is pulling the specific effect instance on that ingredient rather than the base magic effect. I will be testing that later today.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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