Jump to content

Access variable from other script


Recommended Posts

 

 

  Quote
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.

 

This is what I don't understand, the spell array is going to be populated (correct terminology?) later by the script when it runs, I have no way of knowing what is to go in there.

Can arrays not be accessed from other scripts this way?

 

diziet

Link to comment
Share on other sites

For understanding:

Spell[] myArray             ; script variable

as same as

Spell[] PROPERTY myArray auto Hidden     ; script property which cannot be prefilled by CK (because Hidden flag), treated like variable above

by using this construct you have to (or can) pre-assign the entries of the array as IsharaMeradin posted

Spell[] PROPERTY myArray auto            ; script property that is predefined in length and entries by CK

I would suggest following "and sorry for breaking in to this posting"

 

  Reveal hidden contents

 

Edited by ReDragon2013
Link to comment
Share on other sites

Now my second problem, I wish to attach the same script to two items (pools) and then have a second script attached to a third item - doorway exit, and have the variables from the first script accessible by the second.

I've got this working for one pool, thanks to everyone here; but since the property in the second script has to reference that pool (triggerbox) it can't reference the second pool.

What should I be reading up on if this is possible?

Will I have to rename the script and double the variables?

 

diziet

Link to comment
Share on other sites

I had an idea that if I put the variables/property in the doorway exit script and put a property in the two pool entrance scripts I could access the exit script variables from the two pool scripts.

I got the scripts to compile, but not joy so far:

 

doorway exit script:

 

  Reveal hidden contents

 

 

 

the script on the two pool entrances

 

  Reveal hidden contents

 

 

 

diziet

Link to comment
Share on other sites

I have managed to get this to work, with an unexplainable (by me) caveat. If I disable my mod plugins, start an old game save that has never seen any mods, fast travel to the site of the player home that I'm writing this patch for, and save; then reload the new save with my patch enabled; it only works if I was using skse when I made the second save. If I was not using skse when making the second save and I restart the game using skse then the patch doesn't work, and by doesn't work I mean the redressing doesn't happen, undressing happens, change of 1st/3rd person happens, which means that the undress and redress functions are being called. Using debug notifications I can see that the filling of the arrays and variables for equipped items doesn't happen.

 

Now if I quit, unistall the player home, restart - using skse, save, quit, reinstall the player home, restart and load that save then the patch works. so there is a way for users to get the patch to work without goping back a save but it is a faff. Assuming that the user did not already have skse installed, which they might not have.

 

I'm not sure I want to publish this patch while I don't understand what is going on. Any ideas?

 

diziet

Link to comment
Share on other sites

Just tell users that if they did not have SKSE installed prior to wanting to use this patch, then they need to install SKSE and start the game and make a save at least once before adding in the patch.

 

Not sure why it is happening that way. Maybe because you are at the site where the home is located when making the save and loading the patch? Try approaching the area from another location instead of saving right on the spot.

Link to comment
Share on other sites

  Quote
Try approaching the area from another location instead of saving right on the spot.

 

Indeed, that works, as long as the player hasn't already been to the player home first.

It occurs to me - see what sleep can do:) - that perhaps the reason for all this is that this player home uses unequipall on both NPC and player, but only manages to redress the NPC. To keep the mod authors intent but add player redressing I have had to disable the existing undressing scripts in favour of my own. Upon saving, perhaps the original scripts are baked into the save and then still act, even though my patch disables them? Still don't see why saving with skse enabled makes a difference though.

 

Sudden thought, perhaps my mistake is to use the original trigger boxes, the two pool entrance ones and the doorway exit?

If I disabled those they wouldn't be baked into the save would they? Then recreated my own in the same places with my scripts attached.

 

Shall try.

 

 

diziet

Link to comment
Share on other sites

  • Recently Browsing   0 members

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