Jump to content

[LE] How do I use a Keyword from another mod in my mod?


Recommended Posts

My (unreleased) Alchemy Mod is also a house mod, with a nice cottage in Riverwood, behind the inn, and a smelter etc outside.

 

I also use the Mine and Cut Gems mod and added a gem cutting station next to the Armour work table.

 

But it doesn't work.

 

If I load both mods (with my mod active) in the Creation Kit, add the Gemcutter keyword to my copy of the Gemcutting Work Station, it saves fine. But it will not work in-game and when I load my mod in the CK again, the Gemcutter keyword has been removed.

 

I cannot even seem to make Mine and Cut Gems required by my mod as a parent.

 

I can make a duplicate of the Keyword, but that also does not work, because all the COBJ recipes are linked to the Gemcutting Work Station by the Gemcutter keyword.

 

I cannot make a separate Gemcutter keyword for my mod as it already exists in Mine and Cut Gems.

 

Any ideas? Could I make an Alias to use in my mod that will point to the Gemcutter keyword in Mine and Cut Gems, or something like that?

 

 

Cheers!

 

 

 

 

Link to comment
Share on other sites

On its own the Creation Kit cannot use ESP files as master files. It must be 'tricked' into believing that an ESP file is an ESM file.

 

There is a bit flag within the ESP header that can be set to tell the CK that the file is an ESM even if it has the ESP extension. This can be done with Wrye Base by right clicking on the intended parent plugin(s) and choosing to ESMIFY. TES5Edit can also be used to modify this particular flag. The downside to this method is that the game will also consider such modified ESP files as ESM files. Thus their load order position will change accordingly. And with the end user not having such parent ESPs false flagged, all testing will need to be done with the flag reset back to ESP. To avoid any accidental issues that arise from saving the plugin in the CK while the parent plugins are in ESP status a Creation Kit Fixes for SSE mod was created. But I do not know if there was one made for 32 bit Skyrim.

 

A step by step process to false flagging a plugin for use as a parent master in the Creation Kit using Wrye Bash (it's old but still valid just use the latest version of WB available)

https://forums.nexusmods.com/index.php?/topic/754151-tutorials-without-youtoob/page-2&do=findComment&comment=6035531

Link to comment
Share on other sites

Here is one option that may work in your specific scenario:

Place your version of the gem cutter station in your house with the Creation Kit

Load your mod alongside the other in TES5Edit

Add the desired keyword from the other mod into the gem cutter station

If you have recipes (COBJ records), you can add the keyword to them too

TES5Edit will add the other mod as a parent to your mod

 

 

As long as it works in-game, it will be fine. Just do not use the Creation Kit to further modify your plugin without doing the "ESMIFY" process on the other mod's plugin. If you do, the CK will strip out anything from the other mod.

Link to comment
Share on other sites

there is a way to get a keyword from another mod without it being a master, but I do not think it is applicable here

 

https://ck.uesp.net/wiki/GetKeyword_-_Keyword

 

but it may be useful to another reader

Keyword Function GetKeyword(string asKeyword) native global

that would make it a soft master, an example of a soft master is SkyUI, a lot of mods need it, but will not crash or work if it is not installed. That way during development you also do not need to worry about "ESMIFY". But I would remove it and make it a hard master before release.

Link to comment
Share on other sites

To those reading, PeterMartyr's example does require SKSE. If SKSE is not an option for some reason and you just need access to another mod's keyword for script purposes, GetFormFromFile with a cast to Keyword would do the trick.

 

 

 

Keyword myKeyword ;declare variable in empty state

Event OnInit() ;sample event
  myKeyword = Game.GetFormFromFile(0x00123456,"SomeMod.esp") as Keyword
  ;define variable in a function or event
EndEvent

;use keyword variable however needed within the remainder of the script

 

 

Link to comment
Share on other sites

mk 1 deleted take 2

 

Basely the wiki is wrong with some of it information regarding this code... and it show it was written by an individual who does not understand hexadecimal convention used by the entire world., do not blindly trust every thing in the wiki

 

@IsharaMeradin

 

I had exams at uni where writing a hexadecimal like that was a fail. You may want to look into the correct way to write them... if you want too, the PC will truncate it automatically when it converts it into bits, but the convention is writing in a way the PC does not need to truncate it for you, which also makes easier for human being to read.

 

Sorry.. but who ever ever made that wiki post had no idea, or was not classically trained. They noticed it work but did not know what going on behind the scene.

 

Also I noticed on the wiki cos some stupid bright spark added references to some certain SKSE code that use unsigned 32 bit data sum, I hope you know what talking about, but absolutely no directions on how to use them? Misuse of these code will turn your PC into a JET ENGINE and DAMAGE YOUR HARDWARE, I think these should deleted, Trained individual will find those codes, since the wiki is not their primary source of knowledge. But a novice Modder should even know they exist, for their own protection and it is irresponsible to have them on the wiki.

 

I don't have or intend to have account there. But referencing those SKSE code with no clear direction so a novice is force to experiment is just f*#@ing stupid. Can you delete them for the good of the community.

Link to comment
Share on other sites

If you have recipes (COBJ records), you can add the keyword to them too

Yes, the problem is that "Mine and Cut Gems" has about 300 recipes for turning Raw Gem Ore into 4 types of cut gems (Flawed, Normal, Fine, Flawless) and also 12 different cuts (square, trilliant, emerald, oval and so on).

 

I did not want to have to duplicate all those. The author has lost interest in Skyrim and has said that anyone can take over the mod. His version 7 cannot be opened in the CK, so I am still using version 6. Version 7 would have allowed making gemmed jewellery, rather than just cut gems.

 

But I do not want to just merge his mod with mine at the moment. I could try placing a Gem Cutter in the Inn or local store in Riverwood inside his mod, I suppose. The locations of Gem Cutters is a little inconvenient.

 

I do like the idea of reworking the mod as it's own thing, and tying the recipes to Smithing level and Perks.

 

EG

SP   Jewel Smithing    Arcane Smithing     Gem Cutting
100 
 95                                        Gem Cutter - Master
 90
 85  Jewel Smith
 80
 75                                        Gem Cutter - Expert
 70
 65  Goldsmith
 60                    Arcane Smithing
 55                                        Gem Cutter - Adept
 50
 45  Silversmith
 40
 35                                        Gem Cutter - Apprentice
 30
 25                      Finesmith
 20
 15                    Basic Smithing

Silversmith, Arcane Smithing and Gem Cutter would all need Finesmith.

 

But this creates too many perks (20 instead of 10) and would also need reworking the crafting of Rings, Amulets and Circlets and so on, as well as some weapons and armour.

 

The beauty of Mine and Cut Gems is that the skills need certain books, manuals and tools to be in inventory. The Read Me on the Mod page also says a certain Smithing Skill is needed, but I can't see that in the CK so it might be an old Read me.

 

For my Death Hound smithing I didn't require perks beyond Basic Smithing, but did require a Smithing Skill of 30, so that's doable. Mine and Cut Gems required skills above 100 for Emeralds and Diamonds, though, so I don't know what he did there. Shame version 7 cannot be opened in the CK. There's a long pause and then it crashes.

 

 

Cheers!

 

GAK!! Why does my table keep reverting to a single column!?

 

I think I've done it now.

Link to comment
Share on other sites

@PeterMartyr

 

While I technically have an account at the CK wiki and could theoretically add or delete stuff, I do not have enough knowledge into the inner workings of the game, Papyrus or SKSE to definitively state that something should or should not be there.

 

I cannot speak to the correctness or incorrectness of the hexadecimal usage with GetFormFromFile. I know the function works as outlined. And the history of the page indicates that it was originally posted by one of the creators of Papyrus (according to their user page).

 

@Shadeybladey

Doing the ESMIFY and ESPIFY trick as needed will prevent any duplicates from being made. Any changes you make will be stored within the plugin that you save. Whether you incorporate the "patch" into your main plugin (and require the other mod from then on) or into a separate optional plugin is your decision.

Link to comment
Share on other sites

  • 2 weeks later...

@IsharaMeradin :laugh:

 

correlation does not equal causation, I am aware it works, but let's break it down, what the community calls the FormID is really two different hexadecimal values

  • Load Order = 0 - FF
  • FormID = 0 - FFFFFF (lol hope I counted those F right hehehe)

When it displayed as a string it is 8 characters 020001BC but the FormID as a number is 0x1BC with 0x prefix letting the PC know it is a hexadecimal integer, not a decimal integer

 

Whether you use GetForm exclusively just Skyrim or GetFormFromFile for any mod in the loader

Form Function GetForm(int aiFormID) native global
Form Function GetFormFromFile(int aiFormID, string asFilename) native global

it just asking for the formID as a number

 

 

 

 

just for fun, I did this, with heaps of exaggerated zeros

Event OnInit()

	Weapon AkaviriKatana = Game.GetForm(0x000000000000000003AEB9) as Weapon  

	Debug.MessageBox(AkaviriKatana.GetFormID())

	Debug.MessageBox(self.DecimalToHexadecimal(AkaviriKatana.GetFormID()))
	
EndEvent

string Function DecimalToHexadecimal(int decimal)

    string hexadecimal = ""
    while (decimal > 0)
        int remainder = decimal % 16
        if remainder < 10
            ; hexadecimal = StringUtil.AsChar(remainder + 48) + hexadecimal
            hexadecimal = remainder + hexadecimal
        Else
            hexadecimal = StringUtil.AsChar(remainder + 55) + hexadecimal
        EndIf
        decimal /= 16
    endwhile
    return "0x" + hexadecimal
EndFunction 

This is what it spat out at me

 

S4HEI.png S4HEg.png

 

( @ readers not @IsharaMeradin -> if you do not trust my hexadecimal conversation use online one for 241337 )

 

in the code I use a SKSE function that missing on Wikki, it returns this

 

 

 

S4HE8.png

 

 

 

@reader who notice that game shorten FormID to 5 characters and did not use 6 characters with a pointless zero, why, I did not format the string to use 6 characters, and it show it as a number :laugh: :laugh: :laugh: :laugh: anywho there is a string, then there a number. Good to know with Floats and Hexadecimals, Oh and money........ too. $1.99 not 1.992222222222 unit price

 

 

 

 

My point is the string representation of the hexadecimal that loadOrder + FormID is not the number representation of a FormID as hexadecimal, but I am aware it works and long you convert the load order to two pointless zero (for not skyrim) 0x000003AEB9 or 0x0003AEB9 but is not 0x3AEB9 is easier to read, like a lot of thing. The compiler does not care... it is just Good Form (Joke) :laugh: to use 0x3AEB9

 

In reverse another issue the community has problems with when its number to a string, yeah a float hehehehe, why am getting all these extra zero's -> cos they did not convert a float which is a number to a formatted string

 

 

 

 

see if this compiles in papyrus, trust me it will

int stupidNumber = 0000000000001 

then output/print it to see it is a 1

 

 

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

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