Fallout New Vegas
0 of 0

File information

Last updated

Original upload

Created by

jazzisparis

Uploaded by

Eddoursul

Virus scan

Safe to use

About this mod

Initialize mods without running quests, GetGameRestarted, or MenuMode 4.

Requirements
Permissions and credits
This mod showcases soon-to-be-documented JIP LN NVSE script runner. This feature is already included and enabled in JIP LN NVSE, and can be used right now.

Instead of running init quests in Menu Mode 4 or GameMode, you can add event listeners via batch files. JIP LN NVSE scans the directory
Data\nvse\plugins\scripts
and runs files with certain prefixes on the following events:

  • gr_*.txt on game start,
  • gl_*.txt on game load,
  • gs_*.txt on game save,
  • gx_*.txt on game exit,
  • xm_*.txt on exit to the main menu.

Seems like they share scripting abilities with RunBatchScript, meaning local variables and if/else support.

What's the catch?

These files are executed in the console environment, hence no resolution of Editor IDs by default, only Form IDs are allowed. There are a few ways to circumvent this.

Method one - use JohnnyGuitar NVSE with bLoadEditorIDs=1.

This method implies, that your mod already depends on JohnnyGuitar NVSE and contains explicit instructions for users to keep bLoadEditorIDs enabled. With JG, you can run scripts by their Editor IDs. Running them directly call MyEditorID is not very reliable by my tests, but RunScript works fine:

RunScript "MyEditorID"
or
ref rUDF
set rUDF to EditorIDToFormID "MyEditorID"
call rUDF

Method two - determine your mod's index, using a global variable, build reference variable for your UDF with BuildRef and run it.

int i
ref rUDF
set i to GetSourceModIndex AutorunDemoGlobal
set rUDF to BuildRef i 5719
call rUDF


In this method, we utilize availability of global variables in the console.

  • Create one constant global variable in your mod with any value and replace AutorunDemoGlobal with it.
  • Now we need Form ID of your user defined function in decimal representation. Open FNVEdit, you'll see something like this 00004240 - the first two symbols are load-order-dependent mod index, last six are the form ID of your UDF. We need the latter. Paste them into any hex-to-dec convertor, for instance, this one, and get a number. Insert it in place of 5719 in the example.

Done, you can now use all NVSE features. A potential disadvantage here is the possibility of Form ID renumbering during mod merging.

In the Files tab, download the working example of this method.

Method three - use GetFormFromMod for vanilla and unmergeable mods.

If you want to modify only vanilla items or know for sure, that no one in their right mind will merge the target mod, then literal Form IDs for FalloutNV.esm, GetFormFromMod and StringToRef for others are perfectly fine. Let's remove the quest flag from Rocket Souvenir:

SetFlagsLow 0 "0008E665"

Or make Stealth Suit Mk II a light armor:

ref rArmor
set rArmor to GetFormFromMod "OldWorldBlues.esm" "C12F"
SetArmorClass rArmor 1
SetWeight 17 rArmor
SetArmorAR 9 rArmor


Easy road - declare your mod unmergeable.

ref rUDF
set rUDF to GetFormFromMod "MyCoolMod.esp" "800"
call rUDF

or
ref rOnDrink
set rOnDrink to GetFormFromMod "MyCoolMod.esp" "800"
SetOnUseAidItemEventHandler rOnDrink 1 "0005C365" ; AlchoholicDrinks