Jump to content

NVSE plugin -- What do we need?


prideslayer

Recommended Posts

As some of you know, I've spent the better part of the day and a little bit of yesterday hacking on an NVSE plugin and beating my head against the lack of documentation for NVSE plugin authors. I finally have had complete success in creating an NVSE plugin that adds an entirely new command to FONV (two of them, actually!), so now I'm opening the door to "formal" requests for features in the plugin.

 

My one request is that the feature you want added be (somewhat) generic. The current plugin is named sexout blah blah but that is changing to simply "NVSE Extender", and I don't want any "sexout specific" type functions in it.

 

I need to contact the NVSE team and get an opcode range assigned so my plugin does not conflict with anyone elses, and also not with future versions of NVSE. I will do this eventually, but not just yet, since I don't know how big a 'block' I'm going to need. I don't want to just say "give me 10,000 opcodes", but I also don't want to bug them every day/week for more.

 

I know astymma has some suggestions.. this will be the feature request thread so we can get stuff into NVSE, be it a feature that exists in another *SE (OBSE, FOSE, SKSE) or one entirely new and unique.

 

Attached is a screen shot of the plugin loaded and working.

 

DLL name: nvse_extender.dll

Function prefix: NX_

Current opcode prefix: 0x2140 (assigned by NVSE team)

 

Current implemented functions:

 

(int) NX_GetVersion : no params, returns current version #.

 

(int) ref.NX_IsUsingSkeleton name:string actor:ref : True if the actor is using the given skeleton, false otherwise.

Details:

 

 

Must be an actor (player, npc, or creature). Can be called on a reference, or with a reference as a parameter. If called without either, runs on the current context.

 

Skeleton name must match the directory name of the creature in question, for example, "_Male" for the human skeleton, "NVBigHorner" for the Big Horner skeleton, etc. The name passed in is case insensitive.

player.IsUsingSkeleton "_male" ; will return 1
player.IsUsingSkeleton "nvgecko" ; will return 0
RexREF.IsUsingSkeleton "_male" ; will return 0
RexREF.IsUsingSkeleton "dog" ; will return 1

 

 

 

(int) NX_IsInList list:formlist item:object (recurse:int) : >0 if the item in any form is contained within the formlist, 0 otherwise. Setting recurse to 1 will cause it to check formlists within the current formlist to near infinite depth (recurse not yet implemented).

 

 

Returns a value from 0 to 4.

0 : item not in list.

1 : item in list exactly.

2 : base form of item in list.

3 : item is a baseform of another item in list.

4 : base form of item is the same as base form of another item in list.

 

Take the following three vars:

set itemA to AcousticGuitar
set itemB to player.placeatme AcousticGuitar 1
set itemC to player.placeatme AcousticGuitar 1

 

And two formlists. List1 contains itemA, list2 contains itemB.

 

"NX_IsInList List1 itemA" and "NX_IsInList List2 itemB" will both return 1.

"NX_IsInList List1 itemB" will return 2.

"NX_IsInList List2 itemA" will return 3.

"NX_IsInList List2 itemC" will return 4.

 

 

 

 

"Fun" things prideslayer has learned on this project:

 

 

- The NVSE documentation is worse for plugin developers than for modders using NVSE.

- You cannot type a backslash "\" into the game console. Try it.

- C is exactly like I remember it. This is good and bad.

-- Good: strtok

-- Bad: parts = (char **) realloc(parts, (cnt + 1) * (sizeof(char*)));

 

 

 

Wishlist: Things requested to be in the plugin

- NX_ChangeRace

- NX_SetWalkSpeed

- NX_SetRunSpeed

- NX_SetJumpHeight

- NX_IsSwimming

- NX_ClearList

- NX_ToggleSpecialAnim

- NX_TFIK (con_tfik)

- NX_RunBatchScript

- NX_ChangeMesh

- NX_ChangeTexture

- NX_SetBoneScale

- NX_ShowTimedMessage (show message with custom delay)

- NX_ShowMessageEx2 (screen-center message with 'ok')

 

EV (extended val) functions for saving data with a ref that persists across saves

- NX_SetEVS - string

- NX_SetEVI - integer

 

EV*Ex functions. Same as existing EV functions, but taking printf formatted key + args

- (bool) ref.NX_SetEVEX str:key void:val fmt1..fmt16

- (formid) ref.NX_GetEVFoEX str:key fmt1..fmt16

- (float) ref.NX_GetEVFlEX str:key fmt1..fmt16

- (???) ref.NX_ClrEx str:key bool:clearChild arg1..arg16

 

Wishlist Items on hold

- NX_IsFIKEnabled (Have not been able to find this flag)

- NX_CanUnequipItem (Have not been able to find this flag)

- NX_CanEquipItem (Have not been able to find this flag)

- NX_IsUFOEnabled (Have not been able to find this flag)

 

there will be a corresponding NX_GetEV... function for each of the above except, for now, strings.

Link to comment

Updated post to be more truthful; I can't actually *return* a string. What I can do though, is take them as parameters, so a new function is forthcoming of the form:

; ref.IsUsingSkeleton "actor type"
; use like this:

; is this thing compatible with gecko animations?
if (refVar.IsUsingSkeleton "NVGecko")
 ; do some stuff
endif

; or like this, to see if the actor is using the human skeleton
if (refVar.IsUsingSkeleton "_Male")
 ; do some stuff
endif

 

I don't know of other uses for this right now, but I'm going to use it to crush the sexout 9.2 errors (almost) once and for all with a block like this replacing the formlist/faction crap:

if (refVar.IsUsingSkeleton "_Male")
 ; pick a human animation
elseif (refVar.IsUsingSkeleton "NVGecko")
 ; or gecko anim
elseif (refVar.IsUsingSkeleton "SMSpineBreaker")
 ; supermutant
elseif (.. etc )
 ; etc
else
 ; throw a 9.2 for unsupported creatures, as intended, such as big horners, ants, etc.
endif

Link to comment

ToggleSpecialAnim for crawling and walking-while-bound anims. It was in OBSE' date=' but never made it into FOSE or NVSE.

[/quote']

 

I can dig into the OBSE source to see what it did / how it works, but do you remember offhand what the 'effect' was, and what kind of arguments it needed?

Link to comment

I'm not surprised you got it working given your skill' date=' but I am surprised it working was a possibility given technical limitations.

[/quote']

 

When using a real compiled language, there is no technical barrier that cannot be surmounted. I can do "whatever I want" with the game in this context, just a matter of finding the right bits to twiddle.

 

Given enough time and motivation, that entire shitass scripting language could be pulled out and replaced with something else, or along the lines of the (now defunct) classic mode in NG, provide a new scripting language to stuff that wants it, but leave the old one in place for vanilla scripts. It would be a huge undertaking to do that, but it would not be impossible.

Link to comment
You just blew my goddamn mind.

 

I don't want to put another huge project into your head that I have a feeling you'd pursue' date=' but would what you just discovered be able to be used to add additional animations to Skyrim?[/quote']

I'd hope so, but in the meantime, while you have NVSE by the goolies, perhaps have a quick look at that clear list command in Sexout Notify that doesn't seem to work.

I wouldn't mind script commands to adjust run, walk speeds & Jump height, or something to detect that the player is swimming as the default IsSwimming function doesn't work in NV.

No panic on them, just what I can remember hitting my head against at times :)

Heck, being able to change race more easily might be good too.

Link to comment

It could certainly help, but I suspect the SKSE guys are going to be adding the functionality needed to the core, so I won't have to write a plugin to do it for them; it's a hot topic.

 

The author of hkxcmd has successfully managed to add support to decompiling and recompiling the behavior format. I was sure he (or someone) would manage this, even when others were doubtful, but half of them are also calling it "decrypting" so I wasn't paying much attention to them anyway.

 

What's left is to get new behaviors to show up in the CK. They might automatically show up the first time an hkx with a new behavior is loaded, I don't know. I am pretty sure it will not be very complicated though, if it isn't already solved.

 

There are simply too many behaviors, with too many odd names, scattered across all the races, for there to be some huge static list of them in the game engine. There's no way that every time someone on the animation team added a new weapon animation or 'standing around the fire' animation or whatever, that they had to recompile the entire game engine. That would be a huge waste of time and resources on a project that probably takes hours every time you hit "build all" on the engine to recompile it.

 

They might have been dynamically determined via a tool that exported a static list, thus making the list in the CK "fixed", but that's something a tool like SKSE or powerup can patch. I'm certain that once the game engine itself has no such static list, it just wouldn't make sense.

Link to comment

Thanks Hal, added to the todo list. Changing race will probably be pretty easy since the engine supports it natively, it just isn't exposed except through that goofy barber (or whatever its called) command.

 

Walk and run speed will be tougher. There is already a way to change those, but it affects every character in the game; it's simply not stored on a per-actor basis anywhere that I'm aware of. Same with jump height I think.

 

Swimming.. does that function not work at all, or does it only work if you're completely submerged and the O2 counter is running, or what?

 

 

Link to comment

Yes. "ref.ToggleSpecialAnim string:filename int:enabled". So for example:

playerREF.ToggleSpecialAnim 4backward.kf 1

4backwards.kf was in the "specialanims" folder.

 

It wouldn't do anything unless you ran "ref.Update3D" afterwards.

 

Chase, since there's nothing there telling you which anim to replace, am I to assume these were all for toggling the anims used for movement? I have a statement and a question about that.

 

Question:

Wouldn't it be 'better' to toggle an entire directory off and on? You could still have the specialanims directory, and beneath that say 'crawl1', 'crawl2', 'boundwalk1', etc directories. Those would contain .kfs with the same names as the vanilla ones, so you'd call it with the subdirectory name you want to use instead, like 'tsa "crawl1" 1'?

 

Statement:

I still strongly believe there's a way to do this in the GECK already, with some scripting help. I started work on this in sexout with the crawling animations, and made some progress, ran into some problems I believe can be solved, and got busy with other stuff.

 

In Sexout.ESMs you can see a node in the tree called "SexoutNGCrawl" and the item to trigger it (just has to be in inventory) is "SexoutNGCrawling".

 

I'm pretty convinced that the right combination of the "Animation Group" in the idle window in the geck, the right conditions on the idles themselves, and (possibly) the right type in the .kf files (may not be 'specialidle' for these) will make this work.

 

If you give yourself the token (xx063065) will cause you to drop to all fours instantly, and turning to face different directions works fine, it is just the actual act of moving that doesn't work right.

Link to comment

On that subject of crawling, I just looked at it again and changed the conditions for the 'idle' and 'fwd' anims to check for IsControlPressed instead of IsMoving, and it does kind of "work" now. holding forward you'll alternate between crawling and walking/running. The animations aren't repeating like they are supposed to for a movement animation, they are just running once -- but they are very long. Let go of the key when crawling and you keep crawling until the anim runs out.

 

Obviously this won't work for NPCs (no IsControlPressed help for them), and I'm not sure if the anims can be "fixed." Just food for thought, I will look at the OBSE code for that toggle thing regardless.

Link to comment
Thanks Hal' date=' added to the todo list. Changing race will probably be pretty easy since the engine supports it natively, it just isn't exposed except through that goofy barber (or whatever its called) command.

 

Walk and run speed will be tougher. There is already a way to change those, but it affects every character in the game; it's simply not stored on a per-actor basis anywhere that I'm aware of. Same with jump height I think.

 

Swimming.. does that function not work at all, or does it only work if you're completely submerged and the O2 counter is running, or what?[/quote']

Gah! didn't even realise the change walk/run/jump affected NPC's too, regardless as far as I know the only way to alter it is via setting the global in an ESP which I didn't think could be done via scripting, otherwise could just alter Jump/etc while it was used by the player then switch it back.

 

The IsSwimming has never worked in NV, possibly it is related to there being no "real" water in NV, even the Dam water is Placeable water. Perhaps some way of detecting that a Swimming animation on an Actor is running currently would do.

 

Yeah and a readble flag for locked will be a must for Sexout :)

Link to comment

Hi. Um ... new guy here.

 

I would really like a script command to toggle FootIK on and off, just like the TFIK console command. Something like Con_TFIK. I added a request for this to the NVSE thread in the Bethesda forums about four month ago ... but there hasn't been much traffic there since.

Supposedly they're all very busy with Skyrim and SKSE right now. Who could blame them. :)

 

I have no idea if it is simple or complicated to do but it would really help me out. FootIK consistently messes up all the sex animations I create with Blender. I've been looking for a solution for over a year now (I am pretty sure its something in my animation workflow that causes this mess) but I had very little success.

Basically all animations I make where the actor has a foot raised from the ground gets mess up with FootIK enabled. Sometimes they just alter the foot position a little, at other times the whole actor sinks halfway into the ground ... its discouraging.

Link to comment

Gah! didn't even realise the change walk/run/jump affected NPC's too' date=' regardless as far as I know the only way to alter it is via setting the global in an ESP which I didn't think could be done via scripting, otherwise could just alter Jump/etc while it was used by the player then switch it back.

[/quote']

For the main settings there is GetNumericGameSetting and SetNumericGameSetting which should work the same as just changing the values in the GECK. You can look through that list, there may be values that only affect the player, I haven't checked. I think it'll be the player or everyone though, without the ability to change individual NPCs.

 

The IsSwimming has never worked in NV, possibly it is related to there being no "real" water in NV, even the Dam water is Placeable water. Perhaps some way of detecting that a Swimming animation on an Actor is running currently would do.

 

Yeah and a readble flag for locked will be a must for Sexout :)

 

Interesting about swimming. An IsSwimmingAnimationPlaying function shouldn't be too difficult.

 

Not sure what you mean about "locked."

Link to comment

Chase' date=' since there's nothing there telling you which anim to replace, am I to assume these were all for toggling the anims used for movement? I have a statement and a question about that.

 

Question:

Wouldn't it be 'better' to toggle an entire directory off and on? You could still have the specialanims directory, and beneath that say 'crawl1', 'crawl2', 'boundwalk1', etc directories. Those would contain .kfs with the same names as the vanilla ones, so you'd call it with the subdirectory name you want to use instead, like 'tsa "crawl1" 1'?

 

Statement:

I still strongly believe there's a way to do this in the GECK already, with some scripting help. I started work on this in sexout with the crawling animations, and made some progress, ran into some problems I believe can be solved, and got busy with other stuff.

 

In Sexout.ESMs you can see a node in the tree called "SexoutNGCrawl" and the item to trigger it (just has to be in inventory) is "SexoutNGCrawling".

 

I'm pretty convinced that the right combination of the "Animation Group" in the idle window in the geck, the right conditions on the idles themselves, and (possibly) the right type in the .kf files (may not be 'specialidle' for these) will make this work.

 

If you give yourself the token (xx063065) will cause you to drop to all fours instantly, and turning to face different directions works fine, it is just the actual act of moving that doesn't work right.

[/quote']

 

It doesn't replace animations. Whichever animation has higher priority in the NIF runs. I believe that the OBSE command just turned on/off the animation and let GameBryo decide which animations to run. This was infinitely better than what you and Donkey have been trying to do, as this allows alternate walking/crouching/jumping/etc. animations. I tried to do what you're doing before I found out about ToggleSpecialAnim. All I got was frustration and constant crashes.

 

However, toggling entire folders would be awesome. I was simply regurgitating the original syntax.

Link to comment

Thanks Chase. I still have to dig into the code because I'm not really understanding "how" this is supposed to work. I don't know what picks "data\meshes\(1st or 3rd)\locomotion\female\mtforward.kf" in the vanilla animations, for example, so I don't know where I would override that.

 

I'm sure the OBSE source for the command will supply some insight though.

Link to comment

OP wishlist is updated with the stuff I think everyone has mentioned so far. Emailed the team @ nvse for an opcode range as well, no response yet.

 

I think the next two I'll tackle will be the formlist ones.

 

NX_ClearList

Clear formlists FOR REALZ without manual looping)

 

NX_IsInList

Given an object and a formlist, will return true if:

- The item is in the list

- The base object of the item is in the list (if you passed in a ref)

- The base object of the item matches the base object of any other item in the list.

 

It will do this by getting the base object of whatever you pass in, if it's not a base object already, then looping the list getting the base object of everything there and doing a compare.

 

This brings me to a 3rd list command I will update the OP with:

 

NX_IsInList_R

Same as IsInList except, if it encounters any other formlists, it will search those as well, recursively (since formlists can hold other formlists). This one will be trickier since the references can be circular, but not terribly complex.

Link to comment

I think that the modding community would benefit greatly from a "wait for condition" command.

 

Or, if that is too much work: select statements on small, dense numeric ranges (where we can control the state variable) might be nice for implementing staged action.

Link to comment

Wow' date=' this sounds amazing...

 

You have listed an "change race" command - what about a "change body mesh"?, so new bodys would no longer need body suits (i.e. pregnancy)

[/quote']

 

I will think about that. You'd have to switch not just the mesh, but the texture too, because there's no telling if the current texture is compatible with the mesh you want to switch to.

 

The bodysuits are annoying but they are much safer because they are a mesh + texture combo.

 

What I really want to be able to do is directly affect bones, and I have a sliver of hope that this may be possible. I can definitely get the current skeleton as demonstrated. I may be able to change what skeleton is assigned to an actor. If I can do that, then with the help of niflib, I can change the default values of any scale bones by:

- copying the default skeleton to a new one

- using niflib to manipulate the appropriate bone

- assigning the new scaled skeleton to the actor

 

This is all very much supposition on my part. Any or all of it might not work.

 

I think that the modding community would benefit greatly from a "wait for condition" command.

 

This isn't too much work' date=' it's basically impossible. There is no 'waiting' in scripts beyond what you can do in a script yourself : which is to check a variable or call a function at the start of the script, and then return instantly if it's not what you expect. This is the purpose of all the fDelay block things in my code. You can accomplish a wait for as long as you want, on any condition you want, with this simple structure:

 

 

scn StagedBoilerplateScript

; V1

float fDelay
int stage
float gsp

Begin GameMode
 set gsp to GetSecondsPassed

 set fDelay to (fDelay - gsp)
 if (fDelay > 0)
   return
 endif

 if (0 == stage)
   ; do some stuff

   if ()
     set stage to stage + 10
     if ()
       set fDelay to 
     endif
   elseif ()
     set fDelay to 
   endif

 elseif (10 == stage)
   ; same as stage 0
 elseif (20 == stage)
   ; same as stage 0
 elseif (30 == stage)
   ; same as stage 0
 elseif (40 == stage)
   ; same as stage 0
 end  
End

 

 

 

Or, if that is too much work: select statements on small, dense numeric ranges (where we can control the state variable) might be nice for implementing staged action.

 

Adding new language constructs to the scripting language beyond simple commands is well beyond my ability right now, and a select statement is the mother of all multiple line complex commands. See if the above script will help you. It works fine, is reliable, and easy to understand.

Link to comment

Finding time to work on this, going for the list things first, but getting placeholders in place now...

 

SetOpcodeBase 00002000
You have a plugin installed that is using the default opcode base. (Extensions for NVSE)
This is acceptable for temporary development, but not for plugins released to the public.
As multiple plugins using the same opcode base create compatibility issues, plugins triggering this message may not load in future versions of NVSE.
Please contact the authors of the plugin and have them request and begin using an opcode range assigned by the NVSE team.
RegisterCommand NX_GetVersion (2000)
RegisterCommand NX_IsUsingSkeleton (2001)
RegisterCommand NX_CanEquipItem (2002)
RegisterCommand NX_CanUnequipItem (2003)
RegisterCommand NX_ChangeRace (2004)
RegisterCommand NX_IsFIKEnabled (2005)
RegisterCommand NX_TFIK (2006)
RegisterCommand NX_IsUFOEnabled (2007)
plugin C:\Program Files (x86)\steam\steamapps\common\fallout new vegas\Data\NVSE\Plugins\\nvse_extender.dll (00000001 Extensions for NVSE 00000001) loaded correctly

 

ug going to rename some of these.. consistency ftw..

 

edit: there we go, that's better.

Link to comment

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use