JediStudley Posted June 17, 2020 Share Posted June 17, 2020 I'm trying to dynamically interact with some other mods using the Papyrus API in Skyrim SE. Some of the API's in the Creation Kit do not seem to be available in SSE. The document link is https://www.creationkit.com/fallout4/index.php?title=Inter-mod_Communication I can't find anything 'official' that is for SSE, just Fallout4. The Game.IsPluginInstalled() works fine, but the ScriptObject.CallFunction() and ScriptObject.GetPropertyValue() do not seem to even exist. Is there another way of accomplishing this in SSE, or another library/mod that I can use? I'm trying very hard to avoid hard dependencies which equate to patches... any help or input is appreciated! Link to comment Share on other sites More sharing options...
Ghaunadaur Posted June 17, 2020 Share Posted June 17, 2020 Instead of IsPluginInstalled, you can use GetModByName (requires SKSE) or GetFormFromFile, to check if a plugin is present. There are no functions like CallFunction or GetPropertyValue in Skyrim, but you can make a property for the object the script is attached to and use (ObjectName as ScriptName) to call functions or retrieve property values. Link to comment Share on other sites More sharing options...
JediStudley Posted June 17, 2020 Author Share Posted June 17, 2020 Thanks, I'll checkout that call out in SKSE! The mods I'm checking for are not mine, so I can't add a property to them. They do have properties/functions I can access. This leads me then to the dynamic casting. Is there a way to do the 'as someobject' for the casting dynamically? The docs I have also refer to a ScriptObject.CastAs() which doesn't appear in SSE either. Link to comment Share on other sites More sharing options...
Ghaunadaur Posted June 18, 2020 Share Posted June 18, 2020 I don't think you can do this dynamically, it needs to be done individually for each script that you want to access. For example, if you would want to read a property value from a script on another mod that is attached to a quest, you can do the following: Quest OtherModsQuest Event OnInit() OtherModsQuest = Game.GetFormFromFile(0x00002dca, "OtherMod.esp") as Quest if OtherModsQuest debug.messagebox("Property value is: "+(OtherModsQuest as SomeScript).SomeProperty) endif EndEvent A property is not even needed, it can also be a local object variable. Link to comment Share on other sites More sharing options...
steve40 Posted June 23, 2020 Share Posted June 23, 2020 The caveat being, if users decide to save some mod slots by merging a bunch of mods into a single esp with a different filename, your script will no longer work. So make sure to warn your users never to merge or rename the other mod ;P edit: it's also a great way to discourage your mods from being included in modpacks ;) Link to comment Share on other sites More sharing options...
Sphered Posted June 27, 2020 Share Posted June 27, 2020 Its not as hard as some may imply, and you have more options than are commonly mentioned. Like Quests, you can look for it by EID and not have to worry about FormIDs Quest FromThatOtherMod = Quest.GetQuest("WhateverItsEditorIDIs") <----- Has no reliance or worry about plugin name or FormID Can do the same for Keywords Headparts and Race also. Keyword.GetKeyword("WhateverWord") Depends ofc what you are doing, and ways you pref to set things up, but you can fully communicate with these other scripted objects, but you would need to iron out a gameplan which works for you, of how you plan to handle things, if ABC mod is present, and or DEF mod, etc Link to comment Share on other sites More sharing options...
JediStudley Posted September 4, 2020 Author Share Posted September 4, 2020 Thank you for the info on GetQuest('someeditorid')! The documentation on papyrus has partial examples that don't work very well, not to mention they are frequently flagged for fallout 4. for the editorid, is that the same as the FormId listed in the Creation Kit's ObjectWindow column? I know I can't use it directly in the code and need to get the objects using the Id with an API. I keep seeing the Editor/Form Id being used interchangeably in the docs and it's confusing. I'm trying to script a mod that will dynamically determine if another mod is installed and if so, use a function or set a property in it. My goal is to create a mod that doesn't require patching for each mod combination that's out there which could impact mine. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted September 4, 2020 Share Posted September 4, 2020 I see more and more people landing on the FO4 pages for the Creation Kit than they do on the Skyrim pages. At any rate, here is a link to the Skyrim Papyrus page: https://www.creationkit.com/index.php?title=Category:PapyrusNote the lack of Fallout4 in the URL. Any Creation Kit wiki page without Fallout4 in the URL is for Skyrim. EditorID is the text label for a given recordFormID is the 8 character hex number for a given record You can statically determine if another mod is installed. i.e. you have a list of condition checks with GetModByName if using SKSE or GetFormFromFile if not using SKSE. After that you can link up with whatever script from the other mod to affect properties or use their functions. To the end user it is "dynamic" but as far as the code goes it is not dynamic but explicitly written out. GetQuest requires SKSE. Just letting you know before you run into issues should you try to use it. Link to comment Share on other sites More sharing options...
JediStudley Posted September 5, 2020 Author Share Posted September 5, 2020 thank you! I'll look those over and try them out! Link to comment Share on other sites More sharing options...
JediStudley Posted October 4, 2020 Author Share Posted October 4, 2020 If my mod calls functions in another mod, do we need to ask permission on that? I was checking the guidelines, and it's a bit murky. I get it if including assets like artwork or code, but calling functions isn't either of those... Link to comment Share on other sites More sharing options...
Recommended Posts