Jump to content

AddFormToFormList fails silently


Belthan

Recommended Posts

I apologize in advance if this is an etiquette breach. I already posted this in Nexus Site Forums -> F3 -> Mod Troubleshooting, but I get the impression that forum is more for users troubleshooting mods than mod authors troubleshooting mods. Anyway, here's the question:

 

If I add a new item to a form list in GECK, it works fine, but I'm trying to add it in a script to avoid incompatibility with other mods. (I'm sure I'm not the first modder to shoot new stuff through the RockIt Launcher). So, I created a quest called belthanInitialization and gave it the quest script below. The final script obviously won't have ShowMessage in it, I just did that to figure out why it wasn't working. I think there's a clue here, but I'm not sure what it means.

 

If I do this:

scn belthanInitializationSCRIPT
begin GameMode
       ShowMessage belthanMessageDebug1
       AddFormToFormList RockItLauncherAmmo belthanHorseshoe
       ShowMessage belthanMessageDebug2
       stopquest belthanInitialization
       ShowMessage belthanMessageDebug3
end

 

Only message 1 is displayed, horseshoes can't be used in RockIt Launcher, and the quest does not stop so message 1 keeps displaying every 5 seconds.

 

If I do this:

 

scn belthanInitializationSCRIPT
begin GameMode
       ShowMessage belthanMessageDebug1
       stopquest belthanInitialization
       ShowMessage belthanMessageDebug2
       AddFormToFormList RockItLauncherAmmo belthanHorseshoe
       ShowMessage belthanMessageDebug3
end

 

Messages 1 & 2 display once, quest stops, message 3 does not display and I still can't use horseshoes in the RockIt Launcher.

 

I get the same exact symptoms using AddItemToLeveledList to add horseshoes to clutter lists so they show up randomly in containers.

 

And finally, if I try to do something similar with an object script, it goes into a very tight infinite loop on Message 1 (presumably because quest scripts process every 5 seconds but there is no delay when the game tries to re-run an object script that terminated abnormally).

 

Any ideas?

Edited by Belthan
Link to comment
Share on other sites

Object scripts never terminate. They run every frame while the cell that they are in is loaded. So if you want something done once, use a variable to guard it.

 

In your quest scripts, when you give the StopQuest command, the rest of the GameMode block normally runs. But the showmessage is interrupting that with menumode frames.

 

Comment out the ShowMessages, and If you want to verify that the item was added to the list, just go to the console:

 

player.additem RockItLauncherAmmo 1 <enter>

 

and one of everything in the list will be added to your inventory.

 

If you have FOSE, it's better to make debug messages print at the console, with Printc, so as not to interfere with your script.

 

scn belthanInitializationSCRIPT

short Stage
short Index

;quest script
begin GameMode

if Stage == 0
   	Printc "Init Started"
   	AddFormToFormList RockItLauncherAmmo belthanHorseshoe
	Printc "Item added to list" 
	set Stage to 1
elseif Stage == 1
	set Stage to 2
	set Index to ListGetFormIndex RockItLauncherAmmo belthanHorseshoe
	if Index == -1
		Printc "Item is not in list!"
	else
		Printc "Verified Item is in list"
	endif
   	stopquest belthanInitialization
	Printc "Quest Stopped"
endif

end

Link to comment
Share on other sites

Thanks for the reply. Took your advice about ShowMessage and went minimalist as follows.

 

scn belthanInitializationSCRIPT

short debug

begin GameMode

set debug to 1
AddFormToFormList RockItLauncherAmmo belthanHorseshoe
set debug to 2
stopquest belthanInitializationSCRIPT
set debug to 3

end

 

I go into the game, wait at least 10 seconds, type ShowQuestVars at the console, ScriptRunning = Yes, debug = 1. So it looks like AddFormToFormList is still failing silently and the code after it doesn't run. But the plot thickens. Still in game console, select a horseshoe ref, IsInList returns 0 (as expected, given the previous). Used AddFormToFormList at the console and got "Script command not found". The script compiles so it doesn't seem like a GECK problem (doc says command added in 1.1.0.36, I'm using 1.5.0.19), but is the command unsupported in some versions of the game itself? That seems unlikely too, since this is the method Bethsoft intended to be used for DLC.

Link to comment
Share on other sites

Not all script functions work at the console.

 

Just to cover the basics - belthanHorseshoe is an base object, not a ref name of the object placed in the editor, right?

 

For some reason the script is halting on that function. I've seen people do the very same thing and it works. I've done it too.

 

Be sure to also try a clean save, especially if you have changed variables in the script, etc.

Link to comment
Share on other sites

Yep, that's why I'm baffled. belthanHorseshoe is a base object. Went through and gave all references unique names so the base object name is unambiguous. Started a new game just to be sure, same results. Everything I've read says this should work.
Link to comment
Share on other sites

Used AddFormToFormList at the console and got "Script command not found".

 

There is something else going wrong in your game. I loaded up Fallout 3 and tried in the console to add the Big Book of Science to the RockItLauncherAmmo formlist and it worked just fine.

 

For reference, in the console I typed:

addformtoformlist 6b20d 3403c

 

When I pressed enter the console just went to the next line. However prior to doing this I checked if I could load the Big Book of Science into the RockIt launcher (I couldn't), and after entering the command and exiting the console I could now load the book into the RockIt launcher and fire it.

 

In this particular case, get it to work in the console and then your script should work.

Link to comment
Share on other sites

If you are using the script extender try using ListAddForminstead. An important thing to note is that the change that ListAddForm makes does not persist in a saved game, so the command must be issued each time the game is loaded inside a GetGameLoaded block.
Link to comment
Share on other sites

I seem to recall some oddities long ago with ammo FLSTs and AddFormToFormList. It was nVamp and Light My Flare if I recall correctly. Consensus was to edit the FLSTs directly rather than by script.

 

EDIT: Yes I know it is about FO3 not FNV, but it is so very similiar.

Edited by blove
Link to comment
Share on other sites

  • 2 weeks later...

I seem to recall some oddities long ago with ammo FLSTs and AddFormToFormList. It was nVamp and Light My Flare if I recall correctly. Consensus was to edit the FLSTs directly rather than by script.

 

EDIT: Yes I know it is about FO3 not FNV, but it is so very similiar.

 

That issue is caused by the fact that AddFormToFormList adds the new form at index 0 and bumps the rest of the list up one index. Ammo lists should always have the default ammo at index 0, so NVSE's ListAddForm (which appends to the end of a form list instead of the beginning) is the command to use. Editing the lists directly adds the requirement for the end-user to create a merged patch when multiple mods edit the same list, and a very small percentage of users even know what that means.

 

 

In my scripts, I never use AddFormToFormList and use the FOSE/NVSE functions instead.

Link to comment
Share on other sites

  • 2 months later...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...