Agnot2006 Posted February 23, 2010 Share Posted February 23, 2010 I am trying to create a script that will turn a fire off during the day. So it should be disabled after 5 am and before 8pm. This is all taken from bits I gleaned from other people’s scripts; I don’t do this often and need some help. The fire stays on all the time at the moment. This is my script at the moment. What did I do wrong, Can anyone help? scn ArefuSwimPlaceFireScript short FireToggle short DoFirefirst begin gamemode if DoFirefirst==0 If gamehour >= 5 && gamehour <=19 Set FireToggle to 1 endif endif Set DoFirefirst to 1 end begin gamemode if gamehour >= 5 && Gamehour <= 19 && FireToggle==1 SwimPlaceFireRef.disable Set FireToggle to 0 endif If gamehour <= 5 && Gamehour >= 19 && FireToggle==0 SwimPlaceFireRef.enable Set FireToggle to 1 endif end Link to comment Share on other sites More sharing options...
TheChan Posted February 23, 2010 Share Posted February 23, 2010 It seems you have a lot of unnecessary things. See if this works: scn ArefuSwimPlaceFireScript begin gamemode If gamehour >= 5 || gamehour <=19 disable 0 else enable 0 endif end There should only be one GameMode block. '||' would probably work better than '&&'.Place this script on the actual campfire. Link to comment Share on other sites More sharing options...
Agnot2006 Posted February 23, 2010 Author Share Posted February 23, 2010 It seems you have a lot of unnecessary things. See if this works: scn ArefuSwimPlaceFireScript begin gamemode If gamehour >= 5 || gamehour <=19 disable 0 else enable 0 endif end There should only be one GameMode block. '||' would probably work better than '&&'.Place this script on the actual campfire. Thank You, I will give it a go as soon as I get home Link to comment Share on other sites More sharing options...
Cipscis Posted February 23, 2010 Share Posted February 23, 2010 You definitely don't want to use "||" there - it would cause your condition to always be true so the fire would stay disabled. Try this instead:Begin GameMode if GetDisabled if GameHour < 5 || GameHour > 20 Enable 1 endif elseif GameHour > 5 if GameHour < 20 Disable 1 endif endif EndCipscis Link to comment Share on other sites More sharing options...
TheChan Posted February 23, 2010 Share Posted February 23, 2010 You definitely don't want to use "||" there - it would cause your condition to always be true so the fire would stay disabled. Try this instead:CipscisWell wouldn't it work with the '&&' there instead? Link to comment Share on other sites More sharing options...
Cipscis Posted February 24, 2010 Share Posted February 24, 2010 It would, but then you'd be calling either Enable or Disable every frame, even if the reference is already in the correct state. Cipscis Link to comment Share on other sites More sharing options...
TheChan Posted February 24, 2010 Share Posted February 24, 2010 Ahh good point. Link to comment Share on other sites More sharing options...
Agnot2006 Posted February 24, 2010 Author Share Posted February 24, 2010 You definitely don't want to use "||" there - it would cause your condition to always be true so the fire would stay disabled. Try this instead:Begin GameMode if GetDisabled if GameHour < 5 || GameHour > 20 Enable 1 endif elseif GameHour > 5 if GameHour < 20 Disable 1 endif endif EndCipscis Thank You Cipscis Once again I will give it a try once I get home. Just to avoid any other possible problemsI place the script directly into the Fire barrel which I have made as unique base Object.The Persistent Reference is ticked. There are two other tick boxes in the reference box Turn Off Fire and Initially Disabled do I need any of these checked as well? Link to comment Share on other sites More sharing options...
TheChan Posted February 24, 2010 Share Posted February 24, 2010 No. You should know that the whole object will disappear, not just the fire, so you might just want to put static barrel there and then fire with the script inside of it. Link to comment Share on other sites More sharing options...
Agnot2006 Posted February 24, 2010 Author Share Posted February 24, 2010 No. You should know that the whole object will disappear, not just the fire, so you might just want to put static barrel there and then fire with the script inside of it. I’m only using the fire; the barrel is all below ground. Link to comment Share on other sites More sharing options...
Recommended Posts