KicklerOfButts Posted September 27, 2017 Posted September 27, 2017 Any help would be appreciated! Formlist property rc_MasterFormlist Auto ;<----This formlist exists in the CK already. int mFormlistCount = 0 Formlist property rc_Formlist1 Auto ;<----This formlist does not exist in the CK already. Armor property rc_dummyFalse1 Auto ;<----This armor exists in the CK already. Armor property rc_dummyFalse2 Auto ;<----This armor exists in the CK already. Armor property rc_dummyFalse3 Auto ;<----This armor exists in the CK already. Armor property rc_dummyFalse4 Auto ;<----This armor exists in the CK already. Armor property ArmorBanditCuirass Auto ;<----This armor exists in the CK already. Event OnInit() RegisterForKey(37) ;This is key K EndEvent Event OnKeyDown(int mKey) if mKey == 37 int i i = InitMasterFormlist() ;<----This is function is meant to put rc_Formlist1 inside rc_MasterFormlist. i = InitVanillaArmors() ;<----This function is meant to fill entries inside a specified Formlist found INSIDE rc_MasterFormlist. endif EndEvent int Function InitMasterFormlist() rc_MasterFormlist.AddForm(rc_Formlist1) EndFunction int Function InitVanillaArmors() int i i = AddNewArmor(ArmorBanditCuirass) endFunction int Function AddNewArmor(Armor mArmor) ;This function is supposed to add the specified armors as entries in the Formlist found in rc_MasterFormlist at index mFormlistCount. Formlist mNewFormlist = rc_MasterFormlist.GetAt(mFormlistCount) as Formlist mNewFormlist.AddForm(mArmor) mNewFormlist.AddForm(rc_dummyFalse1) mNewFormlist.AddForm(rc_dummyFalse2) mNewFormlist.AddForm(rc_dummyFalse3) mNewFormlist.AddForm(rc_dummyFalse4) mFormlistCount += 1 return 1 EndFunction When the K key is pressed, the Above code is meant to: 1: Add rc_Formlist1 as an entry in rc_MasterFormlist. 2: Find the entry inside rc_MasterFormlist at index mFormlistCount. (Which starts at 0 and goes up by 1 when an entry is added.) 3: Add ArmorBanditCuirass and rc_dummy1 - 4 as entries inside said Formlist. That's it. The issue is that it keeps spitting out errors during the AddForm() function. Specifically, the mNewFormlist.AddForm() calls. It says that it can't add an entry to a "None," implying that there are no entries in rc_MasterFormlist.Why are there no entries in rc_MasterFormlist? As far as I can understand, InitMasterFormlist() should have added rc_formlist1 to rc_MasterFormlist, so why can't papyrus find or identify such? Been tearing my hair out for a while now.
davisev5225 Posted September 27, 2017 Posted September 27, 2017 Formlist mNewFormlist = rc_MasterFormlist.GetAt(mFormlistCount) as Formlist That's where you are failing. It's returning "None" instead of a formlist, so any subsequent calls to "mNewFormlist" will fail. I can't tell you why it's failing, since I haven't ever worked with formlists, but that's where you're failing.
KicklerOfButts Posted September 27, 2017 Author Posted September 27, 2017 I can't tell why it returns as None, everything I've found on Formlists tells me this should work.
MorePrinniesDood Posted September 27, 2017 Posted September 27, 2017 Your comments say the formlists exist in CK, but did you attach them to the script as properties in the quest/magic effect/object reference/whatever the script extends?
KicklerOfButts Posted September 27, 2017 Author Posted September 27, 2017 Your comments say the formlists exist in CK, but did you attach them to the script as properties in the quest/magic effect/object reference/whatever the script extends? Yes, all the forms that exist in the CK are properly linked with the equivalent properties. Quadruple checked. Naturally, the formlist rc_formlist1 (which doesn't have a CK entry) isn't linked to anything. It's intentionally meant to start out empty. GetAt() returns a Form, not a Formlist. The formlist that calls GetAt() continues as ".GetAt() as Formlist" though. Does that not work?
ousnius Posted September 27, 2017 Posted September 27, 2017 If the formlist count is an actual size, then you need to subtract 1 from it in the GetAt() call.
KicklerOfButts Posted September 27, 2017 Author Posted September 27, 2017 If the formlist count is an actual size, then you need to subtract 1 from it in the GetAt() call. Why? It's not used to add at index, but to find the entry at index. Both the formlist count and the formlist itself start at value 0, there shouldn't be any offset.
ousnius Posted September 27, 2017 Posted September 27, 2017 Formlists and arrays start at index 0, not 1. EDIT: Hmm, you're starting at 0 I guess. It's not really a count variable then, your naming is off.
KicklerOfButts Posted September 27, 2017 Author Posted September 27, 2017 Formlists and arrays start at index 0, not 1. EDIT: Hmm, you're starting at 0 I guess. It's not really a count variable then, your naming is off. It actually is a count variable, as it counts the total number of entries that have been added to rc_MasterFormlist. This function just uses it to locate the last added entry so it can set it's contents.
ousnius Posted September 27, 2017 Posted September 27, 2017 Formlists and arrays start at index 0, not 1. EDIT: Hmm, you're starting at 0 I guess. It's not really a count variable then, your naming is off. It actually is a count variable, as it counts the total number of entries that have been added to rc_MasterFormlist. The first time you use the "count" variable, it's at a value of 0, so it's an index, not a count. Only afterwards when you add +1 it temporarily becomes a count. But anyway, since you're not filling rc_Formlist1 in the CK, it will be None. You're adding this None variable into the master formlist. So when you receive it via GetAt(), it's still a None. You have to turn the rc_Formlist1 into a local variable (not an auto property) and initialize it in your script.
KicklerOfButts Posted September 27, 2017 Author Posted September 27, 2017 The first time you use the "count" variable, it's at a value of 0, so it's an index, not a count. Only afterwards when you add +1 it temporarily becomes a count. But anyway, since you're not filling rc_Formlist1 in the CK, it will be None. You're adding this None variable into the master formlist. So when you receive it via GetAt(), it's still a None. You have to turn the rc_Formlist1 into a local variable (not an auto property) and initialize it in your script. I thought that's what I was doing, but apparently not. How would I create and initialize an empty formlist via papyrus then? And the count variable is initially 0 because rc_MasterFormlist starts with 0 entries, and the variable increases by 1 each time an entry is added. Perhaps my terminology is off, but is that not a count? The value isn't really used for indexing, just counting. The count just so happens to also align with the indexes since they begin and climb identically.
ousnius Posted September 27, 2017 Posted September 27, 2017 The first time you use the "count" variable, it's at a value of 0, so it's an index, not a count. Only afterwards when you add +1 it temporarily becomes a count. But anyway, since you're not filling rc_Formlist1 in the CK, it will be None. You're adding this None variable into the master formlist. So when you receive it via GetAt(), it's still a None. You have to turn the rc_Formlist1 into a local variable (not an auto property) and initialize it in your script. I thought that's what I was doing, but apparently not. How would I create and initialize an empty formlist via papyrus then? That should happen automatically once you remove the "Auto" and "Property" keywords.
KicklerOfButts Posted September 27, 2017 Author Posted September 27, 2017 I thought that's what I was doing, but apparently not. How would I create and initialize an empty formlist via papyrus then? That should happen automatically once you remove the "Auto" and "Property" keywords. Tried this, it didn't change the output. This is how I did it originally actually, I only added the "property" + "Auto" as an attempted fix. The papyrus log is identical to before.
Veniat Posted September 27, 2017 Posted September 27, 2017 Did you try checking if it's actually adding the Formlist at InitMasterFormlist? It could be trying to pull a null value but I don't know honestly; I'm not that experienced with Papyrus. To me it looks like rc_Formlist1 isn't being initialised correctly, but I have no idea.
morpheousz Posted September 27, 2017 Posted September 27, 2017 Is it possible you cannot create a formlist from papyrus? You might have to create an empty formlist in the ck and reference it in the script.
KicklerOfButts Posted September 27, 2017 Author Posted September 27, 2017 Did you try checking if it's actually adding the Formlist at InitMasterFormlist? It could be trying to pull a null value but I don't know honestly; I'm not that experienced with Papyrus. To me it looks like rc_Formlist1 isn't being initialised correctly, but I have no idea. When I run a rc_MasterFormlist.GetSize() check after the entry is supposed to be added, the size does turn out as 0. It seems you're probably right and nothing is being added to the list, although I can't tell if it's because the adding is failing or if the object attempting to be added is actually "None." Papyrus isn't throwing any errors about it, so I don't have much to go on. Is it possible you cannot create a formlist from papyrus? You might have to create an empty formlist in the ck and reference it in the script. This should be entirely possible in theory, but I had hoped not to have to do it since the Formlists logically shouldn't need to be linked properties that clog the CK.
ousnius Posted September 27, 2017 Posted September 27, 2017 There's also a possibility that a FormList inside of a FormList is simply not allowed. Multidimensional arrays don't exist either.
yatol Posted September 27, 2017 Posted September 27, 2017 The issue is that it keeps spitting out errors during the AddForm() function. Specifically, the mNewFormlist.AddForm() calls.It says that it can't add an entry to a "None," implying that there are no entries in rc_MasterFormlist. rc_MasterFormlist.AddForm(rc_Formlist1) how is the game supposed to add a form that doesn't exist in an esp in another formlist? import debug trace ("----------------------"+rc_MasterFormlist.GetAt(mFormlistCount)) ctrl f ----- your log to find that in it
KicklerOfButts Posted September 27, 2017 Author Posted September 27, 2017 There's also a possibility that a FormList inside of a FormList is simply not allowed. Multidimensional arrays don't exist either. Formlists in Formlists are definitely allowed, that I've tested and made sure of before. It's one advantage that Formlists have over Arrays, as Formlists can roughly simulate multidimensional arrays like this. It just takes a bit of work. c_MasterFormlist.AddForm(rc_Formlist1) how is the game supposed to add a form that doesn't exist in an esp in another formlist? import debug trace ("----------------------"+rc_MasterFormlist.GetAt(mFormlistCount)) ctrl f ----- your log to find that in it Why doesn't the Formlist exist though? I've called it's creation, so why is it created as None and not just an empty Formlist? Being empty should not equal being a None. Do you actually have to make every formlist a linked property for them to not be created as None? How do I create an empty Formlist in Papyrus then? Because I'm pretty sure I could make this work no problem if I was willing to make every last one of them a property linked to the CK, but I'm trying to avoid that as it shouldn't be necessary and it would mean I'll have to make 100+ Formlists individually by hand in the CK. Creating them in Papyrus would be literally 100x more efficient.
yatol Posted September 27, 2017 Posted September 27, 2017 Why doesn't the Formlist exist though? if it's not in the load order, it's not in the load order why do you want to put that stuff in the record of an esp anyway? scriptname rc_master extends something Formlist rc_MasterFormlist[100] int mFormlistCount = 0 Armor property rc_dummyFalse1 Auto ;<----This armor exists in the CK already. Armor property rc_dummyFalse2 Auto ;<----This armor exists in the CK already. Armor property rc_dummyFalse3 Auto ;<----This armor exists in the CK already. Armor property rc_dummyFalse4 Auto ;<----This armor exists in the CK already. Armor property ArmorBanditCuirass Auto ;<----This armor exists in the CK already. Event OnInit() RegisterForKey(37) ;This is key K EndEvent Event OnKeyDown(int mKey) if mKey == 37 int i i = InitMasterFormlist() ;<----This is function is meant to put rc_Formlist1 inside rc_MasterFormlist. i = InitVanillaArmors() ;<----This function is meant to fill entries inside a specified Formlist found INSIDE rc_MasterFormlist. endif EndEvent int Function InitMasterFormlist() no need for that EndFunction int Function InitVanillaArmors() int i i = AddNewArmor(ArmorBanditCuirass) endFunction int Function AddNewArmor(Armor mArmor) rc_Formlist = rc_MasterFormlist.GetAt(mFormlistCount) as Formlist rc_Formlist.AddForm(mArmor) mFormlistCount += 1 return 1 EndFunction you want to give what's in a random list to a npc? there's only one in the save, and all sslactoralias use that one formlist rc_formlisteuh = game.GetFormFromFile(xxxxxx, "esp.esp") rc_mastereuh = rc_formlisteuh as rc_master int random = randomint(0,rc_mastereuh.mformlistcount) ;not sure it's that the random int max = rc_mastereuh.rc_masterformlist[random].getsize() as int Int i = 0 while i < max add=rc_mastereuh.rc_masterformlist.Getat(i) as armor actor.additem(add) actor.equipitem(add) i += 1 endWhile
KicklerOfButts Posted September 28, 2017 Author Posted September 28, 2017 if it's not in the load order, it's not in the load order why do you want to put that stuff in the record of an esp anyway? -snip- you want to give what's in a random list to a npc? there's only one in the save, and all sslactoralias use that one formlist rc_formlisteuh = game.GetFormFromFile(xxxxxx, "esp.esp") rc_mastereuh = rc_formlisteuh as rc_master int random = randomint(0,rc_mastereuh.mformlistcount) ;not sure it's that the random int max = rc_mastereuh.rc_masterformlist[random].getsize() as int Int i = 0 while i < max add=rc_mastereuh.rc_masterformlist.Getat(i) as armor actor.additem(add) actor.equipitem(add) i += 1 endWhile Uh dude, I don't know what save you're looking at there, but it ain't my stuff. I think you got topics mixed up or something. I'm not adding anything to any actors, I'm just trying to Initialize a custom empty formlist and add it to another formlist I have. It doesn't seem to work unless the empty formlist is propertied to a pre-made CK formlist, that's my issue.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.