Quadratomic Posted January 8, 2011 Share Posted January 8, 2011 Hello everyone. I'm in a bit of a dilemma right now with a mod I'm working on, and it feels like it's something extremely basic that I should know. Basically, I want a door to become unlocked after I select an item off of a terminal. I've looked at several resources but I just can't seem to figure it out. I believe I'm correct when I try to place the unlock script in the "Result Script" section of my terminal option. I've got a door named 000HospitalMainDoor, and I've given it a unique reference editor ID of 000HospitalMainDoorREF. All of my previous attempts have led to me getting a warning from GECK after trying to save my script saying: Script command "000HospitalMainDoorREF.Unlock" not found. What am I missing? Any help would be greatly appreciated! - Quadratomic Link to comment Share on other sites More sharing options...
davidlallen Posted January 8, 2011 Share Posted January 8, 2011 I have "heard" that names starting with numbers do not work well. I use a different (alphabetic) prefix for all the items in each mod, so this is a good way to organize. Do you find that other items starting with "0" all work? Link to comment Share on other sites More sharing options...
lostone1993 Posted January 8, 2011 Share Posted January 8, 2011 If I understand what you are trying to do correctly would it not be easier to create a linked ref between the door and terminal then using this on the terminal button ref myrefset myref to getlinkedrefmyref.unlock Link to comment Share on other sites More sharing options...
Quadratomic Posted January 9, 2011 Author Share Posted January 9, 2011 Thank you very much, davidlallen and lostone1993. It seemed to be a combination of the poor naming and my scripting error that caused the error. I've got everything fixed and working now! I have another question though, since this topic is active... Is there any simple way to go about removing all irradiated items (foods and such) from the players inventory, or will I have to write the script to check for specific items? Thanks again! - Quadratomic Link to comment Share on other sites More sharing options...
davidlallen Posted January 9, 2011 Share Posted January 9, 2011 There is no way to loop items in the player's inventory. The best you can do is to create a formlist, which lists all the irradiated items in the game. If you investigate the existing formlists, you may find that something like this already exists. A formlist can include other formlists. Once you have the formlist, you can do player.removeitem and give the formlist name. This will remove all items which are on the formlist. It is not ideal, especially if another mod adds an irradiated item; that can't be on your formlist. Link to comment Share on other sites More sharing options...
Quadratomic Posted January 9, 2011 Author Share Posted January 9, 2011 Thank you for the swift reply. I'll be looking into this to see what I can come up with. I'm making a rather simple house to work on my scripting abilities. Sorry if the questions seem a bit basic, but thanks for the help! - Quadratomic Link to comment Share on other sites More sharing options...
Quadratomic Posted January 10, 2011 Author Share Posted January 10, 2011 Sorry for the double post, but I have another question. Is it possible to add a group of referenced objects, say, 10 lights with unique editor IDs "HomeStandardLightREF1" and going up to "HomeStandardLightREF10," add them all to a FormList, and have the entire group enabled/disabled that way to save space in the actual code? What I'm trying now doesn't seem to be working. - Quadratomic Link to comment Share on other sites More sharing options...
blove Posted January 10, 2011 Share Posted January 10, 2011 If you are not going to call them seperately at any point you could use enable parenting. Link to comment Share on other sites More sharing options...
rickerhk Posted January 10, 2011 Share Posted January 10, 2011 Sorry for the double post, but I have another question. Is it possible to add a group of referenced objects, say, 10 lights with unique editor IDs "HomeStandardLightREF1" and going up to "HomeStandardLightREF10," add them all to a FormList, and have the entire group enabled/disabled that way to save space in the actual code? What I'm trying now doesn't seem to be working. - Quadratomic Place an XMarker in the cell. Make it initially disabled and give it a persistent reference, like MyHomeLightMarkerREF. Edit all the lights - go to the 'enable parent' tab and point them to the XMarker. Then all you have to do to turn them all on at once in a script is: MyHomeLightMarkerREF.enable If you want to use a light switch, make a copy of ElectricalSwitch and place it in the cell. Go to it's 'linked Ref' tab and set the XMarker as the linked ref. Then put a script on the switch: scn RHKMyHomeLightSwitchScript ref rLinkedREF BEGIN ONActivate if (IsActionRef Player == 1) set rLinkedREF to GetLinkedRef if (rLinkedREF.GetDisabled) rLinkedREF.Enable SetOpenState 1 else rLinkedREF.Disable SetOpenState 0 endif endif END Link to comment Share on other sites More sharing options...
Quadratomic Posted January 10, 2011 Author Share Posted January 10, 2011 This has definitely taken a nice chunk out of the length of my script. Thank you very much! - Quadratomic Link to comment Share on other sites More sharing options...
Recommended Posts