Add item to a leveled list via a script

Post » Mon Jun 18, 2012 10:26 pm

so we just resign and it doesnt work?
gah...
so much to conflict free item mods on lvl lists :obliviongate:
User avatar
N3T4
 
Posts: 3428
Joined: Wed Aug 08, 2007 8:36 pm

Post » Mon Jun 18, 2012 9:59 am

Hey jaysus2,

I too have been bit by the AddForm... I have consistent CTDs on SAVING GAME of all things, how do you like them apples. It seems that the game has a problem with adding more than one ref to one leveled list per script (??)

And, joy oh joy, even if I save successfully, I cannot reload (just like you).

One thing I avoided is the duplication issue like the one you described, by running my update scripts OnUpdate instead of OnInit. Not that it helps much, when the save/load is hosed.
User avatar
Avril Churchill
 
Posts: 3455
Joined: Wed Aug 09, 2006 10:00 am

Post » Mon Jun 18, 2012 10:42 pm

Wish could help on this as getting this to work would seem to be important for mod'n in the future, but keep running into things tht worked nice in FO3/FMV and just don't seem to work here .. the magic has changed and so far have not found it. Seems like tho make the thing work it would have to run everytime the game starts and not just once, placing things over and over again everytime the player starts the game or loads saves .. of course still may not fix the CTD. Hope you keep at this and be nice if someone from Bethesda chimed in ... ah have you posted this over in the Bug thread?? they are trying to collect everything that doesn't work

good luck
User avatar
Samantha Pattison
 
Posts: 3407
Joined: Sat Oct 28, 2006 8:19 pm

Post » Mon Jun 18, 2012 7:29 pm

Yeah... Maturin, would you please be http://www.darktowercompendium.com/guardians-turtle.html and help us?
User avatar
butterfly
 
Posts: 3467
Joined: Wed Aug 16, 2006 8:20 pm

Post » Mon Jun 18, 2012 9:44 pm

@more than one line of AddForm
doesnt matter, the bug appears right away even if you only use one line of AddForm (i only tested with one mainly to find the source of the bug)

@double quest
i had "start game enabled" checked which resulted in the script running twice

i guess the devs didnt use that command, might need it for a DLC but for the main skyrim esm they didnt need it... i could be wrong tho but that could explain why noone realized it doesnt work
User avatar
noa zarfati
 
Posts: 3410
Joined: Sun Apr 15, 2007 5:54 am

Post » Mon Jun 18, 2012 8:13 pm

damn it worked so awesomly well in fallout arrrr XD
User avatar
WYatt REed
 
Posts: 3409
Joined: Mon Jun 18, 2007 3:06 pm

Post » Mon Jun 18, 2012 2:50 pm

after dwelling in the CK wiki a bit more i get the idea that it might have something to do with how Papyrus handles the relation between savegames and script functions, the wiki page about it is quite mesmerizing lol, i dont quite got what it all meat from a first read and one would probably know how in comparision the old engine handled savegames but i guess thats where we gotta look, maybe, if it is due to that problem we can somehow store the info elseweyr, in a quest, global or somin and recall it on each load to go around the problem

http://www.creationkit.com/Save_File_Notes_%28Papyrus%29
User avatar
Celestine Stardust
 
Posts: 3390
Joined: Fri Dec 01, 2006 11:22 pm

Post » Mon Jun 18, 2012 4:10 pm

No word from the friendly neighbourhood developers on this?
User avatar
Nichola Haynes
 
Posts: 3457
Joined: Tue Aug 01, 2006 4:54 pm

Post » Mon Jun 18, 2012 8:42 pm

doesnt seem so :D
the new patch probably doesnt fix it either... didnt test it yet, from what i heard its truly a beta as in "one day skyrim wont ctd when you use it"

lets simply make plugins that require wrye bash... i at least waited long enough (imo) for the CK just to not have it working anyway... would i have known id have done the "dirty" lvl list mods a lot earlier

its just a pity as it worked so damn well in fallout, was easy to do and as effective as it could be...

and actually pre CK i used a console bat script that worked like a charm, didnt lead to CTD or somin weird like AddForm, however the command i used "AddFormToLeveledList" seems to only work inside the console and you need the explicit itemids which is impossible due to load order sheningans and hence needs mod users to modify it and adapt the script to suit them, i had maybe 5 users who understood what they had to do out of 100.000 :D, and thats understandable, i bet even less would have bothered if i would have added as many different lists as i do atm the dirty way
User avatar
chinadoll
 
Posts: 3401
Joined: Tue Aug 22, 2006 5:09 am

Post » Mon Jun 18, 2012 7:35 pm

If I’m understanding you correctly, you’re trying to add items to a leveled list (and complete your quest) in the OnInit event of a script attached to that quest. OnInit is run when your script is set up which, for quests, is as the game is starting up. If the quest can run more than once, then your script will reset itself and re-run the OnInit event (because everything has been reset) once the quest starts (see the http://www.creationkit.com/OnInit#Notes).

In your case, since your quest is flagged to start when the game does, you are re-running when the quest actually starts up. That’s probably why you’re getting two message boxes.

The other issues you are seeing is probably because you’re doing all your work in OnInit which may be too early. I would suggest that what you do is to keep your quest as starting up when the game does, add a stage to the quest, flag the stage as the startup stage, and put your script to add items to the list inside the stage fragment, or a function that your stage fragment calls.

That way your code will only run once, and it will run once the game is actually ready to accept your changes.

OnInit is intended to be used to do any additional setup your script needs within itself (like performing math on some properties, filling variables, or talking to other scripts), but not to be a place where you manipulate the game world.
User avatar
Chris BEvan
 
Posts: 3359
Joined: Mon Jul 02, 2007 4:40 pm

Post » Mon Jun 18, 2012 4:04 pm

If I’m understanding you correctly, you’re trying to add items to a leveled list (and complete your quest) in the OnInit event of a script attached to that quest. OnInit is run when your script is set up which, for quests, is as the game is starting up. If the quest can run more than once, then your script will reset itself and re-run the OnInit event (because everything has been reset) once the quest starts (see the http://www.creationkit.com/OnInit#Notes).

In your case, since your quest is flagged to start when the game does, you are re-running when the quest actually starts up. That’s probably why you’re getting two message boxes.

The other issues you are seeing is probably because you’re doing all your work in OnInit which may be too early. I would suggest that what you do is to keep your quest as starting up when the game does, add a stage to the quest, flag the stage as the startup stage, and put your script to add items to the list inside the stage fragment, or a function that your stage fragment calls.

That way your code will only run once, and it will run once the game is actually ready to accept your changes.

OnInit is intended to be used to do any additional setup your script needs within itself (like performing math on some properties, filling variables, or talking to other scripts), but not to be a place where you manipulate the game world.

SmkViper,

Thanks for that. Now I have a counter-question.

I got around the "duplication" issue by putting a "RegisterForSingleupdate" into the OnInit block. Then in the OnUpdate(60) block I actually put the items into leveled lists.

It works, at least insofar that I see the new items appear in the shopkeeper's inventory.

However, when I try to save the game, Skyrim instantly CTDs. I'm pretty sure I wait long enough for the game to get in gear (60 seconds). What gives?
User avatar
Chica Cheve
 
Posts: 3411
Joined: Sun Aug 27, 2006 10:42 pm

Post » Mon Jun 18, 2012 7:01 pm

I don’t know why the game would crash in that situation, unfortunately leveled lists and the save game system are outside my field of expertise. I can only suggest the basic steps that you would go through to debug any problem:
  • Is there any warnings or errors in the logs?
  • Does it still happen if you do everything except add the item to the list?
  • Does it happen if you modify the list in the editor directly rather than using a script?
  • Does it happen if you add something different to the list, or add it to a different list?
  • Does it happen from a completely new game?
That might help you narrow down exactly what it is that’s causing the problem, but I’m not going to be of any further help, sorry.
User avatar
Natalie J Webster
 
Posts: 3488
Joined: Tue Jul 25, 2006 1:35 pm

Post » Tue Jun 19, 2012 12:22 am

I added items to a custom created leveled list with no loss in stability on saving/loading. What I noticed though is that when you load a save where you have added items to the leveled list, the changes are reverted to the original. I checked the 'use all' box, so in my case there is no random choice of equipment.

My bet is that while the changes in the list are not saved, those same changes are saved in the part of the internal code that calculate randomly which items to assign from the list (maybe the list change is mantained in the function, while the version of the same data the random native code uses doesn't?). This way, as both lists didn't match the program crashes to the desktop.

As an example, if the list is composed of apple, fish. Sword is added. the list contains apple, fish, sword. The random selector contains the same list. Save/load. The list contains apple and fish. The random selector appel, fish and sword. no matching, CTD.
User avatar
Khamaji Taylor
 
Posts: 3437
Joined: Sun Jul 29, 2007 6:15 am

Post » Mon Jun 18, 2012 10:55 am

OK, I figured out why the crash-on-save was happening. Apparently if you add an item to 2 different LLs and the merchant has access to both of the LLs, the game will crash on SAVE.

Now I can save games, but have the same issue as Jaysus:

- FIrst time I load a game, script runs and adds the new items to LLs correctly - they appear in the merchant's inventory.
- I save successfully.
- I then try to load the new save and CTD immediately.
- I re-launch Skyrim, load from the same save I CTD'd on (it is created and is valid, despite the CTD), and the items are NOT in the merchant's inventory.

Answers to Questions:


Is there any warnings or errors in the logs? - No
Does it still happen if you do everything except add the item to the list? - No, it does not
Does it happen if you modify the list in the editor directly rather than using a script? - No, it does not
Does it happen if you add something different to the list, or add it to a different list? - Yes, no matter what I add or what list I add it to via a script, CTD happens
Does it happen from a completely new game? - Yes.
User avatar
Lauren Dale
 
Posts: 3491
Joined: Tue Jul 04, 2006 8:57 am

Post » Mon Jun 18, 2012 8:47 pm


- FIrst time I load a game, script runs and adds the new items to LLs correctly - they appear in the merchant's inventory.
- I save successfully.
- I then try to load the new save and CTD immediately.
- I re-launch Skyrim, load from the same save I CTD'd on (it is created and is valid, despite the CTD), and the items are NOT in the merchant's inventory.

Seing your post, it seems it has something to do with the infomous problem where some values are not reseted when you load a saved game without first exiting the game. I didn't have this problem though. So, it seem the list is reseted when you load the save, while the copy of the list on the random selector persist until you exit the game. In theory neither of them should reset at all in any of the two cases.
User avatar
QuinDINGDONGcey
 
Posts: 3369
Joined: Mon Jul 23, 2007 4:11 pm

Post » Mon Jun 18, 2012 3:41 pm

@OnInit
tried adding the whole script to a book which you got to read, hence used OnRead instead of OnIniti in this try cause OnIninit seemes rather vague to me too...
in the end i had the very same savegame related CTD and ruled OnInit out, hence after some toying around and removing or replacing parts of the script with conditions and whatnot came to the conclusion that AddForm was all that is left to produce the bug we experience

and yes i can confirm that it doesnt matter what you add to what with AddForm (lvl item... not sure bout the others), added items to lists and lists to lists, etc

adding a timer or stage as suggested by SmKViper is a good idea nevertheless btw, otherwise we get that annoying "messagebox/quest started/DLC installed" spam we got in fallout... i gotta wait like 2mins and click a dozen boxes before i can play lol, and it might clog the papyrus engine, not sure how it prioritizes tasks but i assume right at game start a whole bunch of stuff is running that could get confusing for young papyrus :happy:
User avatar
Josephine Gowing
 
Posts: 3545
Joined: Fri Jun 30, 2006 12:41 pm

Post » Mon Jun 18, 2012 9:57 pm

Starting to sound like a broken record here, but have the devs taken a stab at it at all? I'm pretty sure that the bug should be easily reproducible... Help us, oh mighty ones...
User avatar
Inol Wakhid
 
Posts: 3403
Joined: Wed Jun 27, 2007 5:47 am

Previous

Return to V - Skyrim