Jump to content

[Help] How to access variable from another script?


GomuGomu64

Recommended Posts

Just a quickie.

 

I've got one boolean in a script that spawns an NPC. I've attached a script to that NPC so that when they die, that variable gets changed.

 

But, I don't know how to change that boolean with the script on the NPC; the two scripts are different from each other, and on seperate things (The one with the variable I want to change is on an XMarker, the script that'll do the change is on the NPC).

 

How would I do this?

 

<strike>Edit: Figured it out.</strike>

 

Scriptname YourScriptNameHere extends ScriptWithStuffInItYouWantToEditHere  

<br><br>2nd Edit : No, I didn't figure it out.<br><br>Anybody mind telling me? :P<br>

Edited by GomuGomu64
Link to comment
Share on other sites

The code where you thought you figured it out, that's what you do if you want "YourScriptNameHere" to have access to all the functions in "ScriptWithStuffInItYouWantToEditHere". But no, that's not what you want to do; similar, but not it.

 

First of all, you need to have "ScriptWithStuffInItYouWantToEditHere" to actually be put on something (a quest, activator, perk, anything) or else you won't be able to reference it anywhere.

 

Then in "YourScriptNameHere", you add the line:

 

ScriptWithStuffInItYouWantToEditHere Property TheThingThatHasThatScriptOnIt Auto

Then if for example you want to access SomeProperty in "ScriptWithStuffInItYouWantToEditHere", you use

 

TheThingThatHasThatScriptOnIt.SomeProperty

Link to comment
Share on other sites

Skyrim scripting stinks and is no good for variables. When you can't get one script to see the variable in another script, just give up and create a new global variable which both scripts can easily see.
Link to comment
Share on other sites

  • Recently Browsing   0 members

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