modify formlists without overwriting them

Post » Sun Jul 25, 2010 9:05 pm

The problem I have with a lot of ammo mods and similar things is that they are all incompatible with eachother. The reason is that they completely overwrite the ammo formlists for weapons instead of adding their ammo to them. There has to be a way around that.

So, what I want to be able to do is add stuff to existing formlists without overwriting them. I know there is a way to add stuff to formlists via script. It seems to me that this would be the solution. So, my question is, how do I get the script to run to accomplish this? Or is there a different solution?
User avatar
Robert Jackson
 
Posts: 3385
Joined: Tue Nov 20, 2007 12:39 am

Post » Sun Jul 25, 2010 4:01 pm

http://geck.gamesas.com/index.php/AddFormToFormList

You might want to use NVSE, though. AddFormToFormlists adds the newest entry at index 0... the index of the formlist determines the order the ammo displays in. So say you add an explosive round with AddFormToFormlist. it'll be that form list's index 0... which means that will be the default ammo when switch to guns using that list.

NVSE has http://geck.gamesas.com/index.php/ListAddForm which adds to the END of the list, or whatever index you want.
User avatar
lucy chadwick
 
Posts: 3412
Joined: Mon Jul 10, 2006 2:43 am

Post » Sun Jul 25, 2010 12:30 pm

The problem I have with a lot of ammo mods and similar things is that they are all incompatible with eachother. The reason is that they completely overwrite the ammo formlists for weapons instead of adding their ammo to them. There has to be a way around that.

So, what I want to be able to do is add stuff to existing formlists without overwriting them. I know there is a way to add stuff to formlists via script. It seems to me that this would be the solution. So, my question is, how do I get the script to run to accomplish this? Or is there a different solution?


Quest script that uses "AddFormToFormList" (seen here: http://geck.gamesas.com/index.php/AddFormToFormList ) You can stop the quest after the script runs.

Edit: Or what Pinto said above. Apparently we were replying about the same time : )
User avatar
Sun of Sammy
 
Posts: 3442
Joined: Mon Oct 22, 2007 3:38 pm

Post » Mon Jul 26, 2010 2:37 am

FNVEdit can merge any alterations to a formlist in a master into one single cohesive file.

AddItemToLeveledList makes the list persist in the savegame, and any mod-added items in that list will become Null entries if the mod is deactivated.

List merging with a mod utility is just cleaner.
User avatar
Flash
 
Posts: 3541
Joined: Fri Oct 13, 2006 3:24 pm

Post » Sun Jul 25, 2010 4:16 pm

You can use AddFormToFormList (or other form list editing functions), sure, but be aware that it doesn't persist between saved games - your form list will reset to default upon closing the game and starting it up again, though it'll remain as-is if you just load a game from within the game. Form list data apparently isn't saved with the saved game.
User avatar
flora
 
Posts: 3479
Joined: Fri Jun 23, 2006 1:48 am

Post » Sun Jul 25, 2010 2:13 pm

Quest script that uses "AddFormToFormList" (seen here: http://geck.gamesas.com/index.php/AddFormToFormList ) You can stop the quest after the script runs.



Is there a way to get the quest script to run silently and run every time a game is loaded?


FNVEdit can merge any alterations to a formlist in a master into one single cohesive file.

AddItemToLeveledList makes the list persist in the savegame, and any mod-added items in that list will become Null entries if the mod is deactivated.


As stated in the original post, the idea is to make completely separate, independent mods that modify formlists to be compatible with eachother. So, I have no intention of combining lists ahead of time like this. AddItemToLeveledList seems to be just for modifying LeveledItems. Can I just pass it the name of a formlist instead of a leveleditem? Otherwise, I don't understand how I would use this for modifying formlists.
User avatar
evelina c
 
Posts: 3377
Joined: Tue Dec 19, 2006 4:28 pm

Post » Mon Jul 26, 2010 4:20 am

The vanilla functions AddXtoY persist in the savegame. It's the NVSE functions that don't persist over game loads, however NVSE also adds the GetGameLoaded function.
User avatar
Janeth Valenzuela Castelo
 
Posts: 3411
Joined: Wed Jun 21, 2006 3:03 am

Post » Mon Jul 26, 2010 12:40 am

If I update a mod to add more items, I would obviously want to add the new items, but I wouldn't want to add duplicates of the items already there. What happens if one uses AddFormtoFormlist to add a form to a formlist when the form already exists in the formlist? Duplicate entry? Script error? I know you can detect with IsInList, but I want to know if it's necessary to check.
User avatar
Naazhe Perezz
 
Posts: 3393
Joined: Sat Aug 19, 2006 6:14 am

Post » Mon Jul 26, 2010 3:43 am

The vanilla functions AddXtoY persist in the savegame. It's the NVSE functions that don't persist over game loads, however NVSE also adds the GetGameLoaded function.


I'm pretty sure I tested AddFormToFormList specifically and it still didn't persist in saved games, but I may be misremembering.

GetGameLoaded also does not work in NVSE - it currently works like GetGameStarted or whatever (only running once per game session).

AddFormToFormList will allow you to add duplicate items to the list.
User avatar
Mel E
 
Posts: 3354
Joined: Mon Apr 09, 2007 11:23 pm

Post » Sun Jul 25, 2010 8:21 pm

So, if I have this right, what I need to do is create a quest and quest script. I leave everything at default for the Quest itself. The quest script will have a GameMode block which checks the formlists and adds any missing items via AddFormToFormList, then runs a QuestStop command so it only runs once (rather than running every 5 seconds or whatever).

If that is all I do, will it run every time a game is loaded, even if it was run in a previous session? Will there be a quest entry in the quest list, and if so, what would it look like?
User avatar
Rachel Briere
 
Posts: 3438
Joined: Thu Dec 28, 2006 9:09 am

Post » Mon Jul 26, 2010 2:59 am

So, if I have this right, what I need to do is create a quest and quest script. I leave everything at default for the Quest itself. The quest script will have a GameMode block which checks the formlists and adds any missing items via AddFormToFormList, then runs a QuestStop command so it only runs once (rather than running every 5 seconds or whatever).

If that is all I do, will it run every time a game is loaded, even if it was run in a previous session? Will there be a quest entry in the quest list, and if so, what would it look like?


No, it'll run only once. There will be no quest entry in the quest list.
User avatar
Alina loves Alexandra
 
Posts: 3456
Joined: Mon Jan 01, 2007 7:55 pm

Post » Sun Jul 25, 2010 1:49 pm

Is there a way to get it to run on game load every game load, but only once each time? The only thing I can think of for that is to set the script delay to something obscenely high. If I do it that way, will it only run after the delay has passed, or would it run immediately, then wait for the delay?
User avatar
Daramis McGee
 
Posts: 3378
Joined: Mon Sep 03, 2007 10:47 am

Post » Sun Jul 25, 2010 9:57 pm

You should be able to use NVSE's GetGameLoaded, except that doesn't work properly. At the moment, there's no way to do it.
User avatar
Louise
 
Posts: 3407
Joined: Wed Nov 01, 2006 1:06 pm

Post » Sun Jul 25, 2010 5:35 pm

I'm pretty sure I tested AddFormToFormList specifically and it still didn't persist in saved games, but I may be misremembering.
Unless they broke it between F3 and NV, it's pretty unlikely- it was designed specifically to permanently add items from DLC to lists, and I've used it extensively to do the same, so...

If GetGameLoaded isn't working it's easy to fake- use a non-saved-in-the-save-file command like SetWeight on a misc item you add. If GetWeight returns the original weight of the item, the game's been loaded and the item has reverted to its old stats. Say for a dummy item with weight 0:
begin gamemodeif(getWeight DummyItem)else   setWeight 1 DummyItem   ;GAME HAS BEEN RELOADEDendifend

User avatar
Unstoppable Judge
 
Posts: 3337
Joined: Sat Jul 29, 2006 11:22 pm

Post » Mon Jul 26, 2010 1:07 am

Using a constant global should work, too. Set it to 1 by default, then
if gameReloaded == 0 returnendifset gameReloaded to 0; Your onReload code here

User avatar
Bee Baby
 
Posts: 3450
Joined: Sun Jun 18, 2006 4:47 am

Post » Mon Jul 26, 2010 3:25 am

If I add an item, can I make it not visible in the player's inventory?

If I set a constant like Schlangster said, IE a "RunOnce" variable, will the new value of that variable persist between executions of the script? Will it persist after loading a save?

If I set the Quest to have some set delay in the Quest dialog in GECK, then change it in script via SetQuestDelay, will the new quest delay persist after loading a save? If so, will the quest script immediately execute on game load, then wait for the delay, or will it wait for the remainder of the delay since game was saved?
User avatar
Rebecca Clare Smith
 
Posts: 3508
Joined: Fri Aug 04, 2006 4:13 pm

Post » Sun Jul 25, 2010 3:38 pm

If I add an item, can I make it not visible in the player's inventory?

If I set a constant like Schlangster said, IE a "RunOnce" variable, will the new value of that variable persist between executions of the script? Will it persist after loading a save?

If I set the Quest to have some set delay in the Quest dialog in GECK, then change it in script via SetQuestDelay, will the new quest delay persist after loading a save? If so, will the quest script immediately execute on game load, then wait for the delay, or will it wait for the remainder of the delay since game was saved?


The answer to all of these questions is 'yes', though I'm unsure how the Quest Delay bit works. To make an item non-visible in the player's inventory, make it an armor, weapon, or ammo item with the 'playable' flag unticked..
User avatar
BethanyRhain
 
Posts: 3434
Joined: Wed Oct 11, 2006 9:50 am

Post » Sun Jul 25, 2010 10:34 pm

It seems then that a RunOnce variable would make no sense. If it persists between saves, then I might as well just do a StopQuest. If forms added to formlists persist between saves, then that's perfectly OK, and that will be the method I'll use to achieve this.

The only issue I have now is, how do I make it possible to update (IE: add new forms), and have the new forms added assuming I use the above method? If the quest is stopped, surely I could not run it again. So, would I need to make a new quest for each update?
User avatar
Romy Welsch
 
Posts: 3329
Joined: Wed Apr 25, 2007 10:36 pm

Post » Sun Jul 25, 2010 10:42 pm

It seems then that a RunOnce variable would make no sense. If it persists between saves, then I might as well just do a StopQuest. If forms added to formlists persist between saves, then that's perfectly OK, and that will be the method I'll use to achieve this.

The only issue I have now is, how do I make it possible to update (IE: add new forms), and have the new forms added assuming I use the above method? If the quest is stopped, surely I could not run it again. So, would I need to make a new quest for each update?


You can do a IsInList check to see if the form you want to add is in the form list already, then add it if it isn't. That's probably the way you'd want to do it, since AddFormToFormList will change the default ammo of weapons. Use If (IsInList) -> ListAddForm to do it instead - this'll neatly get around the non-persistence through saved games problem, too.
User avatar
Trevor Bostwick
 
Posts: 3393
Joined: Tue Sep 25, 2007 10:51 am

Post » Sun Jul 25, 2010 3:29 pm

I know how to check for forms being in formlists. The issue I have is, if I use the aforementioned method of stopping the quest, then the script won't run again. If I update the mod, then I need it to run again. So, what is the best way to do that?

Is there a way to edit the existing quest so that the game recognizes it as a new quest? Would renaming it do it, or would I have to delete it and create a new one entirely?
User avatar
Vickytoria Vasquez
 
Posts: 3456
Joined: Thu Aug 31, 2006 7:06 pm

Post » Mon Jul 26, 2010 1:27 am

I know how to check for forms being in formlists. The issue I have is, if I use the aforementioned method of stopping the quest, then the script won't run again. If I update the mod, then I need it to run again. So, what is the best way to do that?

Is there a way to edit the existing quest so that the game recognizes it as a new quest? Would renaming it do it, or would I have to delete it and create a new one entirely?


You'd probably need to change the FormID. Anyways, if you do IsInList, you don't need to stop the quest, which is why I suggested it - it'll work even if the form list isn't saved, such as if you use ListAddForm instead of AddFormToFormList (if AddFormToFormList makes the form list persistent), and you should be using ListAddForm anyways since you don't want to modify the default ammo.
User avatar
maria Dwyer
 
Posts: 3422
Joined: Sat Jan 27, 2007 11:24 am

Post » Sun Jul 25, 2010 6:41 pm

I just had another idea. I could make a FormList named after my mod as well as a "UpdateVersionGoesHere" form. In GameMode, check to see if the update form is in the mod formlist. If not, add it and do updates. If not, do nothing. This would get around needing to put invisible items in player inventories, then do things to those items that may or may not persist to the next game load.

The beauty of this method is that if I use the same method to modify the mod formlist as I do to modify the others, then save persistence won't matter. If it doesn't persist, then it gets added the next time the game is loaded, which is what I want. If it does persist, then it will already be there when I check, and nothing will be done, which is exactly what I want.

My only real concern about stopping the quest is that I'd prefer to avoid adding things that may cause load issues. A single if statement in a quest script running every now and then probably won't do much, but I'm not sure how costly IsInList is.
User avatar
sam smith
 
Posts: 3386
Joined: Sun Aug 05, 2007 3:55 am

Post » Sun Jul 25, 2010 7:44 pm

I'm pretty sure I tested AddFormToFormList specifically and it still didn't persist in saved games, but I may be misremembering.



It's persistent. Just tested it. (Closed game out completely and restarted it). NVSE/FOSE "ListAddForm" isn't. Tested it too. (Same way. Load game, save game, close completely out of game and restart from FOMM).
User avatar
Adrian Powers
 
Posts: 3368
Joined: Fri Oct 26, 2007 4:44 pm


Return to Fallout: New Vegas