Andyno Posted May 23, 2011 Share Posted May 23, 2011 Hi there.I'm trying to create a feature where I can push the switch to disable some object and vice versa - when I turn it on, the object will appear again.Any help would be appreciated. Thanks.A. Link to comment Share on other sites More sharing options...
tunaisafish Posted May 23, 2011 Share Posted May 23, 2011 Sounds like a light switch. See the sample scripts Link to comment Share on other sites More sharing options...
Andyno Posted May 23, 2011 Author Share Posted May 23, 2011 Thanks! :yes: I'll try this right now... Link to comment Share on other sites More sharing options...
Andyno Posted May 23, 2011 Author Share Posted May 23, 2011 I did something wrong because the object disappear along with the switch... :wallbash: Link to comment Share on other sites More sharing options...
tunaisafish Posted May 23, 2011 Share Posted May 23, 2011 Well you did something right too! The glass is half-full :) It's sometimes hard spotting the silly mistakes and typo's in your own code.Don't struggle alone for too long. Post the code here within [ code ] [ /code ] tags and explain your objects.Someone here will normally put you right in no time. Link to comment Share on other sites More sharing options...
deu58 Posted May 23, 2011 Share Posted May 23, 2011 Are you using the GECK 1.3 Power Up utility? It can help you find errors in your code but it does look like the GECK saved your script but even at that if you are not yet using this tool it can save lots of poor emoticons from bruising their little heads on brick walls on future script errors :) http://www.newvegasnexus.com/downloads/file.php?id=41642 Link to comment Share on other sites More sharing options...
stevie70 Posted May 23, 2011 Share Posted May 23, 2011 (edited) I did something wrong because the object disappear along with the switchsounds like you made the object the switches enable parent.don't. :-)object is, if any, a linked ref (NOT enable parent) to the switch (or you can give it a unique refname and call that explicitely in your script instead of a linked ref). and it has to be a persistant ref in any case.if you want another object to appear when the first one disappears, make object 1 it's enable parent (set to opposite in this case) Edited May 23, 2011 by stevie70 Link to comment Share on other sites More sharing options...
stevie70 Posted May 23, 2011 Share Posted May 23, 2011 Are you using the GECK 1.3 Power Up utility? there is one finally?*joy* :-) Link to comment Share on other sites More sharing options...
Andyno Posted May 23, 2011 Author Share Posted May 23, 2011 Thanks for all the replies guys. :yes:I think it's time to describe everything I did before I get stuck even more. :rolleyes:I didn't want to do this because one of you may be the future player of my mod and that would spoil all the feature... :biggrin: What I exactly need to be done is to make a switch that turns off the water leak - to be more specific the waterfall that leaks through the pipe. So I placed the both objects (switch+waterfall) to my cell and set the following options:For the waterfall I gave it a unique reference ID (pump) and checked the "Persistent Reference".For the switch I checked "Open By Deafault", attached the script and connected it with the waterfall by the "Enable Parent" option. Here's the script... ScriptName BLPumpScript ref pump Begin OnActivate if pump == 0 set pump to GetLinkedRef endif if pump.GetDisabled pump.Enable else pump.Disable endif Activate End Link to comment Share on other sites More sharing options...
stevie70 Posted May 23, 2011 Share Posted May 23, 2011 So I placed the both objects (switch+waterfall) to my cell and set the following options:For the waterfall I gave it a unique reference ID (pump) and checked the "Persistent Reference".For the switch I checked "Open By Deafault", attached the script and connected it with the waterfall by the "Enable Parent" option.man, did you actally _read_ my last post or just thanked for it unread...? :-)like i said, the switch does NOT have the pump as a enabling parent, but as a (like it _says_ in the GetLinkedRef-part of your script) linked reference. and for the script,ScriptName BLPumpScript ref pump Begin OnActivate if pump == 0 set pump to GetLinkedRef endif i assume pump == 0 means the pump is not there and 1 is there? so what's the if for, you'll need the linked ref anyway to check it's statewouldn't do anything anyway, because you ask if pump is a numeric value (0), but you have pump set as a reference variable, that returns a string (the id of the linked object)and i don't know if it's a good idea to give a ref-variable ("pump") exactly the same name the reference it asks for has ("pump" as well). most people seem to tend to call their object references like objectREF, not necessary, but makes orientation easier. if pump.GetDisabled pump.Enable else pump.Disable endif i'm quite sure there'd be problems with your naming, because "pump" (see above) is the name of your variable AND of your object, so basically, pump.getdisabled asks for the value of whatever the linked ref is AND the object pump, wether it's linked or not, and i'm pretty sure that's not a good thing. :-) so first, rename your object. call it pumpREF or Maurice or whatever. and then, your script could go about like this scn BLPumpSCRIPT ref pump begin OnActivate set pump to GetLinkedRef ; your pump has to be LINKED REF to the switch for this , NOT enable parent !!!!! if pump.GetDisabled == 1 pump.enable setopenstate 1 ; this sets the switch to "on" (i prefer that to activate, which can produce weird results with the switch state's appearance) elseif pump.GetDisabled == 0 pump.disable setopenstate 0 endif end hope i have no typo in there, not geck-checked or if you have your pump a persistent ref and called it like pumpREF, you wouldn't need any linked refs, enabling parents or anything and just go with scn BLPumpSCRIPT begin OnActivate if pumpREF.GetDisabled == 1 pumpREF.enable setopenstate 1 elseif pumpREF.GetDisabled == 0 pumpREF.disable setopenstate 0 endif end which is a bit shorter and doesn't require any linking of any stuff. Link to comment Share on other sites More sharing options...
Recommended Posts