Jump to content

[WIPz] TES5Edit


zilav

Recommended Posts

(1) Yes, this ID field does always point to the addon index (unless it is -1, which means that the respectibve mod does not come with its individual 3D art).

(2) Zero is valid only if an add-on with that index exists.

This requires further explanation: In this example, there is no default 3D art for the armor piece existing. Each of the three possible variants (light, medium and heavy)  has its own 3D art. They are all generated via mods (i.e. that armor piece always has one of the specified mod combinations active).  Which one is active is determined via keywords (these are specified in the keyword record within the combination: if there is more than one keyword specified, the item must have them all for the respective combination to be selected). The appropriate keyword is added to the item via leveled lists. In the case of the example armor, there are three leveled lists existing that have this armor as the only item, but each of these lists adds a different keyword.

In other cases (actually, in most cases), there is an unmodded variant, to which the mods can be added at a workbench (i.e. in game by the player) or on a random basis if a mod combination has the 'if_Epic_Restricted' keyword specified (this is done by the game automatically if the leveled list that distributes the item has an epic chance global specified). The zero index is reserved for that unmodded variant.

It's also worth noting that an index may be shared by several add-ons. So to say, one can 'assemble' armors from several add-on models. If a mod points to a certain index, the game will render all add-ons with that index.

EDIT:

Another detail:  the add-ons do not need to have running numbers. For example, the leather armor torso in Fallout4.esm is using add-on indices 1, 2, 3, 11, 12, and 13.

Link to comment
Share on other sites

7 minutes ago, Sclerocephalus said:

(1) Yes, this ID field does always point to the addon index (unless it is -1, which means that the respectibve mod does not come with its individual 3D art).

(2) Zero is valid only if an add-on with that index exists.

I added the check and ran it on vanilla armors, something is definitely wrong with a simple index checking you propose https://pastebin.com/raw/XeXSUu5r

Link to comment
Share on other sites

While we're at it, there is another thing that could be improved: note the first two records within a combination; they are displayed as OBTF and FULL Name. The OBTF record appears to be separate, but this is in fact a flag that applies to the handling of the FULL Name record specifically.  There are essentially two states of the OBTF field: enabled or disabled (in the latter case, xEdit will display it grayed-out), but it never holds a value (I assume that it can't even hold one - that's one thing I did not try, shame on me ...):

(!) if enabled, the FULL Name will only appear in the editor (i.e. it merely serves as a designer comment)

(2) if disabled however, the FULL name will be used to replace the name of the item in-game if the respective mod is active.

 

Link to comment
Share on other sites

2 minutes ago, zilav said:

I added the check and ran it on vanilla armors, something is definitely wrong with a simple index checking you propose https://pastebin.com/raw/XeXSUu5r

I'm going to investigate it and let you know later what came out (time to sleep over here ...).

Link to comment
Share on other sites

2 minutes ago, Sclerocephalus said:

While we're at it, there is another thing that could be improved: note the first two records within a combination; they are displayed as OBTF and FULL Name. The OBTF record appears to be separate, but this is in fact a flag that applies to the handling of the FULL Name record specifically.  There are essentially two states of the OBTF field: enabled or disabled (in the latter case, xEdit will display it grayed-out), but it never holds a value (I assume that it can't even hold one - that's one thing I did not try, shame on me ...):

This is how Bethesda implemented that - the presense of OBTF subrecord is the flag by itself, it doesn't hold or need any actual value. That's why I named OBTF "Editor Only".

Link to comment
Share on other sites

1 minute ago, zilav said:

This is how Bethesda implemented that - the presense of OBTF subrecord is the flag by itself, it doesn't hold or need any actual value. That's why I named OBTF "Editor Only".

 

Ahhh, I see. My point was that it doesn't become clear immediately that this flag controls the handling of the FULL name record (i.e. that the two records are related).

Link to comment
Share on other sites

Just now, Sclerocephalus said:

 

Ahhh, I see. My point was that it doesn't become clear immediately that this flag controls the handling of the FULL name record (i.e. that the two records are related).

I can slap some other label on OBTF to make it more clear, name what you want :)

Link to comment
Share on other sites

I've only checked the first one on your list now, but there's evidence already that we may have stumbled upon a pile of bugs. There was a faint chance that none of these records would actually be used in the game (Fallout4.esm has quite a number of unused stuff), but that one is.

This is still a preliminary impression though because I still have to check whether the keywords controlling the misconfigured combinations are ever actually applied to that armor.

EDIT:

Got it. There are leveled lists that apply the leyword, but they all end up in a higher level object that has no users in the game. So the faulty mods will never be applied.

Nevertheless, I'm somewhat puzzled now that this is even possible because I did not think that the game would run through all the nested leveled lists on startup, to check whether a record might become an issue. I rather assumed that it would run a simple integrity check on isolated records. In that case however, I wonder why my mod with a faulty armor mod setup crashed on launch while the same fault in a base game record goes unnoticed. Unless the game applies different standards for checking third-party mods, that is.

Link to comment
Share on other sites

3 hours ago, Sclerocephalus said:

I wonder why my mod with a faulty armor mod setup crashed on launch while the same fault in a base game record goes unnoticed. Unless the game applies different standards for checking third-party mods, that is.

Maybe something else in the record influences on the outcome, or the way such record is used. I won't be add that check unless you can find out why.

Link to comment
Share on other sites

2 hours ago, zilav said:

Maybe something else in the record influences on the outcome, or the way such record is used. I won't be add that check unless you can find out why.

The mods that make up a combination can optionally have an Add-On property which, if present, overrides the ID specified in the combination records of the armor object. The following screenshot shows this record (in red brackets) for the OMOD mod_armor_Metal_Torso_Size_B in Fallout4.esm:

If that property does NOT exist on a mod, the ID in the respective combination record of the armor object MUST refer to an existing add-on or to -1, i.e. in that case, everything I explained previously still applies.

If a combination with an otherwise invalid ID adds a mod from a collection (i.e. if it specifies an OMOD with the modcol_ prefix), ALL mods in that collection MUST have an add-on index property that refers to a valid add-on index on the armor object. If there's at least one mod in the collection that doesn't fit, the armor object will crash your game.

Attached is an archive with two esps to demonstrate the issue: both plugins set up a raider harness with epic modifications. The only model in the add-on list has index zero, so the allowed values for the ID in the epic mod combination (that's the one with the 'if_epic_restricted' keyword) are -1 (the default) and 0.

  • The _NoCrash esp has the ID set to -1 and will load fine (0 works too).
  • The _Crash esp has the ID set to 1 (invalid). This will crash the game on launch. Note that the esps are perfectly the same otherwise.

Armor Test.7z

Link to comment
Share on other sites

20 hours ago, Sclerocephalus said:

Attached is an archive with two esps to demonstrate the issue: both plugins set up a raider harness with epic modifications. The only model in the add-on list has index zero, so the allowed values for the ID in the epic mod combination (that's the one with the 'if_epic_restricted' keyword) are -1 (the default) and 0.

  • The _NoCrash esp has the ID set to -1 and will load fine (0 works too).
  • The _Crash esp has the ID set to 1 (invalid). This will crash the game on launch. Note that the esps are perfectly the same otherwise.

Armor Test.7z

Your example doesn't demonstrate how it works because you simply set the invalid index which is not in the models list of ARMO.

I checked one of the vanilla records with "invalid" index Armor_Metal_ArmRight "Metal Right Arm" [ARMO:000536C1], the last combination uses index 5 and includes 3 OMODs, and none of those OMODs have a property with index of 5, only with 3. So show me on this example why index 5 is valid.

Link to comment
Share on other sites

5 minutes ago, zilav said:

I checked one of the vanilla records with "invalid" index Armor_Metal_ArmRight "Metal Right Arm" [ARMO:000536C1], the last combination uses index 5 and includes 3 OMODs, and none of those OMODs have a property with index of 5, only with 3. So show me on this example why index 5 is valid.

 

20 hours ago, Sclerocephalus said:

The mods that make up a combination can optionally have an Add-On property which, if present, overrides the ID specified in the combination records of the armor object.

Thus, since the OMODs included in the index 5 combination all have the property set to 3, they all override the ID on the combination to 3, and this refers to a valid add-on.

If there's something wrong, it's always a wrong ID on a combination that is not overridden to a valid one by the OMODs specified for tat combination. In my example, the OMODs do not override the invalid entry.

Link to comment
Share on other sites

7 hours ago, Sclerocephalus said:

Thus, since the OMODs included in the index 5 combination all have the property set to 3, they all override the ID on the combination to 3, and this refers to a valid add-on.

I missed the "override", thought it adds a new index. I added overrides into the check routine but it gave even worse results https://pastebin.com/raw/qwqRbWcj

Link to comment
Share on other sites

I'm curious about what method is the best when one wants to make an esp to an esm.

 

Is it in WB or in TES5Edit?

Link to comment
Share on other sites

If you're going to be using the new esm to actually play the game, use xEdit. If it's just for doing work in the CK and you'll be flipping it back to an esp afterward, use Bash, it'll be much faster for that.

Link to comment
Share on other sites

4 hours ago, Arthmoor said:

If you're going to be using the new esm to actually play the game, use xEdit. If it's just for doing work in the CK and you'll be flipping it back to an esp afterward, use Bash, it'll be much faster for that.

Thanks for the information Arthmoor.

 

Although, this is actually the opposite I am used to, I mean if a modder are working with a mod in the CK then one would want to use TES5Edit if something needs to done.  While WB are primarily for mod users. :P

Link to comment
Share on other sites

I was wondering if anyone might be able to help me with a script for xedit?  

What I want to do is create a function that sets all of the ore veins in Skyrim to " does not respawn".

So the script would first get the Activators, then the base object, then the "use info" and the object references and then then the re-spawns Flag on the Object Reference Template.     I have not done a script for xedit before so any help would be appreciated.  

 

Link to comment
Share on other sites

10 hours ago, Dragonblood said:

I was wondering if anyone might be able to help me with a script for xedit?  

What I want to do is create a function that sets all of the ore veins in Skyrim to " does not respawn".

So the script would first get the Activators, then the base object, then the "use info" and the object references and then then the re-spawns Flag on the Object Reference Template.     I have not done a script for xedit before so any help would be appreciated.  

This is better done in Papyrus. In fact, there are mods that already achieve what you want.

  • Like 1
Link to comment
Share on other sites

7 hours ago, fireundubh said:

This is better done in Papyrus. In fact, there are mods that already achieve what you want.

The problem with doing it via Papyrus is the Reset.  When something resets it resets the script so you loose any stored properties.  

For example: Someone mines an ore vein but does not deplete it.  If the ore does not reset it will be that way when the person returns.  If you were using Papyrus when the ore reset you would loose that information.   

I could not find any Mods that do this.  But I do not use Mods, it is funner for me to do things myself.  

I am also interested in learning how to code this is xEdit. 

Link to comment
Share on other sites

On 15.08.2017 at 8:09 PM, Dragonblood said:

I was wondering if anyone might be able to help me with a script for xedit?  

What I want to do is create a function that sets all of the ore veins in Skyrim to " does not respawn".

So the script would first get the Activators, then the base object, then the "use info" and the object references and then then the re-spawns Flag on the Object Reference Template.     I have not done a script for xedit before so any help would be appreciated.  

 

I added comments to make it easier to understand. Apply to plugins, worldspaces or cells you want to patch.

https://pastebin.com/raw/VusbthMY

  • Like 1
Link to comment
Share on other sites

2 hours ago, zilav said:

I added comments to make it easier to understand. Apply to plugins, worldspaces or cells you want to patch.

https://pastebin.com/raw/VusbthMY

Zilav  thanks.   Looking for the script on the Base Object was a smart move.  I do not see any other way to identify all of them.  I am going to look over this thoroughly and may have some further questions.

Thanks Agian

Link to comment
Share on other sites

Hey there!


Well, after dealing with writing way too many lines of code devoted basically just to data assignment, I decided to try the 3.2.1 version of TES5Edit so I could give its JSON functionality a test.
After about eight hours of getting nowhere, I'm hoping maybe someone can shed a bit of light on some of this.

What I want to do is seemingly simple: write JSON to a file, read from this file, and iterate through its values in a for loop.
In practice though, this has proven to be impossible for me to figure out.

Roughly 99% of what I do is met with "undeclared identifier" time and time again.
I've been pouring through the source for this, as well as the JSON demo, and I just can't get anything to work when it comes time to actually use this information.
All I can seem to accomplish is explicitly saying what I want, and even then, I can't even access sub-objects.

If anyone has any suggestions, I'm all ears.
Thanks!
 

Link to comment
Share on other sites

23 minutes ago, MatthiosArcanus said:

If anyone has any suggestions, I'm all ears.
Thanks!

No need to waste time when you can simply ask :) There was a minor mistake in the latest build when getting json object from array, maybe you fell the victim of it. Anyway get the new build from the first post.

Since you didn't provide an example of json you want to work with, and "JSON - Demo.pas" is not enough, don't know how exactly I can help. I recently wrote another script using json (convert FO4 settlement blueprints to plugins), maybe it'll give you some hints.

Fallout4 - Convert Settlement Blueprint to Plugin.pas

Link to comment
Share on other sites

Apologies I didn't provide an example, to be honest I nuked everything I had been experimenting with.

I appreciate the script download, and for you trying to help!
I suppose the demo is good for the basics, but to really understand something, I need practical examples to dissect.

If/when I run into any more issues, I'll try to set them aside and ask here afterwards. =-)

Link to comment
Share on other sites

Alright, still testing, but I figured I would stop in and see if I could get any additional pointers.
This time, though, I have code!

So all I'm doing right now is essentially getting my head around how this all works together.
At the moment, I'm trying to verify that I'm getting the correct values from the JSON file.

Unfortunately I'm not, as I get an index out of bounds error when I try to run the above code when looking at index 0.
I have a feeling I'm not populating the object correctly when I write it to the file, as it doesn't seem to mesh with a FO4 blueprint I found.

I'm going to keep poking at this, though, maybe try something a little less nested.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...