Deleted2746547User Posted May 23, 2012 Share Posted May 23, 2012 (edited) Still having a problem getting these scripts working again. (they were working before I lost some updates to the script_) Can't figure out WHAT I'm missing.... This is the 3 scripts that will run the lights/fuel at the base as part of a quest. for those that are good with coding, I had this system working perfectly BEFORE I lost my main files and had to start back with an earlier version. However, now I can't find the error that is keeping the system from working. Perhaps someone can find the error I'm making (or by looking into the esp)... <The esp. for the file is in my signature> The way it is supposed to work is the power starts as a quest. Once you have fission batteries you deposit it into the fuel tank (like transferring items in your inventory).... and then the light switches throughout the "base" can be switched on or off at will. As long as you have enough fuel in the tank's "inventory" you can turn the lights on or off at will and the script keeps track of how much fuel you are using/have left. Once you run out...the lights go off (if left on) and you have to deposit more batteries to start it again. That was working before but now in the mod.. it seems the tank just "takes" all your batteries (b/c nothing is left in your inventory once you "activate" it.) however, there is no activation sound nor the reg. item transfer. And the switches don't work. Not sure what I'm missing... POWER BASE SCRIPT {RAN AS PART OF THE BASE QUEST}---scn BlackbriarPowerBaseQuestScript int Fuel ; This is the total fuel units in stockint FuelRqd ; This is the calculated amount that will be used in a single 5 second period Begin GameModeIf FuelElsereturnEndif set FuelRqd to 0 ;Lghts1 uses 3 unit of Fuel/5secIf BlackbriarLgts1.GetDisabledElseset FuelRqd to FuelRqd + 3Endif ;Lghts2 uses 1 unit of Fuel/5secIf BlackbriarLgts2.GetDisabledElseset FuelRqd to FuelRqd + 1Endif ;Lghts3 uses 2 unit of Fuel/5secIf BlackbriarLgts3.GetDisabledElseset FuelRqd to FuelRqd + 2Endif ;Lghts4 uses 1 unit of Fuel/5secIf BlackbriarLgts4.GetDisabledElseset FuelRqd to FuelRqd + 1Endif ;Lghts5 uses 1 unit of Fuel/5secIf BlackbriarLgts5.GetDisabledElseset FuelRqd to FuelRqd + 1Endif ;Lghts6 uses 1 unit of Fuel/5secIf BlackbriarLgts6.GetDisabledElseset FuelRqd to FuelRqd + 1Endif ;Lghts7 uses 1 unit of Fuel/5secIf BlackbriarLgts7.GetDisabledElseset FuelRqd to FuelRqd + 3Endif ;Lghts8 uses 1 unit of Fuel/5secIf BlackbriarLgts8.GetDisabledElseset FuelRqd to FuelRqd + 1Endif ;Lghts9a uses 1 unit of Fuel/5secIf BlackbriarLgts9a.GetDisabledElseset FuelRqd to FuelRqd + 1Endif ;Lghts10a uses 1 unit of Fuel/5secIf BlackbriarLgts10a.GetDisabledElseset FuelRqd to FuelRqd + 1Endif ;Lghts11 uses 1 unit of Fuel/5secIf BlackbriarLgts11.GetDisabledElseset FuelRqd to FuelRqd + 1Endif ;Lghts12 uses 1 unit of Fuel/5secIf BlackbriarLgts12.GetDisabledElseset FuelRqd to FuelRqd + 1Endif ;Subtract the fuel usedset Fuel to Fuel - FuelRqd ;Turn off all power users when Fuel runs out.If Fuel < 1set Fuel to 0BlackbriarLgts1.DisableBlackbriarLgts2.DisableBlackbriarLgts3.DisableBlackbriarLgts4.DisableBlackbriarLgts5.DisableBlackbriarLgts6.DisableBlackbriarLgts7.DisableBlackbriarLgts8.DisableBlackbriarLgts9a.DisableBlackbriarLgts10a.DisableBlackbriarLgts11.DisableBlackbriarLgts12.Disable Endif End $$$$$$$$$$$$$$$$$$$$ NEXT SCRIPT$$$$$$$$$$$$$$$$$$$$$ Fuel Tank Script scn BlackbriarFuelTankBegin onActivateIf GetQuestRunning BlackbriarPowerBaseQuestElseStartQuest BlackbriarPowerBaseQuestEndif If player.GetItemCount FissionBatteryplayer.removeItem FissionBattery 1set BlackbriarPowerBaseQuest.Fuel to BlackbriarPowerBaseQuest.Fuel + 1500Else; ShowMessage BlackbriarPowerNoBatteries ; Uncomment when/if you want to display a msg.EndifEnd $$$$$$$$$$$$$$$$$$$NEXT SCRIPT$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Power light script ScriptName BlackbriarPowerLightScript ref light Begin OnActivateif BlackbriarPowerBaseQuest.Fuel == 0returnEndifif light == 0set light to GetLinkedRefendif if light.GetDisabledlight.Enableelselight.DisableendifActivateEnd Edited May 23, 2012 by Guest Link to comment Share on other sites More sharing options...
Deleted2746547User Posted May 23, 2012 Author Share Posted May 23, 2012 Ok, got the script working but I've encountered an occasional crash when I leave one building and enter the main courtyard. Is there a way to see if this is just a random crash or what script/error is causing it? Link to comment Share on other sites More sharing options...
Quetzlsacatanango Posted May 23, 2012 Share Posted May 23, 2012 Are you enabling things besides lights? Like NPCs, creatures? Link to comment Share on other sites More sharing options...
Deleted2746547User Posted May 23, 2012 Author Share Posted May 23, 2012 Are you enabling things besides lights? Like NPCs, creatures? Yes, quite a lot actually.. But it didnt seem to be causing this kind of crash until AFTER I got the light script working again. The clutter and junk in the NCRCF gets disabled as part of a quest/mission - though until I do the quests its handled by an activator and scripts that disables it. there are also scripts/activators to add npcs, sandbags, etc. Is there a way to see what is causing it. And it's more like a freeze... when you go outside to in (or vice versa) it seems to freeze during the transition. ?? argh! (I hate scripting) Link to comment Share on other sites More sharing options...
Deleted2746547User Posted May 23, 2012 Author Share Posted May 23, 2012 Are you enabling things besides lights? Like NPCs, creatures? And is there a more efficient/better way of handling that (the enabling/disabling/deleting) of markers, clutter, etc. Link to comment Share on other sites More sharing options...
Quetzlsacatanango Posted May 23, 2012 Share Posted May 23, 2012 Give each group a single enable parent, then enable/disable that one object as you please. Link to comment Share on other sites More sharing options...
Deleted2746547User Posted May 23, 2012 Author Share Posted May 23, 2012 Give each group a single enable parent, then enable/disable that one object as you please. what I've done..is i have maybe about 15 markers or more across the base.1. is tied to all the "junk" that will be disabled as part of the cleaning process (also part of the script marks it for deletion)2. All the perimeter lights are tied to one marker that is enabled as part of the lighting scripts. there are maybe 12 markers tied to various groups of lights.3. one markers handles all the guards4. one markers places all the sandbags,5. one marker places the tents. etc. Could it be because I have more lights and the script/process is tied to a feature that checks fuel every 5 seconds for all of the lights? don't remember that kind of crash before but i'm out of ideas. :/ Here is the script (generically) for removing clutter scn BlackbriarASCCLEANHOUSEScript Begin onActivate BlackbriarCleanHouseRef1.disable BlackbriarCleanHouseRef1.markfordelete Activate End How are things with you anyway? Link to comment Share on other sites More sharing options...
Quetzlsacatanango Posted May 23, 2012 Share Posted May 23, 2012 Sounds like you are doing it the right way.When I asked the question, I was thinking maybe you had an NPC wearing a custom armor that was malformed and crashing your game when got enabled.But you could be right if you are checking against every ref.If that is the case you could use a different variable to count the number of enabled "thingies", and then just multiply that number by your fuel requirement. You should get the same value and not have to count each one at all times. Link to comment Share on other sites More sharing options...
Deleted2746547User Posted May 23, 2012 Author Share Posted May 23, 2012 Its consistently crashing now whenever I turn on the lighting system - whenever I go from inside a building to outside. not every building but every other or so.. bam. crash. Link to comment Share on other sites More sharing options...
Cyberlazy Posted May 23, 2012 Share Posted May 23, 2012 Unrelated but this makes me long for my minecraft IC base...Where I would have to continiously fuel the furances or the lights would go out and zombies would spawn in my base.. :P You really must have some kinda creature start spawning if the lights go out! maybe just radroachs however... Link to comment Share on other sites More sharing options...
Recommended Posts