Jump to content

Script question


SHAD0WC0BRA

Recommended Posts

Hey all. I recently began using FNVEdit to ensure that my mods are 'clean' and I encountered a conundrum on scripts. Let's say that my .esp contains a script which adds a weapon from a DLC to a particular form list, but due to cleaning unused masters with FNVEdit, the mod is not dependent on the .esm for that DLC. Will that make the script fail, or will it work fine for the user as long as they have the DLC?

Link to comment
Share on other sites

If you don't want to make the ESM containing an item a "master", then your script has to check first that the reference to that item is valid before you attempt to use it. Something like "GetIsID" or "GetIsReference". If the check fails, then you just skip that part of the script attempting to add it to the list. You should assume any item which is not part of a "master" required by your mod to possibly not be present.

 

-Dubious-

Link to comment
Share on other sites

Cleaning mods just because you think you should isn't a good idea. You can break mods in many ways. I don't know if your script will fail or if you'll make the game crash.

 

The only reason to clean a mod is if the author didn't know what they were doing and accidentally created dirty edits all over the place. Any decent mod shouldn't be cleaned and you are more likely to break something than anything else.

Link to comment
Share on other sites

If you don't want to make the ESM containing an item a "master", then your script has to check first that the reference to that item is valid before you attempt to use it. Something like "GetIsID" or "GetIsReference". If the check fails, then you just skip that part of the script attempting to add it to the list. You should assume any item which is not part of a "master" required by your mod to possibly not be present.

 

-Dubious-

 

Let me make sure I understand. You're saying that, for example, if I were to make a mod that contains a script which adds a GRA weapon to a particular form list (but the .esp is NOT dependent on the GRA .esm) then users without GRA can install the mod and have the other form list updates within that same script continue to function?

Link to comment
Share on other sites

Cleaning mods just because you think you should isn't a good idea. You can break mods in many ways. I don't know if your script will fail or if you'll make the game crash.

 

The only reason to clean a mod is if the author didn't know what they were doing and accidentally created dirty edits all over the place. Any decent mod shouldn't be cleaned and you are more likely to break something than anything else.

 

Well, I did test it on my own game first. Do you know why it is that every once in a while after making edits in GECK, the .esp will end up in FNVEdit with worldspace records that you didn't even touch?

 

I will add that this one is an odd case - a user requested that I try to clean unused masters because the mod depended on an .esm created by another modder which in turn was loaded with the .esms from all the DLCs, though the mod that I made did not depend on those DLCs.

Edited by SHAD0WC0BRA
Link to comment
Share on other sites

Let me make sure I understand. You're saying that, for example, if I were to make a mod that contains a script which adds a GRA weapon to a particular form list (but the .esp is NOT dependent on the GRA .esm) then users without GRA can install the mod and have the other form list updates within that same script continue to function?

I believe so; however I have not tested this. The reasoning being: "If the specific reference is not valid (for whatever reason), we don't even attempt to add it to the list." So theoretically, you could conceivably safely make no changes to the list at all because all of the references are not valid. Conversely, if the reference is valid, then the asset exists and can be safely added to the list (assuming it is appropriate).

 

It is always best to "confirm" rather than "assume" a reference is valid. Making the asset record source file a "master" is an easier way to "confirm". Which is also why you should not "clean" files that are masters. That can break dependent plugins that are expecting that "cleaned" record to be present (and possibly why it is present).

 

Basically you are creating a series of conditional "IF/THEN" tests where (pseudo-code):

IF (reference IsValid) THEN
   add reference to list
ENDIF
repeat for each individual reference to be added to the list.

-Dubious-

Link to comment
Share on other sites

  • Recently Browsing   0 members

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