DredDarkwater77 Posted April 4, 2011 Share Posted April 4, 2011 I amtrying to bind an electric switch to togle lights and the generator audio on and off, I truly am new at this modding thing if someone could direct me to the infirmation or tell me how to do this I would greatly appriciate it. Link to comment Share on other sites More sharing options...
xab666 Posted April 4, 2011 Share Posted April 4, 2011 your electric switch needs to be type acti (activator). your going to need at least 1 script, and to give refnames to the light and generator and sound.you'll also need to disable the light and sound intially. using refs: Switch , Generator, Light (i suggest others, these are horrible names) it would be something like this: scn SwitchGeneratorScript short isAct Begin OnActivate if isAct == 0 lights.enable GeneratorSound.enable set isAct to 1 else if isAct == 1 lights.disable Generatorsound.disable set isAct to 0 endif ;Activate endif end Attach this script to your activator switch, make sure to name all your references first or the script wont compile.the variable (short) IsAct is 0 when off, and 1 when lights and generator sound are on.this allows repeated activation to switch between the two modes.Lights.enable enables the reference called 'Lights' this enables the initially disabled (not visable to start) lights.generatorsound does the same thing for the sound... the optional (commented out ;activate) at the bottom might help if it doesn't animate the switch proplery.so would adding Switch.setOpenState 2 ;Open Switch.SetOpenState 0 ;Closed under generator.disable/enable respectively goodluck Link to comment Share on other sites More sharing options...
DredDarkwater77 Posted April 5, 2011 Author Share Posted April 5, 2011 Thank you was afraid it would involve scripting lol guess thats another thing to learn about =( Link to comment Share on other sites More sharing options...
stevie70 Posted April 5, 2011 Share Posted April 5, 2011 Thank you was afraid it would involve scripting lol guess thats another thing to learn about =(i found that a bit scary too at first, but by trying out things, looking at existing scripts and keeping the geck-wiki's section about script commands open, you get a hang of it quite quick and it actually even is kind of fun. what scripting you see in my vegas-baby-mod (my first one) is what i could do after no more than a week, so don't panic :-) Link to comment Share on other sites More sharing options...
xab666 Posted April 23, 2011 Share Posted April 23, 2011 (edited) heres an improved easier script, put this on the switch and make it a linked reference to a XMARKER, then set the generator sound and the light as enable children (select the xmarker as an enable parent of each object). to start the lights on set each object (children) to "Set enable state to opposite of parent'and disable the xmarker to begin with. scn MyLightSwitchScript short on ref MyLink begin GameMode ; this is always running when loaded, so if on == 1 or 0 it changes accordingly. Set mylink to GetLinkedRef if on == 1 mylink.enable ; this enables the xmarker, and through the enable relationship, its children endif if on == 0 mylink.disable endif end begin onactivate ; this block runs when the player activates the object (flicks the switch in this case) if Isactionref Player == 1 ; ONLY if the player flicks the switch if on == 0 ; if its already OFF, default set on to 1 elseif on == 1 ; if on is already set to 1 set on to 0 endif activate ; play the switch animation endif end this script doesnt need persistant references on the light object or generator sound. though it never hurts.i learn more everyday :) Edited April 23, 2011 by xab666 Link to comment Share on other sites More sharing options...
DredDarkwater77 Posted April 23, 2011 Author Share Posted April 23, 2011 Thank you, been trying to teach myself how to script but its a slow process with the time I can devote to it. Link to comment Share on other sites More sharing options...
Floatsup Posted April 23, 2011 Share Posted April 23, 2011 Hey Dred. We've all been there bro, just keep slugging along. It will come. Just takes time, patantiance, bottle of rum, hammer, explosives, and a pillow. Link to comment Share on other sites More sharing options...
Recommended Posts