Jump to content

Access variable from other script


Recommended Posts

Aha! To answer (possibly) my own question, I think it's the following:

The creation kit will let you attach spells and such from other esps, but when you save your dependent mod the linkage is lost:

 

https://www.creationkit.com/fallout4/index.php?title=Data_File

 

https://cs.elderscrolls.com/index.php?title=De-Isolation_Tutorial

 

so. the trick is to use wryebash or xedit or similar to make the esp with the 'goodies' a 'master' with the esm flag _before_ loading in the creation kit (there are other methods). Then when saving the new mod the references to the master esp stay, then before playing or releasing, remove the esm flag from the 'master' esp. I had thought that using xedit to make an esp a master would do this, but that is not the same as attaching the esm flag.

 

So far I'm doing good:)

 

diziet

Link to comment
Share on other sites

  • 2 months later...

Hey diziet, to access properties from other esp's, even scripts, you can use the GetFormFromFile function: https://www.creationkit.com/index.php?title=GetFormFromFile_-_Game . The downside of this though, is if the form ID's change from what's expected in your script, the property won't be filled. Form ID's can change when converting an esp to esl flagged for instance. But, as you're accessing your own esp's properties, you can just tell users not to do that.

 

Example to access another script from another esp:

MyScriptOnMagicEffect MagicEffectScript = ((Game.GetFormFromFile(<formID>, "SomeEsp.esp") As MagicEffect) as MyScriptOnMagicEffect)

Edit: I actually don't think that instance will work because a script on a magicEffect extends ActiveMagicEffect which aren't the same thing. It would work for other things like Quests though. Also you could just use your spell property like such:

Spell Myspell = (Game.GetFormFromFile(<formID>, "SomeEsp.esp") As Spell)
Edited by dylbill
Link to comment
Share on other sites

To return to earlier in this thread, I thought i had understood what to do and indeed had it working, where a quest script (mcm menu) set some values that were accessed from another script attached to a trigger.

 

in that case the quest script was in one esp and the trigger in another. It worked, it still works, I use those scripts a lot.

 

But now I cannot get the same to work with two scripts destined to be attached to different triggers in the same esp. The problem is that when I attach one script (the one that declares the other as a property) I cannot set the property...

 

Here are the scripts:

 

  Reveal hidden contents

 

 

and:

 

 

  Reveal hidden contents

 

 

when I attach the second script to a trigger box and then select properties, when I try to manually fill the property of type 'dz_test_entry', the dialogue insists on making me choose a cell and a location!

 

 

 

When I attach the old script that declares a quest script as a property, I can fill it fine, even though the esp with that quest script is not even loaded in the CK.

These scripts are just me testing that I had learnt from before how to do this, but clearly I'm missing something.

I am tired so maybe it's trivial but I cannot see the problem.

 

diziet

Link to comment
Share on other sites

That's, strange, to say the least that you can fill properties from other esp's. Are you using them as a dependency? To fill your script property, you have to choose the object reference that your other script is on. Or, you can fill it with a function:

 

 

  Reveal hidden contents

 

Link to comment
Share on other sites

If I understand your question correctly, yes. The input fields will change depending upon the script being extended by the target script. Personally, I have only ever utilized quest scripts, alias scripts and objectreference scripts in this manner.

Link to comment
Share on other sites

Ok, I have the two scripts attached and now I have filled the properties, (this leads to a second problem but thats for later) right now my actual scripts for undressing are not filling the arrays for spells and armor, I'm wondering if this is because I've declared the arrays as properties wrongly; here are the two scripts:

 

 

  Reveal hidden contents

 

 

 

  Reveal hidden contents

 

 

I think maybe the issue is this?

 

 

should I be filling those array properties somehow?

 

diziet

Link to comment
Share on other sites

You selected the spell array property, the right hand side changes to a list view. Use the Add button to add a new entry to the list, then you can drag-n-drop whatever object you need at that index.

 

Something to remember with regards to the property window, the input fields on the right will always change depending upon the type of property selected. Use those fields and buttons to obtain the correct object(s) for the selected property.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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