irswat Posted November 18, 2016 Share Posted November 18, 2016 (edited) Mattiewagg, on 15 Mar 2015 - 11:34 PM, said: Int iIndex = MyContainer.GetNumItems() While iIndex iIndex -= 1 Game.GetPlayer().AddItem(MyContainer.GetNthForm(iIndex), 1); or whatever EndWhile So I know I could use something like this to fill a form with all weapons, armor, potions, from a player. What if I wanted to fill a formlist with all spells and/or shouts that a player currently knows, is there a way to do that? Also I think I can use a ref alias script for the player for update the form list when stuff is added or removed from the player container, is the same method viable for keeping spell/shout formlists updated? Edited November 18, 2016 by irswat Link to comment Share on other sites More sharing options...
IsharaMeradin Posted November 18, 2016 Share Posted November 18, 2016 With SKSE there are GetSpellCount and GetNthSpell But those (according to information on the wiki page) will only get you what has been added, not anything already applied directly to the Race or ActorBase records for the Actor in question. There is also PlayerKnows which you could possibly be of use in some way. Link to comment Share on other sites More sharing options...
irswat Posted November 18, 2016 Author Share Posted November 18, 2016 (edited) So I could in theory do something like : function InitializeFormlists() int nSpellsLearned=PlayerRef.GetSpellCount() int LoopCounter=0 Spell curSpell while (LoopCounter<=nSpellsLearned) curSpell = PlayerRef.GetNthSpell(LoopCounter) SpellFormList.AddForm(curSpell) debug.trace("Spell added: " + SpellFormList.GetAt(0).GetName()) LoopCounter+=1 endwhile debug.notification ("Spells form list initialized!") endFunction The caveat you mentioned would have to do with something like Adrenaline Rush? EDIT: No this does not work. Casting spell as form doesnt work. Trying to add the spell to the formlist as a spell doesn't work either. [11/18/2016 - 02:49:56PM] error: Cannot call AddForm() on a None object, aborting function call stack: [SVE (05000D62)].SVE_ParserEngine.InitializeFormlists() - "SVE_ParserEngine.psc" Line 440 [SVE (05000D62)].SVE_ParserEngine.OnInit() - "SVE_ParserEngine.psc" Line 34 [11/18/2016 - 02:49:56PM] error: Cannot call GetAt() on a None object, aborting function call stack: [SVE (05000D62)].SVE_ParserEngine.InitializeFormlists() - "SVE_ParserEngine.psc" Line 441 [SVE (05000D62)].SVE_ParserEngine.OnInit() - "SVE_ParserEngine.psc" Line 34 [11/18/2016 - 02:49:56PM] error: Cannot call GetName() on a None object, aborting function call Edited November 18, 2016 by irswat Link to comment Share on other sites More sharing options...
IsharaMeradin Posted November 18, 2016 Share Posted November 18, 2016 In theory. I've never worked with those functions so not positive on how it all works together. And yeah, I'd suspect that Adrenaline Rush would be one of the items it cannot count. Link to comment Share on other sites More sharing options...
irswat Posted November 18, 2016 Author Share Posted November 18, 2016 strangest thing: [11/18/2016 - 03:15:10PM] Spell 0 added: Shrouded Armor Full Set [11/18/2016 - 03:15:10PM] error: Cannot call AddForm() on a None object, aborting function call stack: [SVE (05000D62)].SVE_ParserEngine.InitializeFormlists() - "SVE_ParserEngine.psc" Line 440 [SVE (05000D62)].SVE_ParserEngine.OnInit() - "SVE_ParserEngine.psc" Line 34 [11/18/2016 - 03:15:10PM] Spell 1 added: Nightingale Armor Full Set [11/18/2016 - 03:15:10PM] error: Cannot call AddForm() on a None object, aborting function call stack: [SVE (05000D62)].SVE_ParserEngine.InitializeFormlists() - "SVE_ParserEngine.psc" Line 440 [SVE (05000D62)].SVE_ParserEngine.OnInit() - "SVE_ParserEngine.psc" Line 34 [11/18/2016 - 03:15:10PM] Spell 2 added: The Warrior Stone [11/18/2016 - 03:15:10PM] error: Cannot call AddForm() on a None object, aborting function call stack: [SVE (05000D62)].SVE_ParserEngine.InitializeFormlists() - "SVE_ParserEngine.psc" Line 440 [SVE (05000D62)].SVE_ParserEngine.OnInit() - "SVE_ParserEngine.psc" Line 34 [11/18/2016 - 03:15:10PM] Spell 3 added: Oakflesh I was expecting flame, spark, heal, oakflesh. I got shrouded armor full set, nightingale armor full set, the warrior stone, and oakflesh. It's a cleansave in riverwood trader. I'm still rocking the imperial armor I stole off some dead guy from helgen cave. I certainly do not have the nightingale armor set, or the shrouded armor set. Also need to figure out how to get the form of the spell because I can not add a spell to a formlist. Link to comment Share on other sites More sharing options...
irswat Posted November 18, 2016 Author Share Posted November 18, 2016 (edited) this works: function InitializeFormlists() int nSpellsLearned=PlayerRef.GetLeveledActorBase().GetSpellCount() int LoopCounter=0 debug.notification("Spells player knows: " + nSpellsLearned) Spell curSpell while (LoopCounter<=nSpellsLearned) curSpell=PlayerRef.GetLeveledActorBase().GetNthSpell(LoopCounter) SpellFormList.AddForm(curSpell) debug.notification("Spell added: " + curSpell.GetName()) debug.trace("Spell " + LoopCounter + " added: " + curSpell.GetName()) LoopCounter+=1 endwhile debug.notification ("Spells form list initialized!") endFunction Sort of works. Sparks isn't showing. Oakflesh isn't showing. Combat Heal Rate? and the fourth spell is null. [11/18/2016 - 03:25:44PM] Spell 0 added: Flames[11/18/2016 - 03:25:44PM] Spell 1 added: Healing[11/18/2016 - 03:25:44PM] Spell 2 added: Combat Heal Rate [11/18/2016 - 03:25:44PM] error: Cannot call GetName() on a None object, aborting function callstack:[sVE (05000D62)].SVE_ParserEngine.InitializeFormlists() - "SVE_ParserEngine.psc" Line 441[sVE (05000D62)].SVE_ParserEngine.OnInit() - "SVE_ParserEngine.psc" Line 34[11/18/2016 - 03:25:44PM] warning: Assigning None to a non-object variable named "::temp27"stack:[sVE (05000D62)].SVE_ParserEngine.InitializeFormlists() - "SVE_ParserEngine.psc" Line 441[sVE (05000D62)].SVE_ParserEngine.OnInit() - "SVE_ParserEngine.psc" Line 34[11/18/2016 - 03:25:44PM] error: Cannot call GetName() on a None object, aborting function callstack:[sVE (05000D62)].SVE_ParserEngine.InitializeFormlists() - "SVE_ParserEngine.psc" Line 442[sVE (05000D62)].SVE_ParserEngine.OnInit() - "SVE_ParserEngine.psc" Line 34[11/18/2016 - 03:25:44PM] warning: Assigning None to a non-object variable named "::temp31"stack:[sVE (05000D62)].SVE_ParserEngine.InitializeFormlists() - "SVE_ParserEngine.psc" Line 442[sVE (05000D62)].SVE_ParserEngine.OnInit() - "SVE_ParserEngine.psc" Line 34[11/18/2016 - 03:25:44PM] Spell 3 added: Edited November 18, 2016 by irswat Link to comment Share on other sites More sharing options...
irswat Posted November 18, 2016 Author Share Posted November 18, 2016 What an unstable function! I removed GetLeveledBaseActor() so the code looks like this: function InitializeFormlists() int nSpellsLearned=PlayerRef.GetSpellCount() int LoopCounter=0 debug.notification("Spells player knows: " + nSpellsLearned) Spell curSpell while (LoopCounter<=nSpellsLearned) curSpell=PlayerRef.GetNthSpell(LoopCounter) SpellFormList.AddForm(curSpell) debug.notification("Spell added: " + curSpell.GetName()) debug.trace("Spell " + LoopCounter + " added: " + curSpell.GetName()) LoopCounter+=1 endwhile debug.notification ("Spells form list initialized!") endFunction and I'm getting random spells mixed in with the correct spells: [11/18/2016 - 03:34:50PM] Spell 0 added: Shrouded Armor Full Set[11/18/2016 - 03:34:50PM] Spell 1 added: Nightingale Armor Full Set[11/18/2016 - 03:34:50PM] Spell 2 added: The Warrior Stone[11/18/2016 - 03:34:50PM] Spell 3 added: Oakflesh[11/18/2016 - 03:34:50PM] Spell 4 added: Sparks[11/18/2016 - 03:34:50PM] Spell 5 added: Ahzidal's Genius[11/18/2016 - 03:34:50PM] Spell 6 added: Deathbrand Instinct [11/18/2016 - 03:34:50PM] error: Cannot call GetName() on a None object, aborting function callstack:[sVE (05000D62)].SVE_ParserEngine.InitializeFormlists() - "SVE_ParserEngine.psc" Line 441[sVE (05000D62)].SVE_ParserEngine.OnInit() - "SVE_ParserEngine.psc" Line 34[11/18/2016 - 03:34:50PM] warning: Assigning None to a non-object variable named "::temp26"stack:[sVE (05000D62)].SVE_ParserEngine.InitializeFormlists() - "SVE_ParserEngine.psc" Line 441[sVE (05000D62)].SVE_ParserEngine.OnInit() - "SVE_ParserEngine.psc" Line 34[11/18/2016 - 03:34:50PM] error: Cannot call GetName() on a None object, aborting function callstack:[sVE (05000D62)].SVE_ParserEngine.InitializeFormlists() - "SVE_ParserEngine.psc" Line 442[sVE (05000D62)].SVE_ParserEngine.OnInit() - "SVE_ParserEngine.psc" Line 34[11/18/2016 - 03:34:50PM] warning: Assigning None to a non-object variable named "::temp30"stack:[sVE (05000D62)].SVE_ParserEngine.InitializeFormlists() - "SVE_ParserEngine.psc" Line 442[sVE (05000D62)].SVE_ParserEngine.OnInit() - "SVE_ParserEngine.psc" Line 34[11/18/2016 - 03:34:50PM] Spell 7 added: Link to comment Share on other sites More sharing options...
IsharaMeradin Posted November 18, 2016 Share Posted November 18, 2016 Like I said, I never used it. Seems a bit fickle to me tho. The last one is null because you are using <= in your while loop. The count is always the value starting at one, but the index of entries always starts at 0. So change it to < only and you shouldn't get a null entry at the end. Link to comment Share on other sites More sharing options...
irswat Posted November 18, 2016 Author Share Posted November 18, 2016 good catch Link to comment Share on other sites More sharing options...
irswat Posted November 19, 2016 Author Share Posted November 19, 2016 OK, so I did a little digging. There are 4 "spells" that GetNthSpell is returning that the character definitely doesn't have: AlchFortifyEnchanting 0003EB29 - Ahzidal's GeniusDBFullSet EnchFortifyArmorRatingSelf - Shrouded Armor Full Set (ability)TGFullSet EnchFortifyArmorRatingSelf - Nightingale Armor Full Set (ability)Deathbrand Instinct from http://elderscrolls.wikia.com/wiki/Deathbrand_armorI have no idea why the engine thinks my character has these enchantments and abilities. It is a brand new save right after helgen cave wearing imperial armor. Link to comment Share on other sites More sharing options...
Recommended Posts