palingard Posted September 21, 2016 Share Posted September 21, 2016 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 More sharing options...
palingard Posted September 21, 2016 Author Share Posted September 21, 2016 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 > 0Debug.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 More sharing options...
FrankFamily Posted September 21, 2016 Share Posted September 21, 2016 If GameData.GetAllWeapons(Modname) Should work too, GetAllWeapons returns an array, an array is cast to false if it's empty. Link to comment Share on other sites More sharing options...
NexusComa Posted September 21, 2016 Share Posted September 21, 2016 If GameData.GetAllWeapons(Modname) Should work too, GetAllWeapons returns an array, an array is cast to false if it's empty. This is how I do it ... Link to comment Share on other sites More sharing options...
palingard Posted September 22, 2016 Author Share Posted September 22, 2016 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 More sharing options...
Recommended Posts