Jump to content

Help with inter mod communication


Recommended Posts

Hey there, Iâm new to papyrus but not to coding. I have been picking apart a couple mods to tweak them how I want it. Right now Iâm basically trying to make and mcm menu for amazing follower tweaks. I have amazing follower tweaks and companion command. Companion command only allows for command of one companion and aft you have to go through your pipboy every time you issue a command like all attack / all retreat.

 

 

What Iâm trying to do is get those set to hotkeys in mcm. The only problem is Iâm not sure how to do inter mod communication. Iâve got as far as setting up the mcm menu / compiling a test script and getting basic commands to work.

 

I want to call a couple functions from amazing follower tweaks. I tried to follow this but it might be outdated as other tutorials such as verifying an esp wasnât working as expected. https://www.creationkit.com/fallout4/index.php?title=Inter-mod_Communication.

 

Tl;dr Aft is packed in a .ba2 how do I access functions from a script compiled in the loose script folder.

Link to comment
Share on other sites

So I ran a test. Maybe you can help me figure out why it isn't loading the script?

 

My Function below:

 

 

Quest aCharacter
ScriptObject bfCharacter = aCharacter.CastAs("AFT:TweakFollowerScript")
; Make sure we have a script to call a function on
If bfCharacter
debug.messagebox("Success")
Else
debug.messagebox("Failed")
EndIf
AFT:TweakFollowerScript extends quests
when I use the hot key, Failed message box shows.
Though in the console CFG picks up the AFT script...
Link to comment
Share on other sites

You will need to post the source code of your script before anyone can really begin to help you. But just looking at what you posted, it seems fine. But I also know that the way the tutorial outlines things is accurate because I've used something similar to that method in my own mods and it works just fine.

Link to comment
Share on other sites

The ICM description is rather complex and byzantine, took me several hours to pick it apart and call remote scripts.

 

This primer using simple names may help you:

Quest FormFromOtherMod = Game.GetFormFromFile(0x0000000A, "ModFileName.esp") as Quest
ScriptObject RemoteScript = FormFromOtherMod.CastAs("NameOfTheScript")

Var vResult = RemoteScript.CallFunction("NameOfScriptFunction", New Var[0]) ;Function with return value
Actor TheActorRefINeed = (vResult as Actor)

Var vResult = RemoteScript.GetPropertyValue("RemoteScriptPropertyName") ;Query a property direct
Actor TheActorRefINeed = (vResult as Actor)
Link to comment
Share on other sites

Thanks Iâll look into it, is there any good way to learn the structure. Iâm still a little confused on global and accessing other mods properties. Basically trying to piggy back off of an existing mod and tweak it. The script I want to call itâs function is attached to a quest... Iâm not sure if I can just call the function and it would fire off or if those functions can only be accessed within the mod? Anyway I appreciate the info and am still learning more.
Link to comment
Share on other sites

SKK50 has already given you the basic structure with his example. When combined with the information contained in the tutorial the two should give you with the tools you need to get your mod accomplished.

Edited by Reneer
Link to comment
Share on other sites

Just need some guidance... so if you use getformfromfile you can access all of that mods functions and scripts? What if the formid has multiple scripts attached. How is that handled to get a scripts non global function?
Link to comment
Share on other sites

  • Recently Browsing   0 members

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