Jump to content

How to set variables and reference objects/activators in specific cell


Guest Messenjah

Recommended Posts

Guest Messenjah

Hey guys, so I am at the point of growing some grey hairs now lol. I've been working on a script for about a week now. The intent was to create a script that, when the player enters a cell, a timer would run and then that timer would create a short animated lighting sequence and then turn on the lights, flag it with a DoOnce float and then when the player exits the cell, DoOnce will be unflagged and the lights will be turned off. This is for a small house addon for my NightClub that the player can earn through a series of quests.

 

 

Anyway, I found out that my script didn't work as it was linked to an activator and activators do not appear to look beyond the cell that they are in, no matter what I do and they will also attempt to default to be used in whatever cell they are located in. If I set it up in a quest however, it works.

 

However, there are some issues with doing it this way.

 

Firstly, I have a secondary activator for the same lights that acts as an animated light switch so the player can have a small amount of interactivity with the lights themselves; however, I can't just create references to the lights and then assign a disable function to my script using these references. I also can not link to the lightswitch itself and I can not link to it's script in such a way that I can modify it's variables with my quest script.

 

At this point, all I want is for certain lights to turn off when exiting the cell. I tried attaching a script to do this onto a door but now the door vanishes.

 

 

So, what I need to know is this; 1. How do you link from a quest script outside of a cell, to an object inside a specific cell to disable/enable it?

 

The other question; how can I link from my quest script to another script being used by an activator inside a specific cell? For instance, to tell a light switch to play it's close or open animation?

Link to comment
Share on other sites

Objects have to be tagged as persistent in the render window to be referred to in scripts. You don't need to make all your lights persistent though, only one and set it as the Enable Parent of all the others.

 

To turn the lights off when the player leaves it'd probably be easiest to add a script to the doors out of that cell, rather than creating a quest that constantly checks.

 

Most interactions with lights etc. can be done with SetOpenState 0/1 or Playgroup Forwards/Backwards, you can find out the group names by checking the animation controllers in the switch nif if those aren't the correct ones.

Link to comment
Share on other sites

So, what I need to know is this; 1. How do you link from a quest script outside of a cell, to an object inside a specific cell to disable/enable it?

make the reference you want to enable/disable persistant and give it a unique name like YourObjectREF, then you can just go YourObjectREF.disable 0

the object can of course also be an enabling parent for the rest of your stuff.

 

The other question; how can I link from my quest script to another script being used by an activator inside a specific cell? For instance, to tell a light switch to play it's close or open animation?

you can either have the quest do whatever you want to do, like (as above) YourSwitchREF.setopenstate 1 (or 0 for off) directly ffrom the quest script.

or you can have the quest trigger the switch to do what you want to do, like have the quest YourSwitchREF.activate (or better YourSwitchREF.activate YourQuest 1 to make sure the onActivate block runs instead of default activation) to trigger an onActivate block in the trigger's script, or put a gamemode script on the switch that starts if YourVariable == 1 and then just set that to 1 via the questscript when you want that to run. or... or... or... lots of ways :-)

Link to comment
Share on other sites

  • Recently Browsing   0 members

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