Added script sources
This commit is contained in:
parent
e11196f336
commit
5d25082558
163
src/EBxBootstrap.gek
Normal file
163
src/EBxBootstrap.gek
Normal file
@ -0,0 +1,163 @@
|
|||||||
|
scn EBxBootstrap
|
||||||
|
|
||||||
|
ref rItem
|
||||||
|
ref rScript
|
||||||
|
ref rBrahminScriptDC
|
||||||
|
ref rList
|
||||||
|
int i
|
||||||
|
|
||||||
|
begin function {}
|
||||||
|
|
||||||
|
; Save default activate prompts for later
|
||||||
|
|
||||||
|
playerRef.AuxiliaryVariableSetString "*sDrinkPrompt" (GetStringSetting "sTargetTypeDrink")
|
||||||
|
playerRef.AuxiliaryVariableSetString "*sActivatePrompt" (GetStringSetting "sTargetTypeActivate")
|
||||||
|
|
||||||
|
; Add new items to form lists
|
||||||
|
|
||||||
|
ListAddForm NonAlchoholicDrinks EBxBrahminMilk
|
||||||
|
|
||||||
|
ListAddForm NVDLC03AllEmptyBottlesLIST EBxBeerBottleEmpty
|
||||||
|
ListAddForm RockItLauncherAmmo EBxBeerBottleEmpty
|
||||||
|
|
||||||
|
ListAddForm NVDLC03AllEmptyBottlesLIST EBxVodkaBottleEmpty
|
||||||
|
ListAddForm RockItLauncherAmmo EBxVodkaBottleEmpty
|
||||||
|
|
||||||
|
ListAddForm NVDLC03AllEmptyBottlesLIST EBxWineBottleEmpty
|
||||||
|
ListAddForm RockItLauncherAmmo EBxWineBottleEmpty
|
||||||
|
|
||||||
|
ListAddForm EBxUpgradableToDirtyList IrradiatedWaterUnpurified
|
||||||
|
ListAddForm EBxUpgradableToPuraList IrradiatedWaterUnpurified
|
||||||
|
ListAddForm EBxUpgradableToPurifiedList IrradiatedWaterUnpurified
|
||||||
|
|
||||||
|
; Fix bottle names in English version
|
||||||
|
|
||||||
|
if eval $ScotchBottle01Empty01 == "Large Whiskey Bottle"
|
||||||
|
SetName "Empty Scotch Bottle" ScotchBottle01Empty01
|
||||||
|
endif
|
||||||
|
|
||||||
|
if eval $Milkbottle01 == "Milk Bottle"
|
||||||
|
SetName "Empty Milk Bottle" Milkbottle01
|
||||||
|
endif
|
||||||
|
|
||||||
|
; PipBoy icons
|
||||||
|
|
||||||
|
SetTexturePath "interface\icons\pipboyimages\items\items_whiskey.dds" WhiskeyBottle01Empty01
|
||||||
|
SetTexturePath "interface\icons\pipboyImages\Items\item_scotch.dds" ScotchBottle01Empty01
|
||||||
|
SetTexturePath "interface\icons\pipboyimages\items\items_cola.dds" NukaColaBottle
|
||||||
|
SetTexturePath "interface\icons\pipboyimages\items\items_cola.dds" SodaBottleEmpty01
|
||||||
|
SetTexturePath "interface\icons\pipboyimages\items\items_sunset_sarsp.dds" SSBottleEmpty
|
||||||
|
SetTexturePath "interface\icons\pipboyimages\items\milkbottle.dds" Milkbottle01
|
||||||
|
|
||||||
|
; Make irradiated water worthless
|
||||||
|
|
||||||
|
SetValueAlt IrradiatedWaterUnpurified EBxBottlePrice
|
||||||
|
|
||||||
|
; Vault 13 Canteen
|
||||||
|
|
||||||
|
if IsModLoaded "ClassicPack.esm"
|
||||||
|
let rItem := GetFormFromMod "FalloutNV.esm" "174095" ; PreordVault13CanteenQuest
|
||||||
|
if IsFormValid rItem
|
||||||
|
RemoveScript rItem
|
||||||
|
endif
|
||||||
|
let rItem := GetFormFromMod "FalloutNV.esm" "1735D2" ; PreordVaultCanteen
|
||||||
|
if IsFormValid rItem
|
||||||
|
SetScript EBxPreordVault13CanteenScript rItem
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
; Draining on middle click
|
||||||
|
; Short callback notation with SetOnKeyUp/DownEventHandler currently throws an exception with xNVSE 6.20 + JIP LN 56.31
|
||||||
|
|
||||||
|
SetOnMenuOpenEventHandler (begin function { i }
|
||||||
|
SetOnKeyUpEventHandler EBxOnMiddleClick 1 258
|
||||||
|
end) 1 1002
|
||||||
|
|
||||||
|
SetOnMenuCloseEventHandler (begin function { i }
|
||||||
|
SetOnKeyUpEventHandler EBxOnMiddleClick 0 258
|
||||||
|
end) 1 1002
|
||||||
|
|
||||||
|
; Vault 13 Canteen effect
|
||||||
|
|
||||||
|
SetOnUseAidItemEventHandler (begin function { rItem }
|
||||||
|
if this == playerRef
|
||||||
|
if eval rItem := ListGetNthForm EBxCanteenEffects EBxCanteenDrink
|
||||||
|
playerRef.CIOS rItem
|
||||||
|
else
|
||||||
|
playerRef.CIOS WaterPurified
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
end) 1 EBxVault13Canteen
|
||||||
|
|
||||||
|
; SSBottleEmptyNoFloat
|
||||||
|
|
||||||
|
if IsScripted SSBottleEmptyNoFloat == 0
|
||||||
|
SetEventHandler "OnAdd" (begin function { rItem, rScript }
|
||||||
|
; The item is not in player's inventory at this point
|
||||||
|
CallAfterSeconds 0 (begin function {}
|
||||||
|
let i := PlayerRef.GetItemCount SSBottleEmptyNoFloat
|
||||||
|
if i > 0
|
||||||
|
PlayerRef.RemoveItem SSBottleEmptyNoFloat i 1
|
||||||
|
PlayerRef.AddItem SSBottleEmpty i 1
|
||||||
|
endif
|
||||||
|
end)
|
||||||
|
end) "first"::SSBottleEmptyNoFloat "second"::playerRef
|
||||||
|
endif
|
||||||
|
|
||||||
|
; If not TTW, update NonAlchoholicDrinks
|
||||||
|
|
||||||
|
let EBxTTW := IsModLoaded "Fallout3.esm"
|
||||||
|
|
||||||
|
if EBxTTW == 0
|
||||||
|
let i := 0
|
||||||
|
while rItem := ListGetNthForm EBxListNonAlchoholicDrinks i
|
||||||
|
if ListGetFormIndex NonAlchoholicDrinks rItem == -1
|
||||||
|
ListAddForm NonAlchoholicDrinks rItem
|
||||||
|
endif
|
||||||
|
let i += 1
|
||||||
|
loop
|
||||||
|
endif
|
||||||
|
|
||||||
|
; Automatic detection of alchoholic drinks
|
||||||
|
|
||||||
|
let rList := TempCloneForm EmptyFormList
|
||||||
|
|
||||||
|
GetLoadedType rList 47
|
||||||
|
let i := ListGetCount rList
|
||||||
|
while i > 0
|
||||||
|
let i -= 1
|
||||||
|
let rItem := ListGetNthForm rList i
|
||||||
|
if GetEquipType rItem == 13
|
||||||
|
if ListGetFormIndex AlchoholicDrinks rItem == -1
|
||||||
|
ListAddForm AlchoholicDrinks rItem
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
loop
|
||||||
|
|
||||||
|
; Enable brahmin milking
|
||||||
|
|
||||||
|
if EBxTTW
|
||||||
|
set rBrahminScriptDC to GetFormFromMod "Fallout3.esm" "38705" ; CRBrahminScriptDC
|
||||||
|
endif
|
||||||
|
|
||||||
|
GetLoadedType rList 43
|
||||||
|
let i := ListGetCount rList
|
||||||
|
while i > 0
|
||||||
|
let i -= 1
|
||||||
|
let rItem := ListGetNthForm rList i
|
||||||
|
if eval (GetCreatureType rItem == 1) && (rScript := GetScript rItem) && (rScript == CRBrahminScript || rScript == rBrahminScriptDC)
|
||||||
|
continue
|
||||||
|
endif
|
||||||
|
ListRemoveNthForm rList i
|
||||||
|
loop
|
||||||
|
SetEventHandler "OnActivate" EBxMilkBrahmin "first"::rList "second"::playerRef
|
||||||
|
|
||||||
|
ListClear rList
|
||||||
|
let rList := 0
|
||||||
|
|
||||||
|
; Game load events
|
||||||
|
|
||||||
|
SetEventHandler "NewGame" ({} => call EBxOnGameLoad 1)
|
||||||
|
SetEventHandler "PostLoadGame" EBxOnGameLoad
|
||||||
|
|
||||||
|
end
|
35
src/EBxFillFromObject.gek
Normal file
35
src/EBxFillFromObject.gek
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
scn EBxFillFromObject
|
||||||
|
|
||||||
|
ref rSource
|
||||||
|
ref rDrink
|
||||||
|
ref rReplaceables
|
||||||
|
array_var aArgs
|
||||||
|
|
||||||
|
begin function { rSource }
|
||||||
|
|
||||||
|
if rSource == 0
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
let aArgs := call EBxGetDrinksToUpgrade rSource
|
||||||
|
|
||||||
|
if eval 0 >= ar_size aArgs
|
||||||
|
let aArgs := ar_null
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
let rDrink := aArgs[0]
|
||||||
|
let rReplaceables := aArgs[1]
|
||||||
|
let aArgs := ar_null
|
||||||
|
|
||||||
|
if playerRef.GetItemCount caps001 < playerRef.GetItemCount rReplaceables
|
||||||
|
ShowMessage EBxMsgNoCaps
|
||||||
|
endif
|
||||||
|
|
||||||
|
call EBxReplaceFormListWithItem rDrink rReplaceables
|
||||||
|
|
||||||
|
if EBxCanteenSipsMax > 0
|
||||||
|
call EBxReplenishCanteen rDrink 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
end
|
51
src/EBxGetBottleByDrink.gek
Normal file
51
src/EBxGetBottleByDrink.gek
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
scn EBxGetBottleByDrink
|
||||||
|
|
||||||
|
int iCount
|
||||||
|
ref rDrink
|
||||||
|
ref rBaseForm
|
||||||
|
ref rBottle
|
||||||
|
|
||||||
|
begin function { rDrink }
|
||||||
|
|
||||||
|
if IsReference rDrink
|
||||||
|
set rBaseForm to rDrink.GetBaseForm
|
||||||
|
else
|
||||||
|
set rBaseForm to rDrink
|
||||||
|
endif
|
||||||
|
|
||||||
|
if rBaseForm == IrradiatedScotch || rBaseForm == Scotch || rBaseForm == ScotchGood
|
||||||
|
set rBottle to ScotchBottle01Empty01
|
||||||
|
elseif rBaseForm == SSBottleFull || rBaseForm == IrradiatedSSBottleFull
|
||||||
|
set rBottle to SSBottleEmpty
|
||||||
|
elseif rBaseForm == Beer || rBaseForm == IrradiatedBeer
|
||||||
|
set rBottle to EBxBeerBottleEmpty
|
||||||
|
elseif rBaseForm == Vodka
|
||||||
|
set rBottle to EBxVodkaBottleEmpty
|
||||||
|
elseif rBaseForm == Whiskey || rBaseForm == IrradiatedWhiskey || rBaseForm == WhiskeyDixon
|
||||||
|
set rBottle to WhiskeyBottle01Empty01
|
||||||
|
elseif rBaseForm == Wine
|
||||||
|
set rBottle to EBxWineBottleEmpty
|
||||||
|
elseif eval rBaseForm == EBxBrahminMilk || IsRefInList WaterLIST rDrink > -1
|
||||||
|
|
||||||
|
; prevent endless loop
|
||||||
|
if ListGetCount NVDLC03AllEmptyBottlesLIST > 0
|
||||||
|
|
||||||
|
while rBottle == 0 || rBottle == SSBottleEmptyNoFloat
|
||||||
|
set iCount to ListGetCount NVDLC03AllEmptyBottlesLIST
|
||||||
|
set iCount to Rand 0 iCount
|
||||||
|
set rBottle to ListGetNthForm NVDLC03AllEmptyBottlesLIST iCount
|
||||||
|
loop
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
elseif IsRefInList NukaBottleDrinks rDrink > -1
|
||||||
|
set rBottle to NukaColaBottle
|
||||||
|
elseif eval GetAddictionEffect rBaseForm == WithdrawalAlcohol || IsRefInList AlchoholicDrinks rDrink > -1
|
||||||
|
set rBottle to ScotchBottle01Empty01
|
||||||
|
elseif IsRefInList NonAlchoholicDrinks rDrink > -1
|
||||||
|
set rBottle to SodaBottleEmpty01
|
||||||
|
endif
|
||||||
|
|
||||||
|
SetFunctionValue rBottle
|
||||||
|
|
||||||
|
end
|
74
src/EBxGetDrinksToUpgrade.gek
Normal file
74
src/EBxGetDrinksToUpgrade.gek
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
scn EBxGetDrinksToUpgrade
|
||||||
|
|
||||||
|
ref rSource
|
||||||
|
ref rWaterType
|
||||||
|
ref rWaterEffect
|
||||||
|
|
||||||
|
; TTW
|
||||||
|
ref rMQA
|
||||||
|
ref rAquaPura
|
||||||
|
|
||||||
|
begin function { rSource }
|
||||||
|
|
||||||
|
if GetType rSource == 21 ; activator
|
||||||
|
set rWaterType to rSource.GetActivatorWaterType
|
||||||
|
else
|
||||||
|
set rWaterType to GetCrosshairWater
|
||||||
|
endif
|
||||||
|
|
||||||
|
if IsFormValid rWaterType == 0
|
||||||
|
SetFunctionValue (ar_construct "array")
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
set rWaterEffect to GetWaterFormEffect rWaterType
|
||||||
|
|
||||||
|
if IsFormValid rWaterEffect == 0
|
||||||
|
; fallback for water types without effect
|
||||||
|
SetFunctionValue (ar_list WaterUnpurified, EBxUpgradableToDirtyList)
|
||||||
|
|
||||||
|
elseif rWaterEffect == WaterHeal1Purified
|
||||||
|
if EBxHardcore
|
||||||
|
SetFunctionValue (ar_list WaterUnpurified, EBxUpgradableToDirtyList)
|
||||||
|
else
|
||||||
|
SetFunctionValue (ar_list WaterPurified, EBxUpgradableToPurifiedList)
|
||||||
|
endif
|
||||||
|
|
||||||
|
elseif rWaterEffect == WaterHeal2Good
|
||||||
|
SetFunctionValue (ar_list WaterUnpurified, EBxUpgradableToDirtyList)
|
||||||
|
|
||||||
|
elseif rWaterEffect == WaterHeal3Average
|
||||||
|
if EBxHardcore
|
||||||
|
SetFunctionValue (ar_list IrradiatedWaterUnpurified, NVDLC03AllEmptyBottlesLIST)
|
||||||
|
else
|
||||||
|
SetFunctionValue (ar_list WaterUnpurified, EBxUpgradableToDirtyList)
|
||||||
|
endif
|
||||||
|
|
||||||
|
elseif rWaterEffect == WaterHeal4Bad || rWaterEffect == WaterHeal5Terrible
|
||||||
|
SetFunctionValue (ar_list IrradiatedWaterUnpurified, NVDLC03AllEmptyBottlesLIST)
|
||||||
|
|
||||||
|
elseif rWaterEffect == WaterHeal1Rads500 ; Lethal Water
|
||||||
|
SetFunctionValue (ar_construct "array")
|
||||||
|
|
||||||
|
elseif eval EBxTTW && rWaterEffect == GetFormFromMod "BrokenSteel.esm" "B400" ; DLC03TidalBasinWaterEffect
|
||||||
|
let rMQA := GetFormFromMod "Fallout3.esm" "14E93" ; MQA
|
||||||
|
let rAquaPura := GetFormFromMod "BrokenSteel.esm" "104F" ; DLC03AquaPura
|
||||||
|
|
||||||
|
if IsFormValid rMQA && IsFormValid rAquaPura
|
||||||
|
if GetStageDone rMQA 100 == 1
|
||||||
|
; Project Purity water source has been infected, skip bottling
|
||||||
|
SetFunctionValue (ar_construct "array")
|
||||||
|
else
|
||||||
|
SetFunctionValue (ar_list rAquaPura, EBxUpgradableToPuraList)
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
SetFunctionValue (ar_construct "array")
|
||||||
|
endif
|
||||||
|
|
||||||
|
else
|
||||||
|
; fallback for custom water types
|
||||||
|
SetFunctionValue (ar_list WaterUnpurified, EBxUpgradableToDirtyList)
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
end
|
75
src/EBxMilkBrahmin.gek
Normal file
75
src/EBxMilkBrahmin.gek
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
scn EBxMilkBrahmin
|
||||||
|
|
||||||
|
ref rBrahmin
|
||||||
|
ref rActionRef
|
||||||
|
ref rOwner
|
||||||
|
int iChance
|
||||||
|
int iTimestamp
|
||||||
|
int iLastMilked
|
||||||
|
|
||||||
|
begin function { rBrahmin, rActionRef }
|
||||||
|
|
||||||
|
if playerRef.IsSneaking || rBrahmin.GetDead ; Keep tipping intact
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
if playerRef.GetItemCount EBxUpgradableToPuraList == 0
|
||||||
|
ShowMessage EBxMsgNoBottles
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
if playerRef.GetItemCount caps001 == 0
|
||||||
|
ShowMessage EBxMsgNoCaps
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
let iTimestamp := (GetUserTime)["Hour"]
|
||||||
|
if iTimestamp == 0
|
||||||
|
let iTimestamp := 24
|
||||||
|
endif
|
||||||
|
|
||||||
|
let iLastMilked := rBrahmin.GetAV Variable09
|
||||||
|
|
||||||
|
if iLastMilked != 0
|
||||||
|
if iLastMilked == iTimestamp
|
||||||
|
ShowMessage EBxMsgBrahminMilked
|
||||||
|
return
|
||||||
|
elseif iTimestamp < iLastMilked
|
||||||
|
rBrahmin.SetAV Variable09 0
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
let iChance := playerRef.GetAV luck * 10 - GetRandomPercent + 1
|
||||||
|
|
||||||
|
if iChance < 0
|
||||||
|
ShowMessage EBxMsgBrahminMilked
|
||||||
|
rBrahmin.SetAV Variable09 iTimestamp
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
rBrahmin.PlaySound NPCBrahminIdleMoo
|
||||||
|
|
||||||
|
call EBxReplaceFormListWithItem EBxBrahminMilk EBxUpgradableToPuraList
|
||||||
|
|
||||||
|
if EBxCanteenSipsMax > 0
|
||||||
|
call EBxReplenishCanteen EBxBrahminMilk 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
rBrahmin.SetAV Variable09 iTimestamp
|
||||||
|
|
||||||
|
; TODO: Show owned brahmin's prompt in red
|
||||||
|
;
|
||||||
|
; set rOwner to rBrahmin.GetOwner
|
||||||
|
; if IsFormValid rOwner == 0
|
||||||
|
; set rOwner to rBrahmin.GetParentCellOwner
|
||||||
|
; endif
|
||||||
|
|
||||||
|
; if IsFormValid rOwner
|
||||||
|
; if rOwner != PlayerFaction && rOwner != playerRef.GetBaseForm
|
||||||
|
; if eval GetType rOwner != 8 || PlayerRef.GetInFaction rOwner != 1 || rBrahmin.GetOwningFactionRequiredRank > PlayerRef.GetFactionRank rOwner
|
||||||
|
; playerRef.SendStealingAlarm rBrahmin
|
||||||
|
; endif
|
||||||
|
; endif
|
||||||
|
; endif
|
||||||
|
|
||||||
|
end
|
38
src/EBxOnControlUp.gek
Normal file
38
src/EBxOnControlUp.gek
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
scn EBxOnControlUp
|
||||||
|
|
||||||
|
int iControl
|
||||||
|
ref rSource
|
||||||
|
string_var sPrompt
|
||||||
|
|
||||||
|
begin function { iControl }
|
||||||
|
|
||||||
|
SetGameMainLoopCallback EBxOnCrosshairTracker 0
|
||||||
|
|
||||||
|
SetOnControlUpEventHandler EBxOnControlUp 0 5
|
||||||
|
EnableControl 5
|
||||||
|
|
||||||
|
let rSource := GetCrosshairRef
|
||||||
|
|
||||||
|
call EBxFillFromObject rSource
|
||||||
|
|
||||||
|
if GetCrosshairWater
|
||||||
|
let sPrompt := playerRef.AuxiliaryVariableGetString "*sDrinkPrompt"
|
||||||
|
elseif eval (sPrompt := rSource.GetActivatorPrompt) == ""
|
||||||
|
let sPrompt := playerRef.AuxiliaryVariableGetString "*sActivatePrompt"
|
||||||
|
endif
|
||||||
|
|
||||||
|
if GetUIFloat "HUDMainMenu\_DUIF3" > 0 ; DarnUI
|
||||||
|
SetUIStringAlt "HUDMainMenu/InfoWrap/Info/justify_center_hotrect/string" $sPrompt
|
||||||
|
else
|
||||||
|
SetUIStringAlt "HUDMainMenu/Info/justify_center_hotrect/string" $sPrompt
|
||||||
|
endif
|
||||||
|
|
||||||
|
sv_destruct sPrompt
|
||||||
|
|
||||||
|
if IsFormValid rSource
|
||||||
|
if rSource.HasScriptBlock 2
|
||||||
|
rSource.Activate playerRef 1
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
end
|
78
src/EBxOnCrosshair.gek
Normal file
78
src/EBxOnCrosshair.gek
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
scn EBxOnCrosshair
|
||||||
|
|
||||||
|
ref rSource
|
||||||
|
ref rDrink
|
||||||
|
int iCount
|
||||||
|
array_var aDrinksToUpgrade
|
||||||
|
|
||||||
|
begin function { rSource }
|
||||||
|
|
||||||
|
if rSource == 0 ; IsFormValid returns 0 on form 35
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
if GetType rSource != 21 ; activator
|
||||||
|
if GetCrosshairWater == 0
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
elseif rSource.GetActivatorWaterType == 0
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
let aDrinksToUpgrade := call EBxGetDrinksToUpgrade rSource
|
||||||
|
|
||||||
|
if eval 0 >= ar_size aDrinksToUpgrade
|
||||||
|
let aDrinksToUpgrade := ar_null
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
let rDrink := aDrinksToUpgrade[0]
|
||||||
|
let iCount := GetMinOf (playerRef.GetItemCount caps001) (playerRef.GetItemCount (aDrinksToUpgrade[1]))
|
||||||
|
let aDrinksToUpgrade := ar_null
|
||||||
|
|
||||||
|
if iCount > 0
|
||||||
|
|
||||||
|
if GetCrosshairWater
|
||||||
|
if iCount > 1
|
||||||
|
SetStringSetting "sTargetTypeDrink" ("Fill " + $iCount + " bottles with " + $rDrink)
|
||||||
|
else
|
||||||
|
SetStringSetting "sTargetTypeDrink" ("Fill " + $iCount + " bottle with " + $rDrink)
|
||||||
|
endif
|
||||||
|
elseif eval rSource.GetActivatorPrompt != ""
|
||||||
|
playerRef.AuxiliaryVariableSetString "*ap" (rSource.GetActivatorPrompt)
|
||||||
|
if iCount > 1
|
||||||
|
rSource.SetActivatorPrompt ("Fill " + $iCount + " bottles with " + $rDrink)
|
||||||
|
else
|
||||||
|
rSource.SetActivatorPrompt ("Fill " + $iCount + " bottle with " + $rDrink)
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
if iCount > 1
|
||||||
|
SetStringSetting "sTargetTypeActivate" ("Fill " + $iCount + " bottles with " + $rDrink)
|
||||||
|
else
|
||||||
|
SetStringSetting "sTargetTypeActivate" ("Fill " + $iCount + " bottle with " + $rDrink)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
elseif eval EBxCanteenSipsMax > 0 && call EBxReplenishCanteen rDrink 1
|
||||||
|
|
||||||
|
if GetCrosshairWater
|
||||||
|
SetStringSetting "sTargetTypeDrink" ("Fill canteen with " + $rDrink)
|
||||||
|
elseif eval rSource.GetActivatorPrompt != ""
|
||||||
|
playerRef.AuxiliaryVariableSetString "*ap" (rSource.GetActivatorPrompt)
|
||||||
|
rSource.SetActivatorPrompt ("Fill canteen with " + $rDrink)
|
||||||
|
else
|
||||||
|
SetStringSetting "sTargetTypeActivate" ("Fill canteen with " + $rDrink)
|
||||||
|
endif
|
||||||
|
|
||||||
|
else
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
DisableControl 5
|
||||||
|
SetOnControlUpEventHandler EBxOnControlUp 1 5
|
||||||
|
|
||||||
|
CallAfterSeconds 0 EBxOnCrosshairAfter
|
||||||
|
|
||||||
|
SetGameMainLoopCallback EBxOnCrosshairTracker 1 1 11
|
||||||
|
|
||||||
|
end
|
25
src/EBxOnCrosshairAfter.gek
Normal file
25
src/EBxOnCrosshairAfter.gek
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
scn EBxOnCrosshairAfter
|
||||||
|
|
||||||
|
ref rActivator
|
||||||
|
|
||||||
|
begin function {}
|
||||||
|
|
||||||
|
if GetCrosshairWater
|
||||||
|
|
||||||
|
SetStringSetting "sTargetTypeDrink" (playerRef.AuxiliaryVariableGetString "*sDrinkPrompt")
|
||||||
|
|
||||||
|
elseif playerRef.AuxiliaryVariableGetSize "*ap"
|
||||||
|
|
||||||
|
let rActivator := GetCrosshairRef
|
||||||
|
if IsFormValid rActivator
|
||||||
|
rActivator.SetActivatorPrompt (playerRef.AuxiliaryVariableGetString "*ap")
|
||||||
|
endif
|
||||||
|
playerRef.AuxiliaryVariableErase "*ap"
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
SetStringSetting "sTargetTypeActivate" (playerRef.AuxiliaryVariableGetString "*sActivatePrompt")
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
end
|
28
src/EBxOnCrosshairTracker.gek
Normal file
28
src/EBxOnCrosshairTracker.gek
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
scn EBxOnCrosshairTracker
|
||||||
|
|
||||||
|
ref rSource
|
||||||
|
|
||||||
|
begin function {}
|
||||||
|
|
||||||
|
if MenuMode == 0
|
||||||
|
|
||||||
|
if GetCrosshairWater
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
if eval rSource := GetCrosshairRef
|
||||||
|
if GetType rSource == 21 ; activator
|
||||||
|
if rSource.GetActivatorWaterType
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
SetGameMainLoopCallback EBxOnCrosshairTracker 0
|
||||||
|
|
||||||
|
SetOnControlUpEventHandler EBxOnControlUp 0 5
|
||||||
|
EnableControl 5
|
||||||
|
|
||||||
|
end
|
24
src/EBxOnDrink.gek
Normal file
24
src/EBxOnDrink.gek
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
scn EBxOnDrink
|
||||||
|
|
||||||
|
ref rDrink
|
||||||
|
ref rBottle
|
||||||
|
|
||||||
|
begin function { rDrink }
|
||||||
|
|
||||||
|
if this != playerRef
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
let rBottle := call EBxGetBottleByDrink rDrink
|
||||||
|
|
||||||
|
if IsFormValid rBottle == 0
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
AddItem rBottle 1 1
|
||||||
|
|
||||||
|
if MenuMode
|
||||||
|
RefreshItemsList
|
||||||
|
endif
|
||||||
|
|
||||||
|
end
|
122
src/EBxOnGameLoad.gek
Normal file
122
src/EBxOnGameLoad.gek
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
scn EBxOnGameLoad
|
||||||
|
|
||||||
|
int i
|
||||||
|
int n
|
||||||
|
int bImmersivePickupSounds
|
||||||
|
ref rItem
|
||||||
|
ref rEntry
|
||||||
|
ref rBottleUp
|
||||||
|
ref rBottleDown
|
||||||
|
int iCounter
|
||||||
|
|
||||||
|
begin function { i }
|
||||||
|
|
||||||
|
; Runs on entering GameMode
|
||||||
|
; Using a callback here sometimes throws the exception, probably destroyed prematurely:
|
||||||
|
; 14154707 h 0FD78A00 8B4E0485 nvse_1_4.dll (10068A00)
|
||||||
|
; 14154707 ^ 005E234B 00000081 FalloutNV.exe
|
||||||
|
CallAfterSeconds 0.1 EBxOnGameMode
|
||||||
|
|
||||||
|
if EBxCanteenSipsMax > 0
|
||||||
|
let rEntry := ListGetNthForm EBxCanteenEffects EBxCanteenDrink
|
||||||
|
if IsFormValid rEntry
|
||||||
|
LNSetName ($rEntry) EBxVault13CanteenEffect
|
||||||
|
else
|
||||||
|
let EBxCanteenDrink := ListGetFormIndex EBxCanteenEffects WaterPurified
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
if GetGameRestarted == 0
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
; The following code can run fine from EBxBootstrap,
|
||||||
|
; running it in PostLoadGame provides support for scripted injections
|
||||||
|
; from MenuMode 4 and JIP gr_* scripts.
|
||||||
|
|
||||||
|
let bImmersivePickupSounds := FileExists "sound\fx\pickup sounds\bottles" 1
|
||||||
|
|
||||||
|
if bImmersivePickupSounds
|
||||||
|
let rBottleUp := rBottleDown := EBxPickUpEmptyBottle
|
||||||
|
else
|
||||||
|
let rBottleUp := EBxSoundBottleUp
|
||||||
|
let rBottleDown := EBxSoundBottleDown
|
||||||
|
endif
|
||||||
|
|
||||||
|
let i := 0
|
||||||
|
while rItem := ListGetNthForm NVDLC03AllEmptyBottlesLIST i
|
||||||
|
SetWeight EBxBottleWeight rItem ; Set bottle weight
|
||||||
|
SetBaseItemValue rItem EBxBottlePrice ; Set bottle price
|
||||||
|
SetPickupSound rItem rBottleUp
|
||||||
|
SetPutdownSound rItem rBottleDown
|
||||||
|
ListAddForm EBxUpgradableToDirtyList rItem
|
||||||
|
ListAddForm EBxUpgradableToPuraList rItem
|
||||||
|
ListAddForm EBxUpgradableToPurifiedList rItem
|
||||||
|
let i += 1
|
||||||
|
loop
|
||||||
|
|
||||||
|
; Upgradeable drinks
|
||||||
|
|
||||||
|
ListAddForm EBxUpgradableToPuraList WaterUnpurified
|
||||||
|
ListAddForm EBxUpgradableToPurifiedList WaterUnpurified
|
||||||
|
|
||||||
|
; Broken Steel drinks
|
||||||
|
|
||||||
|
if EBxTTW
|
||||||
|
|
||||||
|
set rItem to GetFormFromMod "BrokenSteel.esm" "4C7A" ; DLC03WQ03WaterHoly
|
||||||
|
if IsFormValid rItem
|
||||||
|
ListAddForm EBxUpgradableToDirtyList rItem 1
|
||||||
|
ListAddForm EBxUpgradableToPuraList rItem 1
|
||||||
|
ListAddForm EBxUpgradableToPurifiedList rItem 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
set rItem to GetFormFromMod "BrokenSteel.esm" "6F62" ; DLC03WQ02AquaCura
|
||||||
|
if IsFormValid rItem
|
||||||
|
ListAddForm EBxUpgradableToDirtyList rItem
|
||||||
|
ListAddForm EBxUpgradableToPuraList rItem
|
||||||
|
ListAddForm EBxUpgradableToPurifiedList rItem
|
||||||
|
endif
|
||||||
|
|
||||||
|
set rItem to GetFormFromMod "BrokenSteel.esm" "104F" ; DLC03AquaPura
|
||||||
|
if IsFormValid rItem
|
||||||
|
ListAddForm EBxUpgradableToPurifiedList rItem
|
||||||
|
endif
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
if bImmersivePickupSounds
|
||||||
|
let rBottleUp := rBottleDown := EBxPickUpDrink
|
||||||
|
else
|
||||||
|
let rBottleUp := ITMBottleUp
|
||||||
|
let rBottleDown := ITMBottleDown
|
||||||
|
endif
|
||||||
|
|
||||||
|
let i := 0
|
||||||
|
while rItem := ListGetNthForm EBxDrinkLists i
|
||||||
|
SetOnUseAidItemEventHandler EBxOnDrink 1 rItem
|
||||||
|
|
||||||
|
if GetType rItem == 85 ; form list
|
||||||
|
let n := 0
|
||||||
|
while rEntry := ListGetNthForm rItem n
|
||||||
|
if GetPickupSound rEntry == 0
|
||||||
|
SetPickupSound rEntry rBottleUp
|
||||||
|
endif
|
||||||
|
if GetPutdownSound rEntry == 0
|
||||||
|
SetPutdownSound rEntry rBottleDown
|
||||||
|
endif
|
||||||
|
let n += 1
|
||||||
|
loop
|
||||||
|
elseif GetType rItem == 47
|
||||||
|
if GetPickupSound rItem == 0
|
||||||
|
SetPickupSound rItem rBottleUp
|
||||||
|
endif
|
||||||
|
if GetPutdownSound rItem == 0
|
||||||
|
SetPutdownSound rItem rBottleDown
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
let i += 1
|
||||||
|
loop
|
||||||
|
|
||||||
|
end
|
9
src/EBxOnGameMode.gek
Normal file
9
src/EBxOnGameMode.gek
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
scn EBxOnGameMode
|
||||||
|
|
||||||
|
begin function {}
|
||||||
|
|
||||||
|
SetJohnnyOnCrosshairEventHandler 1 EBxOnCrosshair 0 xMarker 21
|
||||||
|
SetJohnnyOnCrosshairEventHandler 1 EBxOnCrosshair 0 xMarker 35
|
||||||
|
SetJohnnyOnCrosshairEventHandler 1 EBxOnCrosshair 0 xMarker 78
|
||||||
|
|
||||||
|
end
|
32
src/EBxOnMiddleClick.gek
Normal file
32
src/EBxOnMiddleClick.gek
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
scn EBxOnMiddleClick
|
||||||
|
|
||||||
|
int iKeyID
|
||||||
|
ref rItem
|
||||||
|
ref rBottle
|
||||||
|
|
||||||
|
begin function { iKeyID }
|
||||||
|
|
||||||
|
if iKeyID != 258 ; not middle click
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
set rItem to GetSelectedItemRef
|
||||||
|
|
||||||
|
if IsFormValid rItem
|
||||||
|
if rItem.GetType == 47 ; ingestible
|
||||||
|
|
||||||
|
set rBottle to call EBxGetBottleByDrink rItem
|
||||||
|
|
||||||
|
if IsFormValid rBottle
|
||||||
|
set rItem to rItem.GetBaseObject
|
||||||
|
playerRef.RemoveItem rItem 1 1
|
||||||
|
playerRef.AddItem rBottle 1 1
|
||||||
|
PlaySound ITMBottleDown 1
|
||||||
|
MessageExAlt 1 ($rBottle + " " + $(GetStringSetting "sAddItemtoInventory")) ; ShowMessage causes CTD in MenuMode 1002
|
||||||
|
RefreshItemsList
|
||||||
|
endif
|
||||||
|
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
end
|
19
src/EBxPreordVault13CanteenScript.gek
Normal file
19
src/EBxPreordVault13CanteenScript.gek
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
scn EBxPreordVault13CanteenScript
|
||||||
|
|
||||||
|
begin GameMode
|
||||||
|
|
||||||
|
if GetContainer != playerRef
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
set EBxCanteenSipsMax to 4
|
||||||
|
|
||||||
|
if playerRef.GetItemCount EBxVault13Canteen < EBxCanteenSipsMax
|
||||||
|
playerRef.AddItem EBxVault13Canteen EBxCanteenSipsMax 1
|
||||||
|
RemoveMe
|
||||||
|
if MenuMode
|
||||||
|
RefreshItemsList
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
end
|
47
src/EBxReplaceFormListWithItem.gek
Normal file
47
src/EBxReplaceFormListWithItem.gek
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
scn EBxReplaceFormListWithItem
|
||||||
|
|
||||||
|
; Arguments
|
||||||
|
ref rReplacer
|
||||||
|
ref rReplaceFormList
|
||||||
|
|
||||||
|
; Temp vars
|
||||||
|
ref rItem
|
||||||
|
int iCount
|
||||||
|
int iOutputAmount
|
||||||
|
int iRemainingItems
|
||||||
|
int i
|
||||||
|
|
||||||
|
begin Function { rReplacer, rReplaceFormList }
|
||||||
|
|
||||||
|
let iOutputAmount := GetMinOf (playerRef.GetItemCount Caps001) (playerRef.GetItemCount rReplaceFormList)
|
||||||
|
|
||||||
|
if iOutputAmount == 0
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
if rReplacer == EBxBrahminMilk
|
||||||
|
let iOutputAmount := 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
let iRemainingItems := iOutputAmount
|
||||||
|
|
||||||
|
while rItem := ListGetNthForm rReplaceFormList i
|
||||||
|
|
||||||
|
let iCount := playerRef.GetItemCount rItem
|
||||||
|
let iCount := GetMinOf iCount iRemainingItems
|
||||||
|
|
||||||
|
playerRef.RemoveItem rItem iCount 1
|
||||||
|
playerRef.RemoveItem Caps001 iCount 1
|
||||||
|
|
||||||
|
let iRemainingItems -= iCount
|
||||||
|
|
||||||
|
if iRemainingItems <= 0
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
|
||||||
|
let i += 1
|
||||||
|
loop
|
||||||
|
|
||||||
|
playerRef.AddItem rReplacer iOutputAmount
|
||||||
|
|
||||||
|
end
|
55
src/EBxReplenishCanteen.gek
Normal file
55
src/EBxReplenishCanteen.gek
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
scn EBxReplenishCanteen
|
||||||
|
|
||||||
|
ref rNewDrink
|
||||||
|
ref rCurrentDrink
|
||||||
|
ref rCanteen
|
||||||
|
int iCount
|
||||||
|
int iNewDrink
|
||||||
|
int bCheckOnly
|
||||||
|
|
||||||
|
begin function { rNewDrink, bCheckOnly }
|
||||||
|
|
||||||
|
let iNewDrink := ListGetFormIndex EBxCanteenEffects rNewDrink
|
||||||
|
|
||||||
|
if iNewDrink == -1 ; unknown type, fallback to Purified Water
|
||||||
|
set rNewDrink to WaterPurified
|
||||||
|
set iNewDrink to ListGetFormIndex EBxCanteenEffects rNewDrink
|
||||||
|
endif
|
||||||
|
|
||||||
|
let rCurrentDrink := ListGetNthForm EBxCanteenEffects EBxCanteenDrink
|
||||||
|
|
||||||
|
if IsFormValid rCurrentDrink == 0 ; invalid EBxCanteenDrink value, also fallback to Purified Water
|
||||||
|
set rCurrentDrink to WaterPurified
|
||||||
|
set EBxCanteenDrink to ListGetFormIndex EBxCanteenEffects rCurrentDrink
|
||||||
|
endif
|
||||||
|
|
||||||
|
if rNewDrink == rCurrentDrink
|
||||||
|
elseif rCurrentDrink == IrradiatedWaterUnpurified ; any replacement will do
|
||||||
|
elseif (rCurrentDrink != WaterPurified && rCurrentDrink != EBxBrahminMilk) && (rNewDrink == WaterPurified || rNewDrink == EBxBrahminMilk)
|
||||||
|
elseif playerRef.GetItemCount EBxVault13Canteen > 0
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
let iCount := EBxCanteenSipsMax - playerRef.GetItemCount EBxVault13Canteen
|
||||||
|
|
||||||
|
if bCheckOnly
|
||||||
|
SetFunctionValue (EBxCanteenDrink != iNewDrink || iCount > 0)
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
if iCount > 0
|
||||||
|
playerRef.AddItem EBxVault13Canteen iCount 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
set rCanteen to EBxVault13CanteenEffect
|
||||||
|
SetNameEx "%n" rNewDrink rCanteen
|
||||||
|
|
||||||
|
if EBxCanteenDrink != iNewDrink || iCount > 0
|
||||||
|
PlaySound ITMBottleDown 1
|
||||||
|
set rCanteen to EBxVault13Canteen
|
||||||
|
MessageEx "%n has been replenished with %n." rCanteen rNewDrink
|
||||||
|
endif
|
||||||
|
|
||||||
|
set EBxCanteenDrink to iNewDrink
|
||||||
|
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user