3aq Posted April 27, 2019 Share Posted April 27, 2019 (edited) so here's my scriptarmor[] property i auto Event OnEffectStart(Actor akTarget, Actor akCaster) int n = 0 while n < 127 if (i[n] != None) akTarget.AddItem(i[n]) endIf n += 1 endWhile endEvent so the goal of this script is to allow the user to add as many items (in this instance armor) into inventory. this script can be adopted for other things ofcourse. so hypothetically you can have upwards of 128 items listed to be added through a spell or some other interaction. I am unsure if it's problem due to scripting or the problem with the esp. alas, the script doesn't work -- I feel I have overlooked something. doing it without array (as seen below) works of course, but my goals is to adopt and push forward with cleaner/ more efficient scripting.input is appreciated, thank you. armor property ArmorToAdd01 auto armor property ArmorToAdd02 auto armor property ArmorToAdd03 auto ... Event OnEffectStart(Actor akTarget, Actor akCaster) if (ArmorToAdd01 != None) akTarget.AddItem(ArmorToAdd01) EndIf if (ArmorToAdd02 != None) akTarget.AddItem(ArmorToAdd02) EndIf if (ArmorToAdd03 != None) akTarget.AddItem(ArmorToAdd03) EndIf ... endEvent Edited April 27, 2019 by 3aq Link to comment Share on other sites More sharing options...
Reneer Posted April 27, 2019 Share Posted April 27, 2019 You (likely) need this in your code somewhere:i = new armor[128] Also, why not use a Formlist instead of an array? Link to comment Share on other sites More sharing options...
3aq Posted April 27, 2019 Author Share Posted April 27, 2019 (edited) generally because it's slower for larger lists in game from what I heard, but more importantly because with arrays I can easily make modifications through SSEEdit, formlist needs CK.. I don't want to touch CK if I can help it (5 minutes to load up, another 5 minutes to load the esp list). checked the i = new armor[128]inclusion/exclusion of it didn't have any effect. :confused: Edited April 27, 2019 by 3aq Link to comment Share on other sites More sharing options...
FrankFamily Posted April 27, 2019 Share Posted April 27, 2019 I think the script is correct, I don't see anything wrong with it anyway. You don't need to make an array with "new" if you have it defined as a property, that should work fine.I'd check if your array is properly filled with the armor forms.I'd also check that the effect is running on your intended target with a debug message right after OnEffectStart.You can also print the array itself, it will show the first elements so you can check if it's correctly filled.Basically put debug statements everywhere to see what is running and where the problem is. Link to comment Share on other sites More sharing options...
Reneer Posted April 27, 2019 Share Posted April 27, 2019 I think the script is correct, I don't see anything wrong with it anyway. You don't need to make an array with "new" if you have it defined as a property, that should work fine.I always forget you can do that. :tongue: I'd check if your array is properly filled with the armor forms. I'd also check that the effect is running on your intended target with a debug message right after OnEffectStart. You can also print the array itself, it will show the first elements so you can check if it's correctly filled. Basically put debug statements everywhere to see what is running and where the problem is.These are all excellent suggestions. Link to comment Share on other sites More sharing options...
Deleted3897072User Posted April 27, 2019 Share Posted April 27, 2019 As an aside, you can certainly edit formlists in SSEEdit 4.0.2 - I've just been doing it. Link to comment Share on other sites More sharing options...
3aq Posted April 27, 2019 Author Share Posted April 27, 2019 (edited) pics? :huh: -- seriously I don't know how that is why I ask. :happy: but really, I heard it gets messy dealing with FormList :mellow: or that's what esl'ing leads me to believe. Edited April 27, 2019 by 3aq Link to comment Share on other sites More sharing options...
Evangela Posted April 27, 2019 Share Posted April 27, 2019 (edited) Formlists have their advantages over arrays, as do arrays have over formlists. 1 thing I like about formlists: You can drag and drop into the list in the CK. You can't do this with arrays, since.. there's no physical list. Gotta add things 1 at a stinking time in an array property. As for as I'm aware, formlists are just slow, I mean 600 forms could take like 10 seconds I guess. Edited April 27, 2019 by Rasikko Link to comment Share on other sites More sharing options...
IsharaMeradin Posted April 28, 2019 Share Posted April 28, 2019 A formlist of 128 items is no slower than an array of 128 items. Formlists get slower only when containing more items. Formlist speed also depends on what you are doing with it. In your case, a formlist may be the better approach Formlist Property ArmorList Auto Event OnEffectStart(Actor akTarget, Actor akCaster) akTarget.AddItem(ArmorList,1) endEvent Since you were looping the array and adding the item if the entry was a non-none entry, then your intent is to add everything in the list. AddItem will add the designated amount of each entry in a formlist without having to cycle through each entry. This should actually be faster than using an array, at least in this context. Link to comment Share on other sites More sharing options...
Recommended Posts