Jump to content

SKSE function that returns ModIndex# or PluginName


irswat

Recommended Posts

Looking for an SKSE function that you can pass a baseid for an asset, like a weapon, or piece of armor, and the function will return either the ModIndex or PlugIn name that the asset is loaded from. Is anyone aware of such a function? In short I want to help Narjah make his Leveled Unique Equipment plugin be compatible with third party mods, so he needs a function that can determine whether a weapon/piece of armor is from a third party plugin.

I see the GetMod... functions, but there doesn't seem to be one like GetModIndex. Is anyone aware of such a function, or how I might achieve the desired effect of determining whether an asset is 3rd party?

Not sure if it was SKSE, NVSE, or I'm imagining things but I recall stumbling across a function that does this.

ALTERNATIVELY: Is there a flag for unique weapons/armors that I can access via script? I noticed there is a IsUnique function, but it seems to work on actors and not objects. Is there a function like IsUnique I can call on a weapon or armor formid/baseid? Is Craftable()?

Edited by irswat
Link to comment
Share on other sites

There is GetFormFromFile which you can pass in the ID# and the ESP/ESM name. But you have to know the ESP/ESM name in advance. This is what is typically used to make 3rd party mods compatible when one does not create their own SKSE DLL plugin or have some patcher utility for the user to run once their load order is set (i.e. DynDoLOD, SkyProc, etc)

 

It is used like so:

Weapon UberWeapon = (Game.GetFormFromFile(0x00345678,"The Uber Weapon Mod.esp")) as Weapon

You *might* be able to jury rig something by using GetModCount to get the total number of active ESP/ESM files and then get the desired item's base object, pass that into a string, use GetNthChar from StringUtil script and convert the first two digits of the objects form into an integer from hex (if that is even possible in papyrus) and then use that as the index for GetModName.

 

Personally, I'd rather just make it compatible on a mod by mod basis and use GetFormFromFile than mess around with some convoluted process that may or may not work.

Link to comment
Share on other sites

Can I call GetNumIngredients on a weapon/armor baseid. If I call GetNumIngredients on a weapon/armor baseid, and it is null, can I assume that it is not constructable? If it is not constructable can I assume it is unique?

Edited by irswat
Link to comment
Share on other sites

Can I call GetNumIngredients on a weapon/armor baseid. If I call GetNumIngredients on a weapon/armor baseid, and it is null, can I assume that it is not constructable? If it is not constructable can I assume it is unique?

No. GetNumIngredients is called by a ConstrucibleObject (i.e. a recipe)

 

Calling on a weapon or armor, will cause the papyrus compiler to throw errors at you.

Link to comment
Share on other sites

String WeaponLeft = .GetEquippedObject(0)

String WeaponRight = .GetEquippedObject(1)
Int ContructibleLeft = WeaponLeft.GetNumIngredients()
Int ContructibleRight = WeaponRight.GetNumIngredients()

if (!ContructibleLeft)
{
//call UniqueLevelingScript(string WeaponLeft)
}endif;

if (!ContructibleRight)

{
//call UniqueLevelingScript(string WeaponRight)
}endif;

I'm new to scripting in skyrim, but would something like this work do you think?

Link to comment
Share on other sites

Yea, I mean that was the first place that I went and just looked through all the functions, but sometimes there are other 3rd party libraries and lesser known functions and approaches which aren't well documented in the official documentation. Thanks again for your help!

Link to comment
Share on other sites

  • Recently Browsing   0 members

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