Jump to content

Help with a script.


Erikdeda1

Recommended Posts

This is the StealthArmorMKII mod night vision script but the recharging menu annoys me; so how do i disable power drain and the popping up menu?

 

scn NVNightVisionQScript

 

;================================

;Mr. Lab Technician - Quest control script for creating chemicals

;Marvin Raymakers

;[email protected]

;================================

 

short KeyCD

short KeyCD1

short DoOnce

short Initialize

short MaxPower

short DoOnce0

short DoOnce25

short DoOnce50

short DoOnce75

short DoOnce100

short GogglesPower

short GoggleRecharge

short AutoCharge

short UseEndurable

short AutoChargeButton

short SECPower

short MFCPower

short ECPPower

short FiBPower

float fBatteryPower

short DrainPower

short ShowMenu

short UnlockPowers

short IncExcl

short ExcludeSEC

short ExcludeMFC

short ExcludeECP

short ExcludeFiB

 

begin gamemode

; Called by equiping the goggles

if ( UnlockPowers == 1 )

if ( ShowMenu == -1 )

ShowMessage GoggleRechargeMsg

Set GoggleRecharge to -1

Set ShowMenu to 0

endif

; Poweramounts for the different sources

if ( Initialize == 0 )

Set Initialize to 1

Set SECPower to 90

Set MFCPower to 300

Set ECPPower to 600

Set FiBPower to 1200

endif

;================================ NIGHTVISION FUNCTION ================================

; FOSE command for the "N" key

if ( IsKeyPressed 49 )

if ( KeyCD == 0 )

if ( Player.IsImageSpaceActive NVGogglesISM == 1 ) ; Has nightvision?

Set DrainPower to 0 ; Stop power draining

Player.rimod NVGogglesISM ; remove nightvision

PlaySound UIPipBoyLightOff

elseif ( Player.IsImageSpaceActive NVGogglesISM == 0 ) ; Nightvision not active?

if ( GogglesPower == 0 ) ; No power left?

ShowMessage GoggleRechargeMsg ; Show menu for recharging

Set GoggleRecharge to -1

else

Set DrainPower to -1 ; otherwise start draining power and turn on nightvision

Player.imod NVGogglesISM

PlaySound UIPipBoyLightOn

endif

endif

Set KeyCD to 1

endif

elseif ( KeyCD == 1 )

Set KeyCD to 0

endif

; Recharging Menu

if ( GoggleRecharge == -1 )

Set GoggleRecharge to GetButtonPressed

Set DoOnce to 0

if ( GoggleRecharge == 0 )

return

elseif ( GoggleRecharge == 1 ) ; Following is just the player choice of what to recharge with + setting the power to its max again

if ( fBatteryPower < 10 )

Player.RemoveItem AmmoSmallEnergyCell 10 1

Set MaxPower to SECPower

Set fBatteryPower to SECPower

Set GogglesPower to 1

ShowMessage GogglesPoweredMsg

else

ShowMessage StillSomePowerLeftMsg ; If there's still some power left, you cant recharge yet. (though this is also controlled by a condition set on the messagebox itself)

endif ; So you probably wont see this messagebox ever

elseif ( GoggleRecharge == 2 )

if ( fBatteryPower < 10 )

Player.RemoveItem AmmoMicroFusionCell 5 1

Set MaxPower to ECPPower

Set fBatteryPower to ECPPower

Set GogglesPower to 1

ShowMessage GogglesPoweredMsg

else

ShowMessage StillSomePowerLeftMsg

endif

elseif ( GoggleRecharge == 3 )

if ( fBatteryPower < 10 )

Player.RemoveItem AmmoElectronChargePack 2 1

Set MaxPower to ECPPower

Set fBatteryPower to ECPPower

Set GogglesPower to 1

ShowMessage GogglesPoweredMsg

else

ShowMessage StillSomePowerLeftMsg

endif

elseif ( GoggleRecharge == 4 )

if ( fBatteryPower < 10 )

Player.RemoveItem FissionBattery 1 1

Set MaxPower to FiBPower

Set fBatteryPower to FiBPower

Set GogglesPower to 1

ShowMessage GogglesPoweredMsg

else

ShowMessage StillSomePowerLeftMsg

endif

elseif ( GoggleRecharge == 5 ) ; Auto charge sub-menu

ShowMessage AutoChargeOnMsg

Set AutoChargeButton to -1

endif

endif

 

if ( AutoChargeButton == -1 ) ; Sub-menu for auto charging

Set AutoChargeButton to GetButtonPressed

if ( AutoChargeButton == 0 )

Set UseEndurable to -1

Set AutoCharge to -1

ShowMessage AutoChargeA

elseif ( AutoChargeButton == 1 )

Set UseEndurable to 1

Set AutoCharge to -1

ShowMessage AutoChargeB

elseif ( AutoChargeButton == 2 )

ShowMessage IncExclMenuMsg

Set IncExcl to -1

elseif ( AutoChargeButton == 3 )

Set AutoCharge to 0

if ( Player.IsImageSpaceActive NVGogglesISM == 1 ) ; i added this to prevent an exploit, though it's probably obsolete as the mod is now.

Set DrainPower to -1

endif

ShowMessage AutoChargeOffMsg

endif

endif

 

if ( IncExcl == -1 )

Set IncExcl to GetButtonPressed

if ( IncExcl == 0 )

ShowMessage AutoChargeOnMsg

Set AutoChargeButton to -1

elseif ( IncExcl == 1 )

if ( ExcludeSEC == 1 )

Set ExcludeSEC to 0

else

Set ExcludeSEC to 1

endif

ShowMessage IncExclMenuMsg

Set IncExcl to -1

elseif ( IncExcl == 2 )

if ( ExcludeMFC == 1 )

Set ExcludeMFC to 0

else

Set ExcludeMFC to 1

endif

ShowMessage IncExclMenuMsg

Set IncExcl to -1

elseif ( IncExcl == 3 )

if ( ExcludeECP == 1 )

Set ExcludeECP to 0

else

Set ExcludeECP to 1

endif

ShowMessage IncExclMenuMsg

Set IncExcl to -1

elseif ( IncExcl == 4 )

if ( ExcludeFiB == 1 )

Set ExcludeFiB to 0

else

Set ExcludeFiB to 1

endif

ShowMessage IncExclMenuMsg

Set IncExcl to -1

elseif ( IncExcl == 5 )

ShowMessage IncExclOverviewMsg, ExcludeSEC, ExcludeMFC, ExcludeECP, ExcludeFiB

Set IncExcl to -1

ShowMessage IncExclMenuMsg

endif

endif

 

if ( DrainPower == -1 ) ; the power draining script with message to how much power is left.

if fBatteryPower > 0

Set fBatteryPower to fBatteryPower - GetSecondsPassed

if ( fBatteryPower <= ( MaxPower * 0.25 ) ) && ( DoOnce == 2 )

Set DoOnce to 3

ShowMessage NVGogglesDrain25

elseif ( fBatteryPower <= ( MaxPower * 0.5 ) ) && ( DoOnce == 1 )

Set DoOnce to 2

ShowMessage NVGogglesDrain50

elseif ( fBatteryPower <= ( MaxPower * 0.75 ) ) && ( DoOnce == 0 )

Set DoOnce to 1

ShowMessage NVGogglesDrain75

endif

elseif ( DoOnce == 3 ) ; When power is used up, this happens, though if you have auto charging on, this part never turns true

ShowMessage NVGoggles0 ; So goggles will stay on with auto charge. Handy. :)

Set GogglesPower to 0 ; With auto charging on, this will only happen when player runs out of power sources

Set DoOnce to 4 ; Usualy power is recharged BEFORE power runs out

Player.rimod NVGogglesISM

PlaySound UIPipBoyLightOff

Set DrainPower to 0

endif

endif

; AmmoSmallEnergyCell, AmmoMicroFusionCell, AmmoElectronChargePack, FissionBattery

if ( AutoCharge == -1 ) ; Auto charge is on

if ( UseEndurable == -1 ) ; Option A

If fBatteryPower <= ( MaxPower * 0.02 )

Set DoOnce to 0

if ( Player.GetItemCount AmmoSmallEnergyCell >= 10 ) && ( ExcludeSEC == 0 ) ; The script will first check this and remove it if player has it

Player.RemoveItem AmmoSmallEnergyCell 10 1

Set MaxPower to SECPower

Set fBatteryPower to SECPower

Set GogglesPower to 1

ShowMessage NVAutoChargedMsg

elseif ( Player.GetItemCount AmmoMicroFusionCell >= 5 ) && ( ExcludeMFC == 0 ) ; Otherwise it will remove this.

Player.RemoveItem AmmoMicroFusionCell 5 1

Set MaxPower to ECPPower

Set fBatteryPower to ECPPower

Set GogglesPower to 1

ShowMessage NVAutoChargedMsg

elseif ( Player.GetItemCount AmmoElectronChargePack >= 2 ) && ( ExcludeECP == 0 ) ; etc.

Player.RemoveItem AmmoElectronChargePack 2 1

Set MaxPower to ECPPower

Set fBatteryPower to ECPPower

Set GogglesPower to 1

ShowMessage NVAutoChargedMsg

elseif ( Player.GetItemCount FissionBattery >= 1 ) && ( ExcludeFiB == 0 ) ; etc.

Player.RemoveItem FissionBattery 1 1

Set MaxPower to FiBPower

Set fBatteryPower to FiBPower

Set GogglesPower to 1

ShowMessage NVAutoChargedMsg

else

Set AutoCharge to 0 ; If no sources are found a message is displayed.

ShowMessage AutoChargeDisabledMsg

endif

endif

elseif ( UseEndurable == 1 ) ; Option B

If fBatteryPower <= ( MaxPower * 0.02 )

Set DoOnce to 0

if ( Player.GetItemCount FissionBattery >= 1 ) && ( ExcludeFiB == 0 )

Player.RemoveItem FissionBattery 1 1

Set MaxPower to FiBPower

Set fBatteryPower to FiBPower

Set GogglesPower to 1

ShowMessage NVAutoChargedMsg

elseif ( Player.GetItemCount AmmoElectronChargePack >= 2 ) && ( ExcludeECP == 0 )

Player.RemoveItem AmmoElectronChargePack 2 1

Set MaxPower to ECPPower

Set fBatteryPower to ECPPower

Set GogglesPower to 1

ShowMessage NVAutoChargedMsg

elseif ( Player.GetItemCount AmmoMicroFusionCell >= 5 ) && ( ExcludeMFC == 0 )

Player.RemoveItem AmmoMicroFusionCell 5 1

Set MaxPower to ECPPower

Set fBatteryPower to ECPPower

Set GogglesPower to 1

ShowMessage NVAutoChargedMsg

elseif ( Player.GetItemCount AmmoSmallEnergyCell >= 10 ) && ( ExcludeSEC == 0 )

Player.RemoveItem AmmoSmallEnergyCell 10 1

Set MaxPower to SECPower

Set fBatteryPower to SECPower

Set GogglesPower to 1

ShowMessage NVAutoChargedMsg

else

Set AutoCharge to 0

ShowMessage AutoChargeDisabledMsg

endif

endif

endif

endif

endif

end

Link to comment
Share on other sites

  • Recently Browsing   0 members

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