TodaY Posted May 20, 2010 Share Posted May 20, 2010 Hi everybody ;DI've been trying to get this script running for over a week now, and I just can't seem to do it. I want to make a switch that turns a flame (activator) and "light bulb" on and off. So I made both the flame and the light bulb persistant referances, and gave them a reference ID. Then I made a script like this:---short stage Begin onactivate if stage == 0 REFID.disable set stage to 1 elseif stage == 1 REFID.enable set stage to 0 endifend---(I left the anim scripting for the swich out, as that worked)That script didn't work, so I made the flame the parent of the switch, and the lightbulb the parent of the flame, and wrote this script:---ref myparentshort stage begin onactivate set parent to myparent (I know parent is wrong here - I did it correct in the script, but can't think of the real command at the moment) if stage == 0 myparent.disable set stage to 1 elseif stage == 1 myparent.enable set stage to 0 endifend---That didn't work either, and I really don't know what I am doing wrong here.If anyone helps me solve this problem, kudos, hugs and cookies will be given. Execpt for I don't have cookies, and hugs are gonna be hard since you probably live in another country O.-Happy modding, and thnks for reading! ;D Link to comment Share on other sites More sharing options...
David Brasher Posted May 21, 2010 Share Posted May 21, 2010 Here is a script I made. I tested it and it works. I added the timer, because it turns out that the first and second blocks were activating simultaneously. (Or actually one a split second after the other, but within the duration of the instant which is activation.) SCN AATESTLightswitch ; Object script applied to switch. Short State Short Timer Begin OnActivate If State == 0 && Timer == 0 AATESTLight.Enable AATESTFire.Enable Set State to 1 Set Timer to 3 EndIf If State == 1 && Timer == 0 AATESTLight.Disable AATESTFire.Disable Set State to 0 Set Timer to 3 EndIf End Begin GameMode If Timer > 0 Set Timer to Timer - GetSecondsPassed EndIf End Link to comment Share on other sites More sharing options...
Maigrets Posted May 21, 2010 Share Posted May 21, 2010 Besides David's script this tutorial at the CS Wiki goes into a bit more depth and shows you how to link multiple switches and lights. It can also be used for other things that could be switched on and off as needed. http://cs.elderscrolls.com/constwiki/index.php/Light_switch_tutorial Link to comment Share on other sites More sharing options...
TodaY Posted May 21, 2010 Author Share Posted May 21, 2010 Thanks ;DKudos to both of you! Link to comment Share on other sites More sharing options...
Recommended Posts