ID8879488948574 Posted July 6, 2021 Share Posted July 6, 2021 I have several mods (created them on my own) which I am trying to link through "soft" dependencies. By "soft" I mean that if one or more of the mods are missing, there will be just some limitations on functionality, but there are no master-plugins and therefore it should still be playable.So far so good - and I know many mods are doing the similar thing. However, I'm getting some strange errors when testing the case on missing dependencies (the "non-mandatory" mods I'm trying to link).Here's what I do:if Game.IsPluginInstalled("Dependency.esp") DependencyType record = Dependency:UtilScript.CallSomeGlobalFunction() if record return record.CallSomeFunction() endifendifreturn "Woops, you got to do without the goodies"and my expectation is that if the mod "Dependency" is missing, then the script will not go into the Game.IsPluginInstalled("Dependency.esp") on runtime and call it a day, returning the default value. However, that's not what is happening. Instead, the whole containing script which contains this IF block seems to be discarded by Papyrus and I see un-googlable errors:[07/06/2021 - 12:25:13PM] Error: Unable to link types associated with static function "CallSomeGlobalFunction" on object "containing script name here".[07/06/2021 - 12:25:13PM] Cannot open store for class "some dependency script file here", missing file?... and then all the consecutive calls to any method of this script (i.e. the containing script, the one that's present at the moment) fail. It seems that Papyrus completely discards the whole script: [07/06/2021 - 12:25:13PM] error: Unable to obtain function call information - returning None So my question is - how to do it properly? I was under impression that it is only necessary to have the dependency scripts present at compilation time and then, since Papyrus runs on VM, it will just execute instructions step by step hence never entering the part of code it is not supposed to because there is a guard rail check IF block Game.IsPluginInstalled("Dependency.esp") I see other mods doing similar things and the error is pretty much ungooglable as I mentioned, I was unable to deduce what it means (apart from just reading into it literally and getting "ok, it failed to find the function information, because.. well, the dependency mod isn't installed hence the corresponding script is just missing", without the clue on "why does it try to access it anyways") Link to comment Share on other sites More sharing options...
IsharaMeradin Posted July 6, 2021 Share Posted July 6, 2021 Confirm that the "dependency.esp" is no longer in the data folder. The function IsPluginInstalled will return true if the plugin is found in the Data folder. It cares not for the active status. Thus an inactive "dependecy.esp" will still return true and cause that block to fail. Link to comment Share on other sites More sharing options...
DieFeM Posted July 6, 2021 Share Posted July 6, 2021 I think it should be something like this, didn't tested it myself, but it compiles as is, without the dependency script: if Game.IsPluginInstalled("Dependency.esp") Form result = Utility.CallGlobalFunction("Dependency:UtilScript", "CallSomeGlobalFunction", new Var[0]) As Form ScriptObject record = result.CastAs("DependencyType") if record return record.CallFunction("CallSomeFunction", new Var[0]) endif endif return "Woops, you got to do without the goodies" Check those pages:https://www.creationkit.com/fallout4/index.php?title=CallFunction_-_ScriptObjecthttps://www.creationkit.com/fallout4/index.php?title=CallGlobalFunction_-_Utility Link to comment Share on other sites More sharing options...
Recommended Posts