Editing Inter-mod Communication

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 40: Line 40:
Example:
Example:
<source lang="papyrus">
<source lang="papyrus">
Actor newCompanion = Game.GetFormFromFile(0x00015A4F, "SpecialCompanion.esp") as Actor
Form newCompanionForm = Game.GetFormFromFile("SpecialCompanion.esp", 0x00015A4F)
Actor newCompanion = newCompanionForm as Actor
if newCompanion
if newCompanion
   ; We've got ahold of the new companion from that other mod, maybe we can give them one of our special armor pieces?
   ; We've got ahold of the new companion from that other mod, maybe we can give them one of our special armor pieces?
Line 117: Line 118:
   ; We can't use the normal "as" operator, because that would add a dependency on the other mod.
   ; We can't use the normal "as" operator, because that would add a dependency on the other mod.
   ; So instead we use the CastAs function to make sure we're pointing at the right script.
   ; So instead we use the CastAs function to make sure we're pointing at the right script.
   ScriptObject bfVendor = aVendor.CastAs("BeginningFantasyVendor")
   ScriptObject bfVendor = aCharacter.CastAs("BeginningFantasyVendor")


   ; Now set the properties, again, we don't need to cast because our parameter values are
   ; Now set the properties, again, we don't need to cast because our parameter values are
Line 182: Line 183:
     Var[] params = new Var[1]
     Var[] params = new Var[1]
     params[0] = actorThatEntered
     params[0] = actorThatEntered
     relayScript.CallFunction("RegisterForSummon", params)
     relayScript.CallFunction("RegisterForSummon", actorThatEntered)
   endIf
   endIf
endEvent
endEvent

Please note that all contributions to the Fallout4 CreationKit Wiki are considered to be released under the Creative Commons Attribution-ShareAlike (see FalloutCK:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)