Jump to content

A LITTLE SCRIPTING HELP - Lighting/Fuel System


Deleted2746547User

Recommended Posts

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 stock

int FuelRqd ; This is the calculated amount that will be used in a single 5 second period

 

Begin GameMode

If Fuel

Else

return

Endif

 

set FuelRqd to 0

 

;Lghts1 uses 3 unit of Fuel/5sec

If BlackbriarLgts1.GetDisabled

Else

set FuelRqd to FuelRqd + 3

Endif

 

;Lghts2 uses 1 unit of Fuel/5sec

If BlackbriarLgts2.GetDisabled

Else

set FuelRqd to FuelRqd + 1

Endif

 

;Lghts3 uses 2 unit of Fuel/5sec

If BlackbriarLgts3.GetDisabled

Else

set FuelRqd to FuelRqd + 2

Endif

 

;Lghts4 uses 1 unit of Fuel/5sec

If BlackbriarLgts4.GetDisabled

Else

set FuelRqd to FuelRqd + 1

Endif

 

;Lghts5 uses 1 unit of Fuel/5sec

If BlackbriarLgts5.GetDisabled

Else

set FuelRqd to FuelRqd + 1

Endif

 

;Lghts6 uses 1 unit of Fuel/5sec

If BlackbriarLgts6.GetDisabled

Else

set FuelRqd to FuelRqd + 1

Endif

 

;Lghts7 uses 1 unit of Fuel/5sec

If BlackbriarLgts7.GetDisabled

Else

set FuelRqd to FuelRqd + 3

Endif

 

;Lghts8 uses 1 unit of Fuel/5sec

If BlackbriarLgts8.GetDisabled

Else

set FuelRqd to FuelRqd + 1

Endif

 

;Lghts9a uses 1 unit of Fuel/5sec

If BlackbriarLgts9a.GetDisabled

Else

set FuelRqd to FuelRqd + 1

Endif

 

;Lghts10a uses 1 unit of Fuel/5sec

If BlackbriarLgts10a.GetDisabled

Else

set FuelRqd to FuelRqd + 1

Endif

 

;Lghts11 uses 1 unit of Fuel/5sec

If BlackbriarLgts11.GetDisabled

Else

set FuelRqd to FuelRqd + 1

Endif

 

;Lghts12 uses 1 unit of Fuel/5sec

If BlackbriarLgts12.GetDisabled

Else

set FuelRqd to FuelRqd + 1

Endif

 

;Subtract the fuel used

set Fuel to Fuel - FuelRqd

 

;Turn off all power users when Fuel runs out.

If Fuel < 1

set Fuel to 0

BlackbriarLgts1.Disable

BlackbriarLgts2.Disable

BlackbriarLgts3.Disable

BlackbriarLgts4.Disable

BlackbriarLgts5.Disable

BlackbriarLgts6.Disable

BlackbriarLgts7.Disable

BlackbriarLgts8.Disable

BlackbriarLgts9a.Disable

BlackbriarLgts10a.Disable

BlackbriarLgts11.Disable

BlackbriarLgts12.Disable

 

Endif

 

End

 

 

 

 

$$$$$$$$$$$$$$$$$$$$ NEXT SCRIPT$$$$$$$$$$$$$$$$$$$$$

 

Fuel Tank Script

 

scn BlackbriarFuelTank

Begin onActivate

If GetQuestRunning BlackbriarPowerBaseQuest

Else

StartQuest BlackbriarPowerBaseQuest

Endif

 

If player.GetItemCount FissionBattery

player.removeItem FissionBattery 1

set BlackbriarPowerBaseQuest.Fuel to BlackbriarPowerBaseQuest.Fuel + 1500

Else

; ShowMessage BlackbriarPowerNoBatteries ; Uncomment when/if you want to display a msg.

Endif

End

 

 

$$$$$$$$$$$$$$$$$$$NEXT SCRIPT$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

 

Power light script

 

ScriptName BlackbriarPowerLightScript

 

ref light

 

Begin OnActivate

if BlackbriarPowerBaseQuest.Fuel == 0

return

Endif

if light == 0

set light to GetLinkedRef

endif

 

if light.GetDisabled

light.Enable

else

light.Disable

endif

Activate

End

Edited by Guest
Link to comment
Share on other sites

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

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 guards

4. 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

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

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...