xcafe Posted November 23, 2016 Share Posted November 23, 2016 (edited) Title says it all, I've got a formlist full of spells that I want added to the player. Anyone know how? (Also, formlists are global right? As in, if I fill a formlist property in one script I should be able to access it from another?) Edited November 23, 2016 by xcafe Link to comment Share on other sites More sharing options...
IsharaMeradin Posted November 23, 2016 Share Posted November 23, 2016 Very similar to the array method you asked about earlier. This assumes that your formlist is called MyList and that the player has been stored in a variable called PlayerRef Int ListSize = MyList.GetSize() Int Index = 0 While Index < ListSize Form Entry = MyList.GetAt(Index) If (Entry as Spell) PlayerRef.AddSpell(Entry as Spell) EndIf Index += 1 EndWhile Should be able to access a formlist from one script on another. Test to make sure. Link to comment Share on other sites More sharing options...
xcafe Posted November 23, 2016 Author Share Posted November 23, 2016 Thank you!!! Link to comment Share on other sites More sharing options...
xcafe Posted November 24, 2016 Author Share Posted November 24, 2016 Hm, so I've tested it, and I don't know what the problem is. FormList Property GrimoireSpellList Auto Actor Property PlayerRef Auto Event OnRead() Int ListSize = GrimoireSpellList.GetSize() Int Index = 0 While Index < ListSize Form Entry = GrimoireSpellList.GetAt(Index) If (Entry as Spell) PlayerRef.AddSpell(Entry as Spell) EndIf Index += 1 EndWhile EndEvent It compiles just fine, and in theory it should work, but it doesn't do anything. I've tried both the OnRead and OnEquipped events for this one, and nothing either time. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted November 24, 2016 Share Posted November 24, 2016 Are you assigning the appropriate data to the properties via the properties button on the object(s) with the script attached to it? Link to comment Share on other sites More sharing options...
xcafe Posted November 24, 2016 Author Share Posted November 24, 2016 Yeah, I thought that was it too, but nope :/ Tried it and still not working. http://pastebin.com/gpS0bjJX Here's all the scripts/functions Link to comment Share on other sites More sharing options...
IsharaMeradin Posted November 24, 2016 Share Posted November 24, 2016 What objects are each of the scripts attached to? The ones with the OnRead and/or OnEquipped events should be extending ObjectReference at the very least. If they do not extend the correct script, then they do not have access to the correct events that you are trying to listen to. Without being able to listen for the events, those portions of the script will not run. Link to comment Share on other sites More sharing options...
xcafe Posted November 24, 2016 Author Share Posted November 24, 2016 (edited) Fair play, but they didn't work when they were on the right objects either :sad: http://pastebin.com/CzNv1xQQ Corrected Script Edited November 24, 2016 by xcafe Link to comment Share on other sites More sharing options...
IsharaMeradin Posted November 24, 2016 Share Posted November 24, 2016 Are there any spells in the formlist to start with? If not, the while loop will not run since the index is 0 and the size is 0. That would prevent the notification statement from showing on that script. Where are you attaching the script that has the formlist property? Is that on the same object? If so, move it to a more permanent object. Perhaps a quest that is intended to be 'active' for the life of your mod. It is a bit hard to explain but I have discovered that for a formlist's changes to be recognized by other scripts the formlist needs to be a property on a script on a object that will be active for the duration that you want the changes to be noticed. If not, when an object with the formlist is first loaded it will get the formlist as-is from the plugin rather than with any changes you intended. I'm guessing that you are applying all these scripts to the spell tomes themselves. That is fine except for where the formlist is actually a property. That should be on something more permanent like a long running quest. Link to comment Share on other sites More sharing options...
xcafe Posted November 24, 2016 Author Share Posted November 24, 2016 Well I tried what you said, and it still doesn't work :( Link to comment Share on other sites More sharing options...
Recommended Posts