Previous Thread: http://www.gamesas.com/topic/1482519-beta-new-vegas-script-extender-nvse-v4
The New Vegas Script Extender, or NVSE for short, is a modder's resource that expands the scripting capabilities of Fallout: NV. It does so without modifying the executable files on disk, so there are no permanent side effects.
Website: http://nvse.silverlock.org
Download (version 5.0 Beta 2): http://nvse.silverlock.org/download/nvse_5_0_beta2.7z- compatible with runtime 1.4.0.525 and editor 1.4.0.518, plus the German "no gore" version.
Check the documentation page at the GECK Wiki : http://geck.gamesas.com/index.php?title=Complete_List_of_Functions_in_NVSE
or this site : http://www.gribbleshnibit.com/projects/NVSEDocs/
Current Beta (NVSE 5.0 Beta 3) : http://nvse.silverlock.org/beta/nvse_5_0_beta3.7z
Beta changes:
5.0 Beta 03
Fixes:
The return type for GetModLocalData was set on SetModLocalData. Both are restored to their proper value.
HasVariable would return true when either parameter was invalid.
JIP (JazzIsParis) wrote a version of EquipItem2 that works for FNV.
Changes:
Added creature specific flags and template flags to ActorBaseData
Decoding from JIP's nvse plugin up to v21.00
Known issue:
SetScript on a loaded ref has no effect until the reference is reloaded.
SetScript on a BaseEffect will not be detected by an active effect.
RunScript is unreliable. It may fail to start, and will only run the first script block once, and then only if it is a GameMode block.
New:
GetCurrentQuestObjectiveTeleportLinks
returns an array of the path to the current objective targets
the path is an array of zero or more doors (called teleportLink) followed by the target itself.
Works only on the current objective of the current quest for the player, so no parameters required.
Will build the teleportLinks if needed, but activating the quest should have done that already.
Port of degree trig functions from OBSE
dSin, "Calculates the sin of a value in degrees"
dCos, "Calculates the cos of a value in degrees"
dTan, "Calculates the tan of a value in degrees"
dASin, "Calculates the arcsin of a value in degrees"
dACos, "Calculates the arccos of a value in degrees"
dATan, "Calculates the arctan of a value in degrees"
dATan2, "Calculates the arctan of two values in degrees"
dSinh, "Calculates the hyperbolic sin of a value in degrees"
dCosh, "Calculates the hyperbolic cos of a value in degrees"
dTanh, "Calculates the hyperbolic tan of a value in degrees"
Port of a subset of radian trig functions from OBSE
ATan2, "Calculates the arccos of two values in radians"
Sinh, "Calculates the hyperbolic sin of a value in radians"
Cosh, "Calculates the hyperbolic cos of a value in radians"
Tanh, "Calculates the hyperbolic tan of a value in radians"
5.0 Beta 02
This version adds support for the russian version (different steam appid)
Fixes:
ListClear could generate a CTD on save if forms were added through AdFormToFormList (but not with ListAddForm).
Still the handling of numAddedObjects is not 100% coherent. Should be looked into.
Get/SetActorBaseFlagsLow/High was operating on the wrong flags.
GetActorFIKstatus checks the FIK flag directly.
Changes to GetParentWorldspace broke it for some references. Corrected by merging the two methods.
Dispatching an unhanded user defined event from an event handler resulted in a CTD.
Changes:
IsPlayable supports TESRace also.
Ported from OBSE
HasEffectShader
let bool := ref.HasEffectShader anEffectShader
returns 1 if the reference is playing the effect shader
5.0 Beta 01
Version bumped to 5 because of a change in a plugin interface which did not have a version.
Before checking the NVSArrayVarInterface kVersion, make sure NVSE version is at least 5
Fixes:
bipedFlags in TESBipedModelForm restricted to a byte. Some armors seem to have uninitialized data in the higher bytes.
Known issue:
SetScript on a loaded ref has no effect until the reference is reloaded.
SetScript on a BaseEffect will not be detected by an active effect.
RunScript is unreliable. It may fail to start, and will only run the first script block once, and then only if it is a GameMode block.
EquipItem2 is broken in the sense that the item is equipped after EquipItem returns so which item is equipped is not detected So it is the same as EquipItem currently.
Changes:
Decoding from JIP's nvse plugin up to v8.0
NVSEArrayVarInterface:
added version. kVersion is 2.
added GetArrayPacked.
Returns if the array is packed (an array) or not (a map). Useful when accessing all arrays globally.
NVSEScriptInterface: did not have a version either, added at the same time.
added version. kVersion is 1.
New
GenericCheckForm:
Checks if said form is present in the list of form. (same encoding as the other GenericXXXForm functions)
let anIndex := GenericCheckForm whichEmbeddedList objectContainingTheEmbeddedList formToAdd
-1 means invalid parameters
-2 means not found
Anything positive (>=0) is the index
GetBit
Gets the value of a bit inside a bitmask
let aBool := GetBit bitmask bitIndex
bitmask is an integer.
bitIndex starts at 0 and should not be greater than 20. Higher values are unreliable and prone to conversion.
ar_Packed
Returns if the array is packed (an array) or not (a map). Useful when using an array_var defined in another plugin.
Previous changes :
4.6 Beta 04
Changes:
Decoding from JIP's nvse plugin up to v7.0
OnOpen/OnClose extended to container that weren't detected.
New
Get/SetEyesFlags
get or set the eyes flags.
let aTest := GetEyesFlags eyes [bitmask]
bitmask checks only the bit set. (see v2 beta 6 below for how to specify the flags)
SetEyesFlags eyes newFlags
Useful value for bitmask:
1 = playable ( = SetBit 0 0 )
2 = Not male ( = SetBit 0 1 )
4 = Not Female ( = SetBit 0 2 )
Get/SetHairFlags
get or set an hair flags.
Same syntax as Get/SetEyesFlags.
Another useful value for bitmask:
8 = Fixed ( = SetBit 0 3 )
Get/SetActorFIKstatus or Get/SetFIK
get or set the Foot IK status of an actor
requires to be called on a ref that is an actor
let aBool := anActor.GetActorFIKstatus
anActor.SetFIK 1
Changing FIK status can only happen in certain conditions that are to be found and explicited (while playing animations ?)
The global FIK setting can be accessed through the GameSetting bFootIK::RagdollAnim
4.6 Beta 03
Fixes:
OnPackage events names were mixed.
OnCombatEnd parameters were wrong.
Using CIOS inside event scripts possibly led to CTD.
OnDrop should work now.
GetFactionRank returns -1 when called with an invalid parameter.
Vanilla function which return forms are identified as such.
ConsoleOutputFile will not double "Carriage Return" on each line.
Some functions parameters changed from TESObject to AnyForm, so a literal value can be specified in scripts rather than needing a variable to hold the value.
IsScripteed, GetScript, RemoveScript, SetScript, IsFormValid, RunScript. (Please report any other where the change would be beneficial).
Known issue:
SetScript on a loaded ref has no effect until the reference is reloaded.
SetScript on a BaseEffect will not be detected by an active effect.
RunScript is unreliable. It may fail to start, and will on ly run the first script block once, and then ony if it is a GameMode block.
EquipItem2 is broken in the sense that the item is equipped after EquipItem returns so which item is equipped is not detected So it is the same as EquipItem currently.
Changes:
The second parameter for OnDrop is changed from a reference to a form to handle case where no valid reference are created during drop. In that case the value is the baseForm.
IsScripted, GetScript, RemoveScript and SetScript work with EffectSetting now (aka MGEF or Base Effect) IF the archtype is Script.
Merged edits to GameForm.h from JazzIsParis NVSE plugin v3.
New event OnDropItem
Same as OnDrop and fired concurrently, but will return the baseForm of the item dropped and not the (temporary) reference for it. Useful when the engine does not or cannot create a reference.
New built in User Defined Events related to dialogs
OnSpeakerText
This will let you modify the subtitle of a text "spoken" by an NPC.
Fired before the text is rendered on the screen, also before global text replacement (&global; place holders) is done so the engine can properly calculate text size on screen.
Args content:
eventName = OnSpeakerText
senderName = NVSE
tileName = the name of the TileText that will be containing the text in the MenuRoot arborescence. Something like MenuRoot\DialogMenu\NOGLOW_BRANCH\DM_SpeakerText
speakerName = Name of the NPC speaking. Access to the NPC FormID is borderline impossible at this point.
text = Text as entered in the plugin in the Info list.
To change the text on return, change the value of Args["Text"] in your handler.
OnTopic
This will let you modify the subtitle of a text "spoken" by the PC.
Fired before the text is rendered on the screen, also before global text replacement (&global; place holders) is done so the engine can properly calculate text size on screen.
Args content:
eventName = OnTopic
senderName = NVSE
tileName = the name of the TileText that will be containing the text in the MenuRoot arborescence.
text = Text as entered in the plugin in the Topic text or the prompt.
To change the text on return, change the value of Args["Text"] in your handler.
The speaker name is assumed to be the player.
I could generate an event for every text displayed on screen but I am worried about the potential for abuse.
You can opt out of dialog hooks, using nvse_config.ini. Set EnableTileTextHook=0 in the [Text] section.
Ported from FOSE
AddSpellNS (AddSpell No Spam: does not display the spell on screeen)
Ported from OBSE
Door teleport functions:
bool IsLoadDoor
float GetDoorTeleportX
float GetDoorTeleportY
float GetDoorTeleportZ
float GetDoorTeleportRot
SetDoorTeleport NewDoorRef X Y Z Rot (in degrees)
OBSE's last parameter (bool bTemp) was removed because FalloutNV will never save a change in the DoorTeleport data.
Added:
Get/SetFlagsLow, Get/SetFlagsHigh: gets or set individual flags on any form. Of course not all flags should be used, and not all flag will have an effect in game.
(see v2 beta 6 below for how to specify the flags).
HasConsoleOutputFile (HasCOF)
no parameter, return not null if a COF have been set by SCOF.
GetConsoleOutputFile (GetCOF)
no parameter, return the file name set by SCOF as a string_var.
PrintF and PrintDebugF (PrintDF)
Alternate versions of Print and PrintDebug that append to a file whose name is specified as the first parameter.
Console command imported:
TFIK (Toggles Foot IK System)
4.6 Beta 02
Fixes:
if adding too many user defined handler (as in more than two ), the callback list of previous event handler got corrupted.
4.6 Beta 01
Fixes:
Variable names terminated with a comment without interleaving whitespace can be referenced in scripts.
Changes:
SetScript and GetScript modified based on jazzisparis comments.
GetInGrid and GetInGridInCell:
Returns wether a specific reference is found in the grid centered on the specified cell (or on the PlayerRef).
GetInGrid aref:reference [CellDepth:integer [includeTakenRefs:integer]]
GetInGridInCell aCell:reference aref:reference [cellDepth:integer [includeTakenRefs:integer]]
Like GetFirstRef/GetFirstRefInCell cellDepth should be:
0, 1 or 2 to scan for a cell grid of, respectivly, 1, 3 or 5 cells wide. Higher values could be used if you increased uGridToLoad.
no value is intepreted as 0, i.e. a single cell.
-1 is interpreted as scan all loaded cell (ie use uGridsToLoad).
Ported from OBSE:
GetGridsToLoad:
returns the effective value of the uGridsToLoad ini setting
OutputLocalMapPicturesOverride:
a.k.a. OLMPOR.
OutputLocalMapPicturesOverride
Calls OutputLocalMapPictures. If you used SetOLMPGrids to limit the number of cells, then only those will be output.
SetOutputLocalMapPicturesGrids:
a.k.a. SetOLMPGrids
SetOutputLocalMapPicturesGrids numCell
Limits OLMPOR to a square of numCell. numCell must be odd and cannot exceed uGridsToLoad (nor 5). Which leaves 1 and 3 for valid values.
Initial port of Events: start reading here http://obse.silverlock.org/obse_command_doc.html#Events
SetEventHandler
sets an event handler, that is a User Defined Function that will be called when the event fire.
You can filter by source, ie on which reference the event occurs, and by object, ie which object the interacted with the source to fire the event
SetEventHandler eventName eventUDF [pair:source] [pair:object]
The source pair is expected to be either ref::aRef or first::aRef or ref::aFormList or ref::aBaseForm or first::aFormList or first::aBaseForm
The object pair is expected to be either object::aForm or second::aForm or object::aFormList or second::aFormList
If the source or the object is a form list, then SetEventHandler will be called in turn for each member of the form list.
If one of the member is another form list, the process is called recursively.
(There is no attempt at detecting loops in list)
RemoveEventHandler
removes an event handler previously registered by SetEventHandler
same syntax as SetEventHandler.
if using a formlist for object, it is not required that this list be identical to the list used for SetEventHandler.
GetCurrentEventName
Use inside the event handler UDF. Returns the eventName of the currently fired event. Useful if the same UDF handle more than one event.
let aStringVar := GetCurrentEventName
User-Defined Events (copied from OBSE v0021 distribution, obse_command_doc.html)
In addition to the events supplied by NVSE, mods can also register event handlers for events dispatched by other mods. These types of events are referred to as "user-defined events".
The event handler for a user-defined event always takes one argument: a Stringmap. The stringmap argument always includes the following two key-value pairs:
"eventName": a string indicating the event which occurred
"eventSender": a string indicating the origin of the event. By default this is the filename of the mod which dispatched the event, unless that mod supplied an alternate sender name.
The stringmap argument will also contain any additional data supplied by the sender of the event.
To register an event handler for a user-defined event, use SetEventHandler. To dispatch an event to any registered listeners, use DispatchEvent
Example:
scriptname EventHandler
array_var args
begin Function {args}
print "Event " + args->eventName + " received from " + args->eventSender
print $arg->activator + " was activated by " + $arg->activatedBy
end
scriptname EventSender
begin onActivate
DispatchEvent "Activated" (ar_Map "activator"::GetSelf "activatedBy"::GetActionRef)
end
DispatchEvent - dispatches a user-defined event to any registered listeners. The eventName parameter specifies the event that occurred; this should be fairly unique to prevent event name clashes between different mods, but the event handler can also disambiguate name clashes by checking the name of the event sender if necessary. The optional second parameter is a StringMap containing any additional information about the event. When the event is dispatched, the array will also include the event name and the name of the sender. If omitted, the name of the sender is the filename from which the event originated; otherwise it matches the supplied third argument.
(dispatched:bool) DispatchEvent eventName:string args:StringMap senderName:string
You cannot filter on User defined Events!
This version supports some standard script event: tested all "in Geck". They should correspond to the available block types in scripts.
"onadd"
"onactorequip" // Seen working. Depending of the source event, using Print/PrintC from the event handler can be purposely forbidden.
// Also seen fired in strange context, like an actor equipping another
"ondrop"
"onactorunequip"
"ondeath"
"onmurder"
"oncombatend"
"onhit"
"onhitwith"
"onpackagestart"
"onpackagedone"
"onpackagechange"
"onload"
"onmagiceffecthit" // changed from OBSE. Passes the EffectSetting, not the effectCode, which doesn't exist.
"onsell"
"onstartcombat"
"saytodone"
"onopen"
"onclose"
"ontrigger"
"ontriggerenter"
"ontriggerleave"
"onreset"
"onactivate"
More events will be added or completed later, but there will never be every event present in OBSE.
At least two other events can be registered "on0x0080000" and "on0x00400000", but I don't know what event they mark If anybody encounter them, please report in what context. Thank you.
Also supported are those NVSE events, corresponding to the PluginAPI message interface:
"ExitGame"
"ExitToMainMenu"
"LoadGame"
"SaveGame"
"QQQ"
"PostLoadGame"
"RuntimeScriptError"
"DeleteGame"
"RenameGame"
"RenameNewGame"
"NewGame"
"DeleteGameName"
"RenameGameName"
"RenameNewGameName"
4.5
Fixes:
GetArrayVariable return type corrected.
All String and array map modification are protected by a critical section due to concurrency issues.
Handling of {} in compiler override or let/eval expression.
You can use {} to enclose function parameters in complex expression so the parser knows which arguments are used by which function
let aVar := aFunction { parm1 parm2 } + anotherFunction { parm3 parm4 parm5 }
() are used to enclose complete expression.
let aVar := ( aFunction parm1 parm2 ) + ( anotherFunction parm3 parm4 parm5 )
EquipItem2 recognises the third parameter when used.
SetHotkeyItem should no longer interrupt the calling script when called and should work when called on an item without ExtendData.
SetHotkeyItem should properly remove the previous hotkey before setting the new one.
RemoveMeIR should work when called on an item without ExtendData.
EquipMe and UnEquipMe should work when called from the item object script.
All NVSE functions returning forms are explicitly declared as such. This should be proof read by someone
I need to do the same for all vanilla commands.
Corrections to HealthPercent functions by jazzisparis
Fix to SetPackageLocationRadius, radius should be corrrectly set now.
Known issue:
EquipItem2 is broken in the sense that the item is equipped after EquipItem returns so which item is equipped is not detected So it is the same as EquipItem currently.
RunScript has been reported broken. Must be tested.
Changes:
Builtin objects preloaded are no longer reported as incomplete reads during the load of the cosave.
Rewrote type casting in IsRefInList. Hope to avoid reported CTD.
Activated showing faction rank names as part of %c in ExtractFormattedString. Should apply to all format specifiers functions.
Extract from OBSE documentation:
%c - replaced with the name of a component within another object. Takes two arguments - an object (ref) and the index of the component you want to access (short). Supported object types:
Faction - prints the male rank title of the nth rank.
NVSE already had support for AMMO (full names, short names or abreviation).
Calling GetFirstRef/GetNumRef with a cellDepth of -1 will use uGridsToLoad to calculate how many cells to scan.
TestExpr has been tested
IsPlayable is extended to weapon and ammo.
Added:
GetPerkRank:
Return actor Perk rank or -1 if the perk is not applied
[ref.]GetPerkRank [actor]
GetAltPerkRank:
Return the alternate companion Perk rank or -1 if the perk is not applied
[ref.]GetPerkRank [actor]
WARNING: those two functions can only apply to the player !
Get/SetEquipmentBipedMask:
GetEquipmentBipedMask returns which flags an armor uses.
SetEquipmentBipedMask sets which flags an armor uses.
The mask is a bitmask that should be build by using ClearBit/SetBit (see below).
The order of bit index for slots can be found in NVSE source files (GameForms.h, search for EBipedFlags).
4 = HasBackpack
8 = Medium Armor
32 = Power Armor
64 = Non playable
128 = HeavyArmor
Other bits are either unused or unknown.
GetRefs:
returns an array of references of a given type in the current cell
same syntax as GetFirstRef,
GetRefs [formType [cellDepth [includeTaken]]]
GetRefsInCell:
returns an array of references of a given type in the specified cell
same syntax as GetFirstRefInCell,
GetRefsInCell cell [formType [cellDepth [includeTaken]]]
IsPluginInstalled:
returns 1 if the specified plugin is installed, else 0
IsPluginInstalled pluginName
GetPluginVersion:
returns the version of the specified plugin, or -1 if the plugin is not installed
GetPluginVersion pluginName
Note: The plugin name is set by the plugin during registration and displayed in nvse.log, it is not the filename.
GetBaseNumFactions
Returns the count of factions of an actor baseform.
let iCount := [ref.]GetNumFactions [actor|character|creature]
GetBaseNthFaction
Returns the Nth faction of an actor baseform.
let rFaction := [ref.]GetNthFaction [actor|character|creature]
GetBaseNthRank
Returns the Nth rank of an actor baseform. Same order as GetBaseNthFaction.
let iRank := [ref.]GetNthRank [actor|character|creature]
GetNumRanks
Returns the number of ranks for a faction.
let iCount := GetNumRanks faction
A set of functions to extract embedded lists into arrays:
GetBaseSpellListSpells
GetBaseSpellListLevSpells // Tested but no data
GetBasePackages
GetBaseFactions
GetBaseRanks
GetActiveFactions
GetActiveRanks
GetFactionRankNames
GetFactionRankFemaleNames
GetRaceHairs
GetRaceEyes
GetHeadParts
GetLevCreatureRefs
GetLevCharacterRefs
GetListForms
Most rank functions require using the corresponding faction function to know which rank applies to which function (same index).
They all follow this calling logic:
let anArray_var := [ref.]GetXXX [form]
GetBasixXX and GetActiveXXX can be called on a ref (which must be an actor) or by passing an actor (or even an actorBase for GetBasixXX).
Others require passing the proper form as parameter.
GetNthDefaultForm // Not tested
Returns the form at index in the array of default forms.
The list of default form and their corresponding index can be found in GameForm.h (kDefaultObjectNames).
let rForm := GetNthDefaultForm formIndex
SetNthDefaultForm // Not tested
Sets the form at index in the array of default forms. !!There is no check that the new form is valid!!
The list of default form and their corresponding index can be found in GameForm.h (kDefaultObjectNames).
SetNthDefaultForm formIndex newForm
GetDefaultForms // Not tested
Return an array of all the default forms.
The list of default form and their corresponding index can be found in GameForm.h (kDefaultObjectNames).
let aArrayVar := GetDefaultForms
A "somewhat generic" set of functions to manipulate embedded lists of forms:
GenericAddForm: adds a form to a list of form of an object at index
let indexAddedAt := GenericAddForm whichEmbeddedList objectContainingTheEmbeddedList formToAdd index
GenericReplaceForm: change a form in a list of form of an object at index
let previousForm := GenericReplaceForm whichEmbeddedList objectContainingTheEmbeddedList replacingForm index
GenericDeleteForm: delete a form from a list of form of an object at index
let previousForm := GenericDeleteForm whichEmbeddedList objectContainingTheEmbeddedList index
GenericGetForm: returns a form from a list of form of an object at index
let currentForm := GenericGetForm whichEmbeddedList objectContainingTheEmbeddedList index
valid values for whichEmbeddedList are:
0 = Race Hair
1 = Race Eyes
5 = actor base (NPC or creature) package
6 = actor base spell
7 = actor base levelled spell
10 = NPC head part
13 = FormList form (redundant with existing functions )
index for end of list is -2
Imported from Console:
con_Inv // not tested
4.5 beta 06
Fixes:
Definition of Hairs and Eyes in TESRace.
InventoryRef functions should be fully functional now, including for the player inventory.
Plugin manager:
RegisterCommand will properly record the plugin opcodeBase.
RegisterTypeCommand will only provide an eval version when appropiate.
GetParentPlugin reports the correct answer for opcode 0.
GetModLocalData and GetAllModLocalData return types corrected.
Changes:
During reference variable evaluation, Player is replaced by PlayerRef when appropriate.
Proof of concept:
Different animations set and/or different skeleton. see TestAnim.txt in Data\nvse.
Added:
EquipItem2:
equips and runs onEquip block
[ActorRefID].EquipItemZ ObjectID:ref NoUnequipFlag:int{0, 1} HideEquipMessage:int{0, 1}
EquipMe:
equips the calling object on its owner
ref.EquipMe
UnequipMe:
unequips the calling object on its owner
ref.UnequipMe
IsEquipped:
returns 1 if the calling object is currently being worn
Currently, it must be called on an InventoryRef, though.
ref.IsEquipped
GetInvRefsForItem:
returns an array of temp refs to objects of the specified type in the calling container
(refs:Array) GetInvRefsForItem baseObject:ref
All 5 ported from OBSE.
SetHotkeyItem:
sets the item associated with a hotkey
(nothing) SetHotkeyItem whichHotkey:short item:ref
ClearHotkey:
clears the item associated with the specified hotkey.
(nothing) ClearHotkeyItem whichHotkey:short
Both ported from OBSE by Luthien Anarion.
PrintDebug or PrintD:
Version of Print that only display something if the script is in debug mode.
SetVariable:
Sets a numeric variable on a ref or a quest:
ref.SetVariable variableName variableValue
SetVariable variableName variableValue Quest
SetRefVariable:
Sets a form variable on a ref or a quest:
ref.SetRefVariable variableName anyForm
SetRefVariable variableName anyForm Quest
Get/SetStringIniSettings:
string_var GetStringIniSetting "settingGroup:settingName"
the : seems to be expected by the engine.
example: let s := GetStringIniSetting "sDPad:LANGUAGE"
SetStringIniSetting "settingGroup|settingName"
the | is coherent with the SetNumIniSettingsix
Imported from Console:
con_ShowVars (requires SetConsoleEcho 1 to be visible)
4.5 beta 05
Fixes: archive contains the actual corrections.
4.5 beta 04
Fixes:
Accounted for difference in the Reference class between Runtime and Editor.
This allows Let to use Reference.Variable without needing the compiler override.
GetRaceName should return a valid name now.
Changes:
Rewrote GetRace and GetRaceName to be more robust and accept either a ref or a baseForm as parameter.
4.5 beta 03
Fixes:
Looping through InventoryRef no longer removes existing extras when count is <=1
4.5 beta 02
Fixes:
Allows ErrorLogHook to have an integer parameter before the vfprintf format. (submitted by Queued)
EndVATScam:
Unselect any target and quit VATS mode. (ported from Queued)
4.5 beta 01
Fixes:
bad handling of $string_var name length
Changes:
User Defined Functions can have up to 15 parameters now (from 10 before).
Get/SetModelPath, GetPath functions when passed a reference, will operate on the reference's baseForm.
TESPackages identified as being safe to perma clone. Functionality still incomplete and not published.
A few comments added or changed, or some typos corrected. Declared missing known virtual functions or found fields.
4.2 beta 04
Fixes:
GetUserTime properly returns an array now.
ListClear should try to do something now.
Pelinor's corrections to InventoryRef.
Changes:
Open/Close braces checks are added in the NVSE parser so that any extraneous closing brace will terminate the sub expression.
This way, said extraneous brace, and the rest of the line, will be then parsed by the GECK parser.
This should allow mixing NVSE expressions and standard expressions in the same source line.
(Please report any non override script that fails to compile once converted to the compiler override)
Provide a map file for runtime.
Port of (Set)IsPlayable from OBSE
IsPlayable returns wether an armor is usable by the player.
[ref.]IsPlayable [item:BipedModel]
SetIsPlayable Sets wether an armor is usable by the player.
[ref.]SetIsPlayable int:doSet [item:BipedModel]
GetEquipmentSlotsMask returns which slots an armor uses.
[ref.]GetEquipmentSlotsMask [item:BipedModel]
SetEquipmentSlotsMask sets which slots an armor uses.
The mask is a bitmask that should be build by using ClearBit/SetBit.
The order of bit index for slots can be found in the GECK (order in the list) or in NVSE source files (GameForms.h, search for EPartBit).
The first bit is at index 0
[ref.]SetEquipmentSlotsMask int:Bitmask [item:BipedModel]
SetConsoleEcho toggles wether the engine print to the console, required by con_SQV
Returns the current state
GetConsoleEcho checks wether the engine print to the console, uses no parameters.
con_SQV imports the console command ShowQuestVars, requires ConsoleEcho turned on, as in:
let oldEcho := SetConsoleEcho 1
con_SQV quest
SetConsoleEcho oldEcho
GetScopeModelPath returns the model path of the scope of a weapon
SetScopeModelPath sets the model path of the scope of a weapon
4.2 beta 3:
Port Heap management from SKSE originally by Sheson.
Set "DefaultHeapInitialAllocMB" in the "Memory" section of nvse_config.ini
Vanilla value is 200, hardcoded max value is <500. 400 has been reported functional, 500 induced CTD.
No ScrapHeap as there is'nt a single allocation but at least 6 with varrying sizes.
IsPlayerSwimming workaround IsSwimming returning false for the player
GetTFC returns wether or not Fly Camera is active
Port of the Algohol OBSE plugin by emtim:
V3Length returns length of given vector3
V3Normalize returns normalized vector3
V3Crossproduct returns crossproduct of two vectors
QFromEuler converts euler angles to quaternion. optional flag indicates if the angles came from an actor
QFromAxisAngle converts axis-angle rotation to quaternion
QNormalize returns normalized quaternion
QMultQuatQuat multiplies two quaternions
QMultQuatVector3 multiplies vector3 by quaternion
QInterpolate interpolates between two quaternions
QToEuler converts quaternion to euler angles. optional flag indicates the output will be used for rotating an actor
Cleanup default NVSE.log for release build.
Added logLevel management to nvse.ini.
Value logLevel in RELEASE or DEBUG section. Valid values are 0 (FatalError) to 5 (Debug), anything greater will be treated as 5.
Fixes:
RemoveScript, tests for unassigned pointer now.
Label/Goto return addresses assigned by script refID. So the same label can be used in a script and a user defined function.
Corrected the number of subprocedure called when setting a string_var. Applies to BipedPathFuncs and GetPath funcs
Corrected handling of $: Vanilla functions should recognise the $ parameter and the result should not be truncated to the variable nae size any more.
ianpatt's Windows 8 compatibility fix for steam_loader.
Update3D avoids the player due to camera issues.
Miscellanous:
Some comments and/or member renaming following save decoding or unfinished functions.
nvse_plugin_example updated.
4.2 beta 2
GetRace returns the race of an NPC
GetRaceName returns the name of the race of an NPC
con_SCOF imports the console command SCOF
PickOneOf returns a random item in the FormList that is present in the NPC inventory.
Version 3 of the messaging interface, providing alternate Delete/rename save event with the file name rather than the file path:
kMessage_DeleteGameName, // version of the messages sent with a save file name instead of a save file path.
kMessage_RenameGameName,
kMessage_RenameNewGameName,
Rename(s) will remain untested until someone knows how to rename a save in game
4.1b1 and earlier:
4.1 beta 01 mostly ports OBSE plugin events/strings/arrays/user functions/expressions and the relevant serialization
I tried to keep function names identical to OBSE, so I can refer directly to the OBSE online documentation. http://obse.silverlock.org/obse_command_doc.html
added variables to nvse_settings.ini to help control debugging without recompiling.
ported support for serialization/messages/strings/arrays... to the pluginAPI
messages available:
ExitGame exit to windows from main menu or in-game menu
ExitToMainMenu exit to main menu from in-game menu
LoadGame Dispatched immediately before plugin serialization callbacks invoked, after savegame has been read by Fallout
// dataLen: length of file path, data: char* file path of .fos savegame file
// Receipt of this message does not *guarantee* the serialization callback will be invoked
// as there may be no .nvse file associated with the savegame
SaveGame as above
Precompile EDITOR: Dispatched when the user attempts to save a script in the script editor.
// NVSE first does its pre-compile checks; if these pass the message is dispatched before
// the vanilla compiler does its own checks.
// data: ScriptBuffer* to the buffer representing the script under compilation
PreLoadGame dispatched immediately before savegame is read by Fallout
// dataLen: length of file path, data: char* file path of .ess savegame file
ExitGame_Console exit game using 'qqq' console command
PostLoadGame dispatched after an attempt to load a saved game has finished (the game's LoadGame() routine
//has returned). You will probably want to handle this event if your plugin uses a Preload callback
//as there is a chance that after that callback is invoked the game will encounter an error
//while loading the saved game (eg. corrupted save) which may require you to reset some of your
//plugin state.
//data: bool, true if game successfully loaded, false otherwise */
PostPostLoad sent right after kMessage_PostLoad to facilitate the correct dispatching/registering of messages/listeners
// plugins may register as listeners during the first callback while deferring dispatches until the next
RuntimeScriptError dispatched when an NVSE script error is encountered during runtime/
// data: char* errorMessageText
DeleteGame sent right before deleting the .nvse cosave and the .fos save.
// dataLen: length of file path, data: char* file path of .fos savegame file
RenameGame sent right before renaming the .nvse cosave and the .fos save.
// dataLen: length of old file path, data: char* old file path of .fos savegame file
// you are expected to save the data and wait for kMessage_RenameNewGame
RenameNewGame sent right after RenameGame.
// dataLen: length of new file path, data: char* new file path of .fos savegame file
NewGame sent right before iterating through plugins newGame.
// dataLen: 0, data: NULL
Some NPC functions:
SetEyes sets an NPCs eyes
[ref.]SetEyes eye:form [NPC:npc]
GetEyes gets an NPCs eyes
[ref.]GetEyes [NPC:npc]
SetHair sets an NPCs hair
[ref.]SetHair hair:form [NPC:npc]
GetHair gets an NPCs hair
[ref.]GetHair [NPC:npc]
GetHairLength sets an NPC hairLength (apparently unused, but still [:smile:] )
[ref.]GetHairLength [NPC:npc]
SetHairLength sets an NPC hairLength (apparently unused, but still [:smile:] )
[ref.]SetHairLength hairLength:float [NPC:npc]
GetHairColor gets an NPCs hair color (code: 1=Red, 2=Green, 3=Blue, other=color)
[ref.]GetHairColor hairColorCode:int [NPC:npc]
SetHairColor sets an NPCs hair color (color as RGB bytes)
[ref.]SetHairColor hairColor:int
GetNPCWeight gets an NPCs weight
[ref.]GetNPCWeight [NPC:npc]
SetNPCWeight sets an NPCs weight (no idea if that has any effect [:smile:] , the code seems to igore it for NPC (using height instead) but it is used for the PC)
[ref.]SetNPCWeight weight:float [NPC:npc]
GetNPCHeight gets an NPCs height
[ref.]GetNPCHeight [NPC:npc]
SetNPCHeight sets an NPCs height
[ref.]SetNPCHeight weight:float [NPC:npc]
To see the effect of any of those functions, you should call Update3D (But NOT on the player at the moment)
Update3D
patched ModFactionRank same issue as SetFactionRank, exact rank was not taken into account if modified on the reference.
some scripts functions from OBSE:
GetVariable looks up the value of a variable by name. If called on a reference, the ref must be scriptable, but not necessary a quest.
[ref.]GetVariable variableName:string [QUEST:quest]
HasVariable returns true if the script has a variable with the specified name
[ref.]HasVariable variableName:string [QUEST:quest]
GetRefVariable looks up the value of a ref variable by name
[ref.]GetRefVariable variableName:string [QUEST:quest]
GetArrayVariable looks up an array variable by name on the calling object or specified quest
[ref.]GetArrayVariable variableName:string [QUEST:quest]
CompareScripts returns true if the compiled scripts are identical
CompareScripts script:formID script:formID
ResetAllVariables sets all variables in a script to zero, unless called on a reference, apply to the calling script.
[ref.]ResetAllVariables
GetNumExplicitRefs returns the number of literal references in a script
GetNumExplicitRefs script:formID
GetNthExplicitRef returns the nth literal reference in a script
GetNthExplicitRef script:formID
RunScript
GetCurrentScript
GetCallingScript
OBSE expressions, see http://obse.silverlock.org/obse_command_doc.html#OBSE_Expressions
Let
eval
While
Loop
ForEach
Continue
Break
ToString (and $)
Print
testexpr (did I test that one ? Can't remember [:smile:] )
TypeOf
GetUserTime
GetModLocalData (verified ?)
SetModLocalData
OBSE user-defined functions, see http://obse.silverlock.org/obse_command_doc.html#User_Defined_Functions
Call
Function
SetFunctionValue
OBSE Array variables, see http://obse.silverlock.org/obse_command_doc.html#Array_Variables
ar_Construct
ar_Size
ar_Dump
ar_DumpID
ar_Erase
ar_Sort
ar_CustomSort (to be verified, had to wait for user functions and then forgot)
ar_SortAlpha
ar_Find
ar_First
ar_Last
ar_Next
ar_Prev
ar_Keys
ar_HasKey
ar_BadStringIndex
ar_BadNumericIndex
ar_Copy
ar_DeepCopy
ar_Null
ar_Resize
ar_Insert
ar_InsertRange
ar_Append
ar_List
ar_Map
ar_Range
OBSE String variables, see http://obse.silverlock.org/obse_command_doc.html#String_Variables
sv_Destruct
sv_Construct
sv_Set
sv_Compare
sv_Length
sv_Erase
sv_SubString
sv_ToNumeric
sv_Insert
sv_Count
sv_Find
sv_Replace
sv_GetChar
sv_Split
sv_Percentify
sv_ToUpper
sv_ToLower
IsLetter
IsDigit
IsPrintable
IsPunctuation
IsUpperCase
CharToAscii
ToUpper
ToLower
AsciiToChar
NumToHex
ToNumber
GetNthModName
GetName
GetKeyName
GetFormIDString
GetRawFormIDString
GetFalloutDirectory
ActorValueToString
ActorValueToStringC
GetModelPath
GetIconPath
GetBipedModelPath
GetBipedIconPath
GetTexturePath
SetModelPathEX
SetIconPathEX
SetBipedIconPathEX
SetBipedModelPathEX
SetTexturePath
GetNthFactionRankName
SetNthFactionRankNameEX
GetStringGameSetting
SetStringGameSettingEX
3 beta 05 again some package functions.
SetPackageTargetReference sets package target to the calling reference
[ref.]SetPackageTarget package:form [target:ref]
SetPackageTargetCount sets package target count or distance (alias is SetPackageTargetDistance)
SetPackageTargetCount package:form count:int
GetPackageTargetCount gets package target count or distance (alias is GetPackageTargetDistance)
GetPackageTargetCount package:form
SetPackageLocationRadius sets package start location radius
SetPackageLocationRadius package:form radius:float
GetPackageLocationRadius gets package start location radius
GetPackageLocationRadius package:form
3 beta 04 complements SetOpenKey
ClearOpenKey clears the key used to unlock the calling object (shows the lock has broken until unlocked).
ref.ClearOpenKey
3 beta 03 more package functions mainly.
SetOpenKey sets the key used to unlock the calling object
ref.SetOpenKey Key:formID
GetCurrentPackage gets the current package from an actor
[ref.]GetCurrentPackage [actor:ref]
GetPackageLocation gets package start location
GetPackageLocation package:form
The following, while called on a reference, runs on the reference baseForm
GetPackageCount gets the count of packages from an actor base form
[ref.]GetPackageCount [actor:ref]
GetNthPackage gets the Nth package from an actor base form (O is the package with the highest priority)
[ref.]GetNthPackage packageIndex:int [actor:ref]
SetNthPackage sets and returns the Nth package to an actor base form
[ref.]SetNthPackage package:form packageIndex:int [actor:ref]
AddPackageAt adds the Nth package to an actor base form : 0 at top, -1 at end, returns index
[ref.]AddPackageAt package:form packageIndex:int [actor:ref]
RemovePackageAt removes and returns the Nth package from an actor base form: -1 at end
[ref.]RemovePackageAt packageIndex:int [actor:ref]
RemoveAllPackages removes all packages from an actor base form, returns count removed
[ref.]RemoveAllPackages [actor:ref]
Previous changes
data-cke-saved-href="http://nvse.silverlock.org/beta/nvse_2_beta1.zip
whatsnew:
- MessageEx/MessageBoxEx
- SetNameEx
- IsClonedForm/TempCloneForm
-
GetParentCellOwner/GetOwningFactionRequiredRank/GetParentCellOwningFactionRequiredRank
-
fix loader misreporting when it can't find the editor
-
GetLocalRefIndex/BuildRef
data-cke-saved-href="http://nvse.silverlock.org/beta/nvse_2_beta2.zip
whatsnew:
- Menu*Key functions use buffered input like they should
- log
printc to IDebugLog in _DEBUG builds
- SetUIStringEx
- fix %k format
specifier
- fix DataHandler::DoAddForm (updated address then reverted it then
fixed it again)
- enable kWeapType_OneHandThrown type
data-cke-saved-href="http://nvse.silverlock.org/beta/nvse_2_beta3.zip
whatsnew:
- fix formlist params so they accept any form type
- fix
SetUIStringEx
- document new vegas parameter types
- %c format type can
print the different sub-names of ammo (0 = full name, 1 = short name, 2 =
abbreviation)
data-cke-saved-href="http://nvse.silverlock.org/beta/nvse_2_beta4.zip
whatsnew:
- full pass on all parameter types, fix lots of mistakes
- fixes
ListAddForm and other formlist things that were using ExtractArgsix
data-cke-saved-href="http://nvse.silverlock.org/beta/nvse_2_beta5.zip
whatsnew:
- Get/SetWeaponLongBursts
- SetWeaponFireRate
- long strings
should not crash the compiler any more
- overhaul dinput code
- added an
optional integer parameter to IsKeyPressed (default behavior unchanged, see
whatsnew.txt for details)
data-cke-saved-href="http://nvse.silverlock.org/beta/nvse_2_beta6.zip
whatsnew:
- access to weapon flags: Get/SetWeaponFlags1/2
- math functions
for setting individual bits (ClearBit/SetBit)
-
Get/SetActorBaseFlagsLow/High
- improve IsControlDisabled, cache now keeps
track of partially disabled keys
- ExtractArgsRaw, new internal function for
getting detailed information about passed-in arguments (not a scripting command,
only useful for C++ API stuff)
data-cke-saved-href="http://nvse.silverlock.org/beta/nvse_2_beta7.zip
whatsnew:
- fix GetCrosshairRef, other things relying on
InterfaceManager
- more helpful error message when using the updated CS
data-cke-saved-href="http://nvse.silverlock.org/beta/nvse_2_beta8.zip
whatsnew:
- fix crash when iterating over invalid form lists (generally a
sign that a mod needs to be updated, but crashing is bad)
- support for
editor 1.4.0.518
This patch was released at a slightly awkward time, so some mods relying on
the very strange behavior of the mouse functions may need to be updated.
data-cke-saved-href="http://nvse.silverlock.org/beta/nvse_2_beta9.zip
whatsnew:
- document new method of getting to NiNode
- fix
IsControlDisabled, tilde/escape
data-cke-saved-href="http://nvse.silverlock.org/beta/nvse_2_beta10.7z
whatsnew:
- support for German "no gore" runtime
- optionally hook
internal game error log
- fix crash in GetHotkeyItem,
SetWeaponRequiredSkill
- Get/SetEquippedWeaponModFlags
-
Get/SetWeaponItemModEffect/Value1/Value2
data-cke-saved-href="http://nvse.silverlock.org/beta/nvse_2_beta11.7z
whatsnew:
- fixed Get/SetWeaponItemModValue2
data-cke-saved-href="http://nvse.silverlock.org/beta/nvse_2_beta12.7z
whatsnew:
- made weapon mod indexing the same across all functions (1-based
instead of 0-based for backwards compatibility)
data-cke-saved-href="http://nvse.silverlock.org/beta/nvse_3_beta1.7z
whatsnew:
3 beta 02:
Added isNogore to NVSEinterface
Fixed
GetFactionRank (Report the exact rank and not 1 after SetFactionRank)
3 alpha 01:
New functions:
HasOwnership
checks
wether an NPC owns a reference or has the required faction rank to own said
reference
IsOwned
checks wether a reference is owned by
an NPC or that said NPC as the required faction rank to own the
reference
SetOwningFactionRequiredRank
set the owning
faction required
reference
GetDialogueSubject
Get the
subject reference in a converation. That is the reference who STARTED the
conversation, (subject of Hello/Greatings
topic)
GetDialogueTarget
Get the target reference in a
conversation. That is the reference who ANSWERS the conversation, (target
of Hello/Greatings topic)
GetDialogueSpeaker
Get the
current speaker in a conversation. That is the current subject in a
topic.
note: GetCurentPackageTarget does not provide
the other member of a conversation
reliably.
SetPackageLocationReference
Change
the target reference of a
package.
GetAgeClass
Classify the age of
the standard races: -1 undefined. 0 is Child, 1 is default, 2 is Old, 3 is
OldAged.
RemoveMeIR,
removes an inventory reference from its
container, optionally transferring it to a different container, in much the same
way as the vanilla RemoveMe command. The inventory reference becomes invalid
once this command is called and should no longer be used.
CopyIR
copies an inventory reference to the specified
container. The calling object needn't be in a container and remains valid after
the command is called. If the calling object is equipped, the copy will not be
equipped.
CreateTempRef
creates a
temporary reference to the specified form. This reference does not exist in the
gameworld or in a container, and remains valid for only one frame. It is mostly
useful for creating a stack of one or more items to be added to a container with
CopyIR
GetFirstRefForItem,
returns the first entry in an array
of temp refs to objects of the specified type in the calling container
GetNextRefForItem
returns the next entry in the array of
temp refs to objects of the specified type in the calling container
AddItemOwnership
Specifies the ownership info while
adding an
item
AddItemHealthPercentOwner
Specifies
both the ownership info and the health while adding an
item
"Token" functions: A token is an Item that can
only be present once in inventory, and must allow Health and Ownership. Most
likely created from an Armor with no biped slot so it can't be
equipped.
GetTokenValue, GetTV
Get the value of a
token
SetTokenValue, SetTV
Add or modify
the value of a token
GetTokenRef,
GetTR
Get the referenece of a
token
SetTokenRef, SetTR
Add or modify
the reference of a token
SetTokenValueAndRef,
SetTVR
Add or modify both the value and the reference of a
token
GetPaired
Detects if ref and actor
cross references each other (through item ownership). Usage for thinks like is
familly member, is partner of where there maybe multiple instances (n n
links)
GetRespawn
Checks the respawn
flag on Actor
SetRespawn
Sets the respawn flag on actor.
Effective on standard NPC, unreliable on
LevelledCharacters
GetPermanent
Checks the permanent
flag on Reference
SetPermanet
Sets the permanent flag on
Reference. Effective on standard NPC, unreliable on LevelledCharacters
GetBaseForm
Find the actual baseForm of a Levelled
form
IsRefInList
Checks whether a ref, its baseform or its
leveled baseForm is in a FormList
Changed
functions
TempCloneForm
IsClonedForm
Both
accept any Form as the source, rather than just 3D object to allow for cloning
of packages for example.
ListGetFormIndex
Eval version
of the function created
2 beta 14
- PluginApi extended to support:
* condition functions
in plugins.
* function alternate name in plugins using
DEFINE_COMMAND_ALT_PLUGIN.
* NVSECommandTableInterface (like OBSE).
2 beta 13
- PluginApi extended to support Messaging Interface (like OBSE).
Implemented messages are GameLoad and GameSave.