[BETA/WIPz] NifScript

Post » Tue May 17, 2011 9:41 am

I'd be willing to take a shot at updating Cobl's scripts, though I'm not sure what their policy is on OBSE plugin dependencies (or whether Cobl is even being maintained now that Wrye is retired).
haama's the current curator of Cobl, if I recall correctly.
User avatar
Britney Lopez
 
Posts: 3469
Joined: Fri Feb 09, 2007 5:22 pm

Post » Tue May 17, 2011 10:12 am

Are there really that many different models for alchemy equipment?

I'd think with a limited number of meshes to deal with, it would be easier to provide pre-modified meshes than to introduce a Nifscript dependency to Cobl.
User avatar
Victoria Bartel
 
Posts: 3325
Joined: Tue Apr 10, 2007 10:20 am

Post » Tue May 17, 2011 2:53 am

That'd be a good fallback for players who don't have NifScript, but a driving design goal behind all Wrye's stuff is extensibility and interoperability. I think it'd be in the spirit of Cobl for it to work correctly with all alchemy equipment, even ones added by mods.
User avatar
Clea Jamerson
 
Posts: 3376
Joined: Tue Jun 20, 2006 3:23 pm

Post » Tue May 17, 2011 3:51 am

If NifScript supports (or will support) removing Havok data from models for showler's armor stands, the same could probably be used to fix Cobl's static alchemy equipment. I'd be willing to take a shot at updating Cobl's scripts, though I'm not sure what their policy is on OBSE plugin dependencies (or whether Cobl is even being maintained now that Wrye is retired).

Yup, if I can get Showler's thing working, then you could also do this. Feel free to e-mail me ( dragoonwraith [at] gmail.com ) if you're interested in the alpha. That goes for everyone. Showler, I got your e-mail, so you're good.
User avatar
Rachie Stout
 
Posts: 3480
Joined: Sun Jun 25, 2006 2:19 pm

Post » Tue May 17, 2011 4:16 am

It's remarkable what you achieved so far! You're doing a damn good job on this.

Just a question out of interest, because I've seen the many new functions like accessing nodes' children and removing them... would it some day be possible to also "add" child nodes? Nothing fancy, rather like opening one NIF file as the source and another as the target and then "merging them" in an automated way. Of course one has to require the armature NiNodes needed for this are all present, else the function will fail, as NifSkope does when you didn't transfer those nodes prior to the NiTriShapes/Strips you're really interested in.

It would be the same as we all can do already the manual way via NifSkope. But being able to let your scripts do that during runtime would improve not only my own mods.

So is this possible, maybe in the future? Or is it just too much to even consider currently?
User avatar
Gill Mackin
 
Posts: 3384
Joined: Sat Dec 16, 2006 9:58 pm

Post » Tue May 17, 2011 3:37 am

I'm planning on doing that, yes. I'm pretty sure it's possible. NifAddChild would be in this, except that there's just way too much to do to set one up from scratch.
User avatar
Jeneene Hunte
 
Posts: 3478
Joined: Mon Sep 11, 2006 3:18 pm

Post » Tue May 17, 2011 9:42 am

I'm not using NifScript and haven't been following its development, but after seeing the talk about Universal Armor Stands in the OBSE thread, I thought I'd pop in and point out another potential use that sprang to mind.

Cobl provides a set of http://www.uesp.net/wiki/Tes4Mod:Cobl/Modding/Static_Alchemy_Equipment, which are scripted activators that a modder can place in a cell. Initially they look like empty alchemy equipment stands with no glassware in them, but when the player activates one while holding alchemy equipment, the script takes the equipment out of the player's inventory and copies its model path to the activator so it looks like the player's equipment was placed on the table. After that, the player can use the static alchemy equipment like normal alchemy equipment.

The trouble is that although the initial (empty stands) models are immobile, the real alchemy equipment models have Havok data, so when those models are copied to the static alchemy equipment, they can be bumped around, fall off the table, picked up with the Z key and thrown across the room, or whatever -- despite having names like "Stationary Alembic" when you look at them, and being intended to stay where the modder placed them.

If NifScript supports (or will support) removing Havok data from models for showler's armor stands, the same could probably be used to fix Cobl's static alchemy equipment. I'd be willing to take a shot at updating Cobl's scripts, though I'm not sure what their policy is on OBSE plugin dependencies (or whether Cobl is even being maintained now that Wrye is retired).


I've been watching the NifScript project with interest, but I don't think it would warrant being added as yet another dependency for Cobl for this particular instance. I'm sure that there will be other innovative reasons to consider including it later on though.

Cobl provides two modes for static alchemy items. One with OBSE enabled, and one without OBSE enabled.

The OBSE enabled version uses the copymodelpath function to copy the model path. When I coded the scripts for that portion, I did mean for the player to be able to pick up and move the objects around. They were stationary in the fact that you couldn't pick them up into your inventory, not that they couldn't move at all.

The non-OBSE enabled version was more interesting to implement since I'm a scripter/coder, but had to do some actual modeling. I went through a bunch of scripting options that worked, but were flawed...ultimately I created new animated models. I merged each of the standard apparatuses levels (apprentice through grandmaster) into a single nif, and switched between them with different animation groups using a vis controller. For the empty stands, I just removed the glass portion of the apparatuses, and merged a pestle with a piece of paper for the empty mortar & pestle. For these, they are all immobile. I meant for the two options to be available to the end modder to choose between.

I provided the models and scripts to haama, but I don't recall exactly how he implemented them. I don't know if the OBSE version is automatically used if OBSE is present, or if the modder was allowed to choose which version to use. Really, the non-OBSE version worked out so nicely that I personally use a custom version of it in my games.

So, what I guess I'm saying is that this might simply be solved by using the non-OBSE version of the scripts. This might mean getting haama to change the scripts slightly so that the OBSE version isn't automatically used. I coulda sworn though that the modder was allowed to choose between the two modes :shrug:
User avatar
Neliel Kudoh
 
Posts: 3348
Joined: Thu Oct 26, 2006 2:39 am

Post » Tue May 17, 2011 5:20 am

I'm surprised: it sounds like you're saying that what I thought was a bug is actually a feature. Given the limitations of Havok and the Z key, I'd actually prefer that the objects be immobile; otherwise there's not much difference from just putting regular alchemy equipment on the table and using http://www.tesnexus.com/downloads/file.php?id=5478.

As far as adding a NifScript dependency to Cobl, I figured the new code could be put within IsPluginInstalled/GetPluginVersion checks so that the dependency is completely optional. If it isn't, degrade gracefully by using pre-made immobile models for the stock equipment and just using CopyModelPath (the way it currently works) for mod-added ones.

The UESP page I linked to in my previous post doesn't mention any way to choose the OBSE or non-OBSE implementation, but I'll have to take a look at the scripts sometime to see if it's there but just not documented. If I can switch to the non-OBSE implementation, that'd work for my own preference, but I still think it'd be fun to try doing it with NifScript. :)
User avatar
SaVino GοΜ
 
Posts: 3360
Joined: Mon Sep 17, 2007 8:00 pm

Post » Tue May 17, 2011 3:00 pm

I'm surprised: it sounds like you're saying that what I thought was a bug is actually a feature. Given the limitations of Havok and the Z key, I'd actually prefer that the objects be immobile; otherwise there's not much difference from just putting regular alchemy equipment on the table and using http://www.tesnexus.com/downloads/file.php?id=5478.

As far as adding a NifScript dependency to Cobl, I figured the new code could be put within IsPluginInstalled/GetPluginVersion checks so that the dependency is completely optional. If it isn't, degrade gracefully by using pre-made immobile models for the stock equipment and just using CopyModelPath (the way it currently works) for mod-added ones.

The UESP page I linked to in my previous post doesn't mention any way to choose the OBSE or non-OBSE implementation, but I'll have to take a look at the scripts sometime to see if it's there but just not documented. If I can switch to the non-OBSE implementation, that'd work for my own preference, but I still think it'd be fun to try doing it with NifScript. :)

Well, it's a feature that was a bug. Or, a bug that was a feature. I liked the idea of the player having some say in where the alchemy set was placed, so I wasn't concerned that the CopyModelPath affected havok. I couldn't do anything about it anyway. I realized that it had its limitations though, so I made the non-obse version to be immobile. It was all about choice.

I just glanced at the COBL script and didn't see any way to choose the implementation. It's pretty heavily changed from what I submitted though, so haama would be the best person to ask. It would be extremely trivial to add a customized script that only uses the non-obse approach. Just strip out the OBSE check, save it as a new script, and let modders choose to use it.

You're right that it could be set up with the IsPluginInstalled check. It certainly wouldn't hurt. And, the fact that it'd be fun to do is always a good reason to mess with it :hubbahubba:

Considering the possibilities that NifScript open up, I'd be surprised if Cobl didn't use it at some point regardless.
User avatar
Tamara Dost
 
Posts: 3445
Joined: Mon Mar 12, 2007 12:20 pm

Post » Tue May 17, 2011 4:51 am

Is it me or does niflib doesn't offer a way to do a switch on node->GetType()?
Apparently it returns a class, why didn't they make it an enum?

DragoonWraith if you have any tips working with this lib I'd welcome them, I'm quite confused at the moment :).

edit:
Ok and is it me or is it VERY slow(and buggy)?
Trying to open rockgreatforest970.nif(apparently takes a few seconds to parse...):
Error: End of file reached prematurely.  This NIF may be corrupt or improperly supported.Last successfuly read object was:====[ Object 6 | bhkRigidBodyT ]====


I think I may end up recoding my own parser for this...
User avatar
Ridhwan Hemsome
 
Posts: 3501
Joined: Sun May 06, 2007 2:13 pm

Post » Tue May 17, 2011 4:01 pm

Hmm - what are you doing with Niflib?

At any rate - I have found Niflib excellently done, fast, responsive, and stuff just works as expected. The documentation is incredibly thorough. I can open several nif's per frame while running Oblivion without noticeable slowdown.

GetType() returns a class because it has member functions that are reasonably useful - GetTypeName(), IsSameType(), and most importantly, IsDerivedType(). Also operator<(), but I'm not sure what that's there for.

What's your code for opening the Nif?
User avatar
CHangohh BOyy
 
Posts: 3462
Joined: Mon Aug 20, 2007 12:12 pm

Post » Tue May 17, 2011 2:39 pm

I just made a quick thingie to test it:

void Load_Mesh(){	unsigned long index;	NiObjectRef root=ReadNifTree("rockgreatforest970.nif");	NiNodeRef node = DynamicCast(root);	if(node==NULL) throw L"Error casting first object...";	vector refs=node->GetChildren();	for(index=0;indexasString() << endl;	}}int _tmain(int argc, _TCHAR* argv[]){	try {		Load_Mesh();	}	catch(exception &e)	{		cout << "Error: " << e.what() << endl;	}	catch(...)	{		cout << "Unknown Exception..." << endl;	}	return 0;}

User avatar
Hayley Bristow
 
Posts: 3467
Joined: Tue Oct 31, 2006 12:24 am

Post » Tue May 17, 2011 8:33 am

You should include the optional Niflib::NifInfo second argument in ReadNifTree; I don't think that's what's causing the error but without it you will not be able to save Nif's correctly (you just pass it to ReadNifTree, and then hold onto it until you pass it back to WriteNifTree). I assume "rockgreatforest970.nif" is in your working directory? Have you tried passing the full path just to be sure?

Also, what's the L in the throw L"Error casting first object." line? That looks... wrong. Again, probably not the source of your trouble.
User avatar
Angel Torres
 
Posts: 3553
Joined: Thu Oct 25, 2007 7:08 am

Post » Tue May 17, 2011 1:53 pm

You should include the optional Niflib::NifInfo second argument in ReadNifTree; I don't think that's what's causing the error but without it you will not be able to save Nif's correctly (you just pass it to ReadNifTree, and then hold onto it until you pass it back to WriteNifTree). I assume "rockgreatforest970.nif" is in your working directory? Have you tried passing the full path just to be sure?

Also, what's the L in the throw L"Error casting first object." line? That looks... wrong. Again, probably not the source of your trouble.


I don't want to save nif files, just read them(it's for my oblivion renderer).
Yep it's in the active directory(it reads it up to a point as the exception indicates).
The L indicates wide char string.
Just forgot to add catch(WCHAR *wcharexception) in the exception catch list(just used it as I use it to throw critical errors around in my renderer, force of habit).
I can't believe I implemented havok to get stuck on this...

I tried to add the NifInfo just in case and got the same error...
Ok just realized that the lib I grabbed may be outdated, grabbing the current version through svn...

edit:
Alright, used the last revision and it worked just fine :).
User avatar
Danny Blight
 
Posts: 3400
Joined: Wed Jun 27, 2007 11:30 am

Post » Tue May 17, 2011 5:08 am

Oh, well that's good! Glad to hear you've gotten it working.

On the NifScript end: I want to do a bit of refactoring, as currently I'm maintaining vectors of pointers (actually Refs, which are a type of smart pointer used by Niflib) to the various sub-nodes of the root, but if the list itself changes (i.e. adding or deleting one), I need to refresh the list - and honestly I think it would just be easier to keep using their lists. Unfortunately, the ExtraData list is a List, not a Vector, which... kinda svcks. Still deciding how i want to use that.
User avatar
Jordyn Youngman
 
Posts: 3396
Joined: Thu Mar 01, 2007 7:54 am

Post » Tue May 17, 2011 3:05 pm

Feature request:

Ability to switch between Normal-grip and Backwards-Gripped mode (AKA "Starkiller" or "Galen Marek" mode)

Not sure what kind of useage it would get, but it would be a good feature to have nonetheless.
User avatar
Teghan Harris
 
Posts: 3370
Joined: Mon Mar 05, 2007 1:31 pm

Post » Tue May 17, 2011 1:35 am

That... means absolutely nothing to me.

I assume you mean Normal versus Reverse grip - and that could be done with the rotation functions. However, doing so may not look right on some weapons, and definitely won't look right with the attack animations.
User avatar
Jinx Sykes
 
Posts: 3501
Joined: Sat Jan 20, 2007 11:12 pm

Post » Tue May 17, 2011 2:05 pm

That... means absolutely nothing to me.

I assume you mean Normal versus Reverse grip - and that could be done with the rotation functions. However, doing so may not look right on some weapons, and definitely won't look right with the attack animations.


Yeah... reverse-grip is exactly what I meant. I'm not sure what the actual name for it is called.
User avatar
Mizz.Jayy
 
Posts: 3483
Joined: Sat Mar 03, 2007 5:56 pm

Post » Tue May 17, 2011 10:24 am

Wikipedia says Reverse Grip is what it's called. *shrug*

Anyway, status update is that I've been a bum and haven't done much with this recently. I think it's time to call it quits on adding features (I'm just going to remove NifAddExtraData for now; does anyone even want that?), and send out the alpha this weekend, I think.
User avatar
Harinder Ghag
 
Posts: 3405
Joined: Wed Jan 17, 2007 11:26 am

Post » Tue May 17, 2011 6:41 am

And for those who have this bookmarked or whatever: http://www.gamesas.com/index.php?/topic/1089336-alpha-nifse-v10/.
User avatar
Sharra Llenos
 
Posts: 3399
Joined: Wed Jan 17, 2007 1:09 pm

Post » Tue May 17, 2011 10:45 am

We'll shut this one down then.
User avatar
Veronica Flores
 
Posts: 3308
Joined: Mon Sep 11, 2006 5:26 pm

Previous

Return to IV - Oblivion