[BETA/WIPz] NifScript

Post » Tue May 17, 2011 12:55 am

This is a Beta release of my OBSE plug-in, NifScript.

NifScript allows scripters to edit Nif files during run-time. Currently, it only has two functions, but I'm interested in adding more. Feedback is massively appreciated: any scripters who would like certain features, let me know. I don't honestly know what the most useful things to have would be. But if there is anything you can do in NifSkope that you would like to do dynamically, this is the place to ask!
NifScript v0.9
- an OBSE plug-in by DragoonWraith
1. Introduction
2. Requirements
3. Installation
3b. Upgrading
4. Proof of Concept
5. Warning
6. Plans
7. Contact
8. Credits

== Introduction ==

NifScript is an OBSE plug-in that allows Oblivion script to operate on Nif files during run-time. Nif files, or NetImmerse Format files, are 3D meshes which are used by Oblivion. These files have long been editable with 3D software and NifTools' excellent NifSkope utility, but certain operations on Nif files have been desirable for scripters and therefore impossible - until now.

More specifically, NifScript uses the NifTools' incredible "C++ library for loading, modifying, and exporting NIF files," NifLib, to create new functions through OBSE's plug-in API. Much thanks to both the OBSE and NifTools teams for their hard work that has made this possible.

NifScript is only just getting started, and currently only has two highly-specialized functions. These functions are beta-only. They have been tested, but will be replaced in the next version. Please do not release any plug-ins using these functions as anything other than a Beta, and please be prepared to switch to the new system when the next version of NifScript becomes available.
  • (string_var:path) [reference.]NifGetAltGrip [ref:weapon]
    • Returns the path (relative to Oblivion\Data\Meshes) to a version of a weapon's nif that uses the opposite number of hands (two-handed to one-handed and vice versa)

  • (string_var:path) [reference.]NifGetOffHand [ref:weapon]
    • Returns the path (relative to Oblivion\Data\Meshes) to a version of a weapon's nif that is set-up to be used as a Shield item, using the weapon to parry attacks


== Requirements ==
  • http://obse.silverlock.org/

OBSE goes in the Oblivion\ folder, not the Oblivion\Data folder like most mods. Please see OBSE's readme for
details. Remember to always start Oblivion using obse_loader.exe when using OBSE.

== Installation ==

With OBMM:
Open OBMM, can click Create. Choose Add Archive, and select this mod's archive; OBMM will fill in the rest for you. Click Create omod, and then Activate the omod to use.

Without OBMM:
Extract this archive to your Oblivion\Data folder. Check the .esp file in the Data Files menu of the Oblivion menu, or in Wrye Bash or OBMM.

For more on installing and using mods, see Dev_akm's http://cs.elderscrolls.com/constwiki/index.php/Oblivion_Mods_FAQ

=== Upgrading ===

Special notes to all of those who used previous versions of NifScript:
I have removed the Proof of Concept mod from this version of NifScript. It simply was never very well written, and it is no longer necessary. It was intended purely to demonstrate the use of NifScript, but there are better alternatives for that now. You should remove the Proof of Concept mod from your list if you have been using it.

To do so, you should create a clean save game: open your game, make sure you have no weapons that have been altered by NifScript (switching back from off-hand or alt-grip versions will give you the original weapons), and Save. Exit the game, and deactivate the Proof of Concept mod. Load your game, say OK to the warning, and Save again. Now go back, install the new version, and continue to play from there.

== Proof of Concept ==

I have removed the Proof of Concept mod. If you have been using it, please remove it (see 3b. about upgrading). If you are looking for a mod with which to use NifScript, I heartily recommend HeX_0ff's Unnecessary Violence, which can be found at TES Nexus.

== Warning ==

This utility creates new files. These do take space on your hard drive.

Included is a Windows Batch file which will delete Nif's altered by NifScript from your hard drive. To use it, simply double-click on the file, and it will remove the files. It does so blindly, it does not know whether or not that file is still needed. Essentially, this cannot be used accept to cleanly removed NifScript from your computer. If you use this Batch file when a save game still needs one of those files, you will get missing mesh icons.

== Plans ==

NifScript has only just gotten started. There are a ton of features enabled by NifLib that could be exposed to Oblivion's script language. Almost anything you can do in NifSkope, could be done by script.

I am currently working on a better file-handling system for NifScript. This should limit, or even eliminate the number of files created by the utility. The functions extant in this version of NifScript will become deprecated in the next version. They will be replaced by a cleaner system.

Any other requests are welcome. Please find the NifScript thread on the Elder Scrolls Forums, and offer feedback and requests.

== Contact ==

The preferred method of contacting me is a PM on the official Elder Scrolls Forums. My user-name is DragoonWraith.

The ESF thread for NifScript (as of this upload) can be found here: http://www.gamesas.com/bgsforums/index.php?showtopic=922622

Notes on my Talk page on the CS Wiki are also acceptable, as are e-mails to this address: dragoonwraith+nifscript[at]gmail.com

Messages or posts on any other forum or website may likely be missed for extended periods of time.

== Credits ==
  • The Oblivion Script Extender team: ianpatt, behippo, and scruggsywuggsy the ferret
    Without OBSE, I would have lost interest in modding Oblivion long, long ago, and without the plug-in API that they created, this project never could have happened

    Special thanks to Scruggs and behippo for answering myriad questions about coding for the OBSE plug-in API, and to Scruggs for implementing new features just for me!

  • The NifTools NifLib team: Shon, amorilia, tazpn, xoalin
    The NifTools team had done all the hard work for me - all I did was provide an interface between OBSE and NifLib. Kudos to them on an incredible piece of work.

    Special thanks to amorilia for answering some questions on Nifs in general, and to tazpn for answering some NifLib specific questions.

  • Timeslip, author of the Oblivion Mod Manager and a C++ BSA Reader
    For his excellent BSA reading code, which he had contributed to the NifTools team. Many thanks for his tireless help in debugging the utility, and many apologies for wasting his time with such a silly mistake! Also thanks for OBMM, which I'm using to distribute this mod.

  • Jean-Loup Gailly and Mark Adler
    The zlib code allows me to read BSA files that I otherwise would not be able to read. zlib is an excellent free utility, one of the best products of open source design to date.

  • Speedo
    Help with statically linking zlib into NifScript.

  • throttlekitty, JDFan, and trollf
    For answering questions that I had about Nifs on the CS Forum.

  • opaj
    For help testing and for working on a better version of the demonstration plugin.

  • HeX_0ff
    For creating Unnecessary Violence, an incredible mod using NifScript, and for general help and feedback on NifScript.


Warning
This utility creates new files. These do take space on your hard drive.

Included is a Windows Batch file which will delete Nif's altered by NifScript from your hard drive. To use it, simply double-click on the file, and it will remove the files. It does so blindly, it does not know whether or not that file is still needed. Essentially, this cannot be used except to cleanly remove NifScript from your computer. If you use this Batch file when a save game still needs one of those files, you will get missing mesh icons.

Download:
  • from http://tesnexus.com/downloads/file.php?id=21292

Please post any ideas you have for the utility here!
User avatar
Rik Douglas
 
Posts: 3385
Joined: Sat Jul 07, 2007 1:40 pm

Post » Tue May 17, 2011 3:29 am

:ooo: Sounds really interesting!
User avatar
Yama Pi
 
Posts: 3384
Joined: Wed Apr 18, 2007 3:51 am

Post » Tue May 17, 2011 6:01 am

I gotta say, you sure know how to make modders happy. I imagine this will rapidly become as populair as OBSE itself. :D

One question to check if I understand it correctly. When you say it returns the path to the other version of a weapon, I'm guessing that that version's nif will be created if it's not already there? :unsure:
User avatar
Maria Leon
 
Posts: 3413
Joined: Tue Aug 14, 2007 12:39 am

Post » Tue May 17, 2011 4:21 pm

This is crazy amazing!

Just when I start to get comfortable in the "easy stuff" the real programmers come up with something 1000 times over my head.

But it is not so far over my head that I cannot appreciate the work you must have put into this.

Thank you DragoonWraith!
User avatar
Amelia Pritchard
 
Posts: 3445
Joined: Mon Jul 24, 2006 2:40 am

Post » Tue May 17, 2011 12:35 am

You, sir, are a god.

Dangit, I was going to play some Morrowind tonight, but there's too much great stuff getting released for Oblivion lately.


[Edit]

As for deleting nif files, is there a way to somehow tag a file so the script can tell it was made by this plugin? That way, if you add a nifdelete function, it won't delete nifs that the mod itself didn't create?


[Edit 2]

A comment on the TESNexus download makes another question pop into mind: is it possible to perform body deformations on clothing and whatnot using scripts? I have little understanding of what we can do with meshes, so excuse me if this is a stupid question; I'd think such an operation would probably have to be done by hand, given the diverse sources of different meshes and what have you, but it seems like it's worth asking.
User avatar
Brooke Turner
 
Posts: 3319
Joined: Wed Nov 01, 2006 11:13 am

Post » Mon May 16, 2011 11:54 pm

Wow

Could it beee? ^^

I always thought "someday.. something big will appear" and here it is ;)

I have just one Question: Is it possible, for future releases, that not just Nif Files can be changed, but also the paths of _male for the IDLEs? This would be the greatest thing on earth, i have waited so long for this ;)

Keep up the good work

GreeTz Terry
User avatar
Veronica Flores
 
Posts: 3308
Joined: Mon Sep 11, 2006 5:26 pm

Post » Tue May 17, 2011 1:46 pm

Now I feel that oblivion is one, or two step closer to dual wielding.
User avatar
Carolyne Bolt
 
Posts: 3401
Joined: Mon Jul 10, 2006 4:56 am

Post » Tue May 17, 2011 12:00 am

Changing the NIF file settings sounds very interesting.
Would it theoretically be possible to change the TEXTURE.DDS paths?
If it is, then we could get seasons to change over time correct.

If it can be done, maybe it could work like this.
We need TEXTURE maps for the four different seasons.

1. Spring.
2. Summer.
3. Autumn.
4. Winter.

All the textures from the meshes in the static folder get assigned to the correct season TEXTURE map.

I do not know how the ground textures work, but if we could change them according to the season change.
Then we will have a white Christmas this year in the lands of Tamriel.
User avatar
Brad Johnson
 
Posts: 3361
Joined: Thu May 24, 2007 7:19 pm

Post » Tue May 17, 2011 8:04 am

Got a small problem. When I load the cs with this plugin installed I first get a strange zlib.dll error and then it doesn't recognize the commands. :unsure:

Oh and here's what the obse.log says
checking plugin D:\Program Files\Oblivion\Data\OBSE\Plugins\\NifScript.dll
couldn't load plugin D:\Program Files\Oblivion\Data\OBSE\Plugins\\NifScript.dll


P.S. I know the zlib.dll error usually means I need to reinstall the cs but it disappeares as soon as I delete the NifScript.dll. :shrug:
User avatar
Your Mum
 
Posts: 3434
Joined: Sun Jun 25, 2006 6:23 pm

Post » Tue May 17, 2011 12:27 pm

Is it possible to have the off-hand weapon do damage?
User avatar
Kelly Tomlinson
 
Posts: 3503
Joined: Sat Jul 08, 2006 11:57 pm

Post » Tue May 17, 2011 12:39 pm

Is it possible to have the off-hand weapon do damage?

That would be the province of another mod; this plug-in helps facilitate it, but in fact is just an incredibly awesome tool we need to achieve this goal and not the goal itself... (okay, I think I'm tired, that sentence didn't sound right.)

Anyway, I'm working on updating the PoC mod packaged with the plug-in, to wrinkle out the bugs and allow different advantages/disadvantages depending on how you use your weapon. There will be much better versions of the mod in the future, but I am impatient so I'm making a quick one now.
User avatar
SEXY QUEEN
 
Posts: 3417
Joined: Mon Aug 13, 2007 7:54 pm

Post » Tue May 17, 2011 4:27 pm

That would be the province of another mod; this plug-in helps facilitate it, but in fact is just an incredibly awesome tool we need to achieve this goal and not the goal itself... (okay, I think I'm tired, that sentence didn't sound right.)

Anyway, I'm working on updating the PoC mod packaged with the plug-in, to wrinkle out the bugs and allow different advantages/disadvantages depending on how you use your weapon. There will be much better versions of the mod in the future, but I am impatient so I'm making a quick one now.


I realise its down to a modder to make the mod, I was just wondering if its now theorecticly possible with this plugin.
User avatar
Channing
 
Posts: 3393
Joined: Thu Nov 30, 2006 4:05 pm

Post » Tue May 17, 2011 6:41 am

I realise its down to a modder to make the mod, I was just wondering if its now theorecticly possible with this plugin.

Ah, gotcha. This mod doesn't really effect that. I know it's possible to have an extra button to do a separate attack with your off-hand, and with some fancy animation-trickery and wacky use of scripting/hidden stats (attackbonus), you could simulate the extra weapon attacking (though I think it would make all NPCs act like they're dual-wielding).

If you haven't already, check out the mod Ambidexterie, I think it's on the second page of the forums now. That's an example of what can be done, though the mod isn't exactly finished.
User avatar
Je suis
 
Posts: 3350
Joined: Sat Mar 17, 2007 7:44 pm

Post » Tue May 17, 2011 7:50 am

Will do thanks :)
User avatar
natalie mccormick
 
Posts: 3415
Joined: Fri Aug 18, 2006 8:36 am

Post » Tue May 17, 2011 2:41 am

This is fantastic! At least I think it is. I'm kinda tired right now.. But it seems like it will open up for several very interesting possibilities :D
What could one, for example, do about the body-nifs? Are we that much closer to having varied NPC bodies? (Finally escaping the "strapping young 80-year old beggar" :P)
User avatar
Karine laverre
 
Posts: 3439
Joined: Tue Mar 20, 2007 7:50 am

Post » Tue May 17, 2011 3:44 pm

I do not know how the ground textures work, but if we could change them according to the season change.
Then we will have a white Christmas this year in the lands of Tamriel.

Goodness, that would be very epic.
User avatar
Samantha Pattison
 
Posts: 3407
Joined: Sat Oct 28, 2006 8:19 pm

Post » Tue May 17, 2011 1:08 pm

by kyoma at Dec 8 2008, 02:39 AM http://www.gamesas.com/index.php?act=findpost&pid=13383120
I gotta say, you sure know how to make modders happy. I imagine this will rapidly become as populair as OBSE itself. :D

Heh, I doubt it, but I am glad to see interest!

by kyoma at Dec 8 2008, 02:39 AM http://www.gamesas.com/index.php?act=findpost&pid=13383120
One question to check if I understand it correctly. When you say it returns the path to the other version of a weapon, I'm guessing that that version's nif will be created if it's not already there? :unsure:

Ah, yes, sorry if that was unclear.

by spookyfx.com at Dec 8 2008, 03:01 AM http://www.gamesas.com/index.php?act=findpost&pid=13383167
This is crazy amazing!

Just when I start to get comfortable in the "easy stuff" the real programmers come up with something 1000 times over my head.

But it is not so far over my head that I cannot appreciate the work you must have put into this.

Thank you DragoonWraith!

Ironically, it really wasn't that hard. The OBSE and NifLib teams did all the heavy lifting, I just communicate between them. Everything someone would need to make this has existed v0011 of OBSE (for the plug-in interface); some functionality would be different (without string_var's), but it still would have been possible. I was just the first one to do it.

by opaj at Dec 8 2008, 05:58 AM http://www.gamesas.com/index.php?act=findpost&pid=13383509
You, sir, are a god.

Dangit, I was going to play some Morrowind tonight, but there's too much great stuff getting released for Oblivion lately.

Hehe, well, that's a good problem to have, no? Thank you.

by opaj at Dec 8 2008, 05:58 AM http://www.gamesas.com/index.php?act=findpost&pid=13383509
As for deleting nif files, is there a way to somehow tag a file so the script can tell it was made by this plugin? That way, if you add a nifdelete function, it won't delete nifs that the mod itself didn't create?

Yes, and it already does tag Nif's (the tagging actually needs work, I think), but the problem is how do you know that the file isn't still being used, by some savegame somewhere? That's where I'm just like, uh... great. Because if I delete a file that a savegame is still using, you get the big ugly ! thing.


by opaj at Dec 8 2008, 05:58 AM http://www.gamesas.com/index.php?act=findpost&pid=13383509
A comment on the TESNexus download makes another question pop into mind: is it possible to perform body deformations on clothing and whatnot using scripts? I have little understanding of what we can do with meshes, so excuse me if this is a stupid question; I'd think such an operation would probably have to be done by hand, given the diverse sources of different meshes and what have you, but it seems like it's worth asking.

Honestly, I don't know. I'm not overly familiar with non-weapon Nif's, to be honest. If some modelers have some input here, that'd be good.

by TerryDonelli at Dec 8 2008, 07:59 AM http://www.gamesas.com/index.php?act=findpost&pid=13383818
Wow

Could it beee? ^^

I always thought "someday.. something big will appear" and here it is ;)
[...]
Keep up the good work

GreeTz Terry

Ah, bigger things than this have been released before! Still, thank you.

by TerryDonelli at Dec 8 2008, 07:59 AM http://www.gamesas.com/index.php?act=findpost&pid=13383818
I have just one Question: Is it possible, for future releases, that not just Nif Files can be changed, but also the paths of _male for the IDLEs? This would be the greatest thing on earth, i have waited so long for this ;)

Perhaps, but wouldn't that affect everyone, not just the player? Forgive me, I'm not overly familiar with animations, either.

by BotMan at Dec 8 2008, 08:04 AM http://www.gamesas.com/index.php?act=findpost&pid=13383829
Now I feel that oblivion is one, or two step closer to dual wielding.

Yup, we are. Still not there, but this is a step in the right direction, a major stumbling block removed.

by Sjors_Boomscors at Dec 8 2008, 08:23 AM http://www.gamesas.com/index.php?act=findpost&pid=13383880
Changing the NIF file settings sounds very interesting.
Would it theoretically be possible to change the TEXTURE.DDS paths?
If it is, then we could get seasons to change over time correct.

If it can be done, maybe it could work like this.
We need TEXTURE maps for the four different seasons.

1. Spring.
2. Summer.
3. Autumn.
4. Winter.

All the textures from the meshes in the static folder get assigned to the correct season TEXTURE map.

I do not know how the ground textures work, but if we could change them according to the season change.
Then we will have a white Christmas this year in the lands of Tamriel.

Yes, being able to change the path in the NiSourceTexture node is planned. But without pre-made textures, I'm not sure how it will help here? Still, for the sake of getting visual seasons, I will bump that up higher on my todo list.

by kyoma at Dec 8 2008, 08:29 AM http://www.gamesas.com/index.php?act=findpost&pid=13383895
Got a small problem. When I load the cs with this plugin installed I first get a strange zlib.dll error and then it doesn't recognize the commands. :unsure:

Oh and here's what the obse.log says

P.S. I know the zlib.dll error usually means I need to reinstall the cs but it disappeares as soon as I delete the NifScript.dll. :shrug:

Hmm... I use zlib for going through .bsa files. But you shouldn't need to have zlib for this to work... I'll have to double-check on how that works. I'll get back to you.

Glad to hear that you're trying to use it, though!

by InsanitySorrow at Dec 8 2008, 08:51 AM http://www.gamesas.com/index.php?act=findpost&pid=13383974
Is it possible to have the off-hand weapon do damage?

As opaj explained very well, that's not something this mod can do. Is it theoretically possible - I think so. The trick is being able to change animations while the player has two weapons versus not. In order to that, I think OBSE will have to add some more functionality; I don't think that is yet possible.

by Setsuei at Dec 8 2008, 10:35 AM http://www.gamesas.com/index.php?act=findpost&pid=13384320
This is fantastic! At least I think it is. I'm kinda tired right now.. But it seems like it will open up for several very interesting possibilities :D
What could one, for example, do about the body-nifs? Are we that much closer to having varied NPC bodies? (Finally escaping the "strapping young 80-year old beggar" :P)

Unfortunately, I'm thinking that the answer is probably no, at least in terms of what this can do. I can change the Nif file for the body, but nothing I do can change the fact that every race, and every member of every race, uses the same body mesh. If that ever changes (and I hope it does), it will have to be done by someone more talented than I.
User avatar
James Shaw
 
Posts: 3399
Joined: Sun Jul 08, 2007 11:23 pm

Post » Tue May 17, 2011 2:40 am

OK, so I've figured out what's up with zlib1.dll - apparently it's linked dynamically, not statically, with NifScript. This is irritating, because it means that you need it in order to run this.

This affects both the game and the editor!

For now, you can find zlib http://www.zlib.net/zlib123-dll.zip. The included zlib1.dll file goes in your WINDOWS\system32 folder. The other files you can safely ignore unless you want to do some C++ coding of your own using zlib.

I will attempt to figure out how to statically link zlib so you don't need to have it for this work.
User avatar
Tanya
 
Posts: 3358
Joined: Fri Feb 16, 2007 6:01 am

Post » Tue May 17, 2011 12:31 am

Awsome work. :)


Just one Question:
Would it be possible to change the value of the NiStringExtraData and the position and rotation of the NiTriStrips (I made http://www.npshare.de/files/72220eb9/Nif.jpg in NifScope, so I hope this can clear things up a little bit).
That's everything I'd need to remove the Requirement for extra *.nif-files for my BackShield-Plugin. :)
User avatar
CYCO JO-NATE
 
Posts: 3431
Joined: Fri Sep 21, 2007 12:41 pm

Post » Tue May 17, 2011 2:29 pm

Really? That's it? Awesome, yes, that's trivial. It's almost exactly what I do for the off-hand bit. I'll work on that as soon as I have this zlib business sorted out.
User avatar
josie treuberg
 
Posts: 3572
Joined: Wed Feb 07, 2007 7:56 am

Post » Tue May 17, 2011 10:43 am

Really? That's it? Awesome, yes, that's trivial. It's almost exactly what I do for the off-hand bit. I'll work on that as soon as I have this zlib business sorted out.


Jup, everything else is done by shifting a few variables, make a lot of checks and changing the Modelpath for the Shield. ;)
Would be superdupercool if you could add this. Thanks in advance. :)
User avatar
OTTO
 
Posts: 3367
Joined: Thu May 17, 2007 6:22 pm

Post » Tue May 17, 2011 1:40 pm

If you hover over the Rotation entry in the NiTriStrips, a box will appear with a 3x3 matrix. I'll need that to apply the rotation; internally it does not use the PXYZ coordinates. You could also do the same to give me the 3x1 matrix (vector) for translation, if you like (though I'm pretty sure it will just match the XYZ in the screenshot).

Is it safe to apply the same translation/rotation to every shield? That would be fairly crucial to doing this simply.

Alternatively, I could just create functions to apply translation and rotation yourself, so you can fiddle with the numbers yourself. I'd need to come up with some scheme for how modders will refer to each of the NiTriStrips (probably something like NifSetNthAVObjTranslation, NifSetNthAVObjRotation, etc)...
User avatar
My blood
 
Posts: 3455
Joined: Fri Jun 16, 2006 8:09 am

Post » Tue May 17, 2011 6:11 am

Does anyone use compressed BSAs? I can just remove zlib entirely if I drop support for compressed BSAs. The default BSAs, I'm fairly sure, are not compressed...

EDIT: Nevermind, that doesn't work anyway.
User avatar
Rob Smith
 
Posts: 3424
Joined: Wed Oct 03, 2007 5:30 pm

Post » Tue May 17, 2011 12:43 pm

Does anyone use compressed BSAs? I can just remove zlib entirely if I drop support for compressed BSAs. The default BSAs, I'm fairly sure, are not compressed...


If the defualt ones are not compressed, then no, not heard of any mods using compressed BSAs.
User avatar
Beast Attire
 
Posts: 3456
Joined: Tue Oct 09, 2007 5:33 am

Post » Tue May 17, 2011 4:06 pm

Well, regardless, I crash when I try to read a file out of Oblivion - Meshes.bsa, so it must be compressed at least somewhat. Interesting, I did not know that.
User avatar
Naomi Lastname
 
Posts: 3390
Joined: Mon Sep 25, 2006 9:21 am

Next

Return to IV - Oblivion