Last active
February 5, 2025 20:36
-
-
Save ArthurHub/8301c1c9bfa8afc5b12c90311cb6f232 to your computer and use it in GitHub Desktop.
FO4VREdit script to lower ammo, food, drink, and scrap weight by custom value
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
Script to update ammo, food, drink, and scrap items weight values | |
} | |
unit userscript; | |
// called for every record selected in xEdit | |
function Process(e: IInterface): integer; | |
var | |
elm: IInterface; | |
w, nw: float; | |
sName: string; | |
begin | |
sName := GetEditValue(ElementByPath(e, 'FULL')); | |
// Lower Ammo wieght to 50% (remove/change value to your liking) | |
if ((pos('[Ammo', sName) = 1) or (pos('[Fusion', sName) = 1)) then begin | |
elm := ElementByPath(e, 'DATA\Weight'); | |
w := GetEditValue(elm); | |
if not Assigned(w) then begin | |
Exit; | |
end; | |
// change here | |
nw := w * 0.5; | |
AddMessage('Updating Ammo "' + sName + '" weight from "' + w + '" to "' + FloatToStr(nw) + '"'); | |
SetElementEditValues(e, 'DATA\Weight', nw); | |
end; | |
// Lower Scrap weight to 20% (remove/change value to your liking) | |
if (pos('[Scrap', sName) = 1) then begin | |
elm := ElementByPath(e, 'DATA\Weight'); | |
w := GetEditValue(elm); | |
if not Assigned(w) then begin | |
Exit; | |
end; | |
// change here | |
nw := w * 0.2; | |
AddMessage('Updating Scrap "' + sName + '" weight from "' + w + '" to "' + FloatToStr(nw) + '"'); | |
SetElementEditValues(e, 'DATA\Weight', nw); | |
end; | |
// Lower Food weight to 50% (remove/change value to your liking) | |
if ((pos('[Food', sName) = 1) or (pos('[RadFood', sName) = 1) or (pos('[Drink', sName) = 1)) then begin | |
elm := ElementByPath(e, 'DATA - Weight'); | |
w := GetEditValue(elm); | |
if not Assigned(w) then begin | |
Exit; | |
end; | |
// change here | |
nw := w * 0.5; | |
AddMessage('Updating Food "' + sName + '" weight from "' + w + '" to "' + FloatToStr(nw) + '"'); | |
SetElementEditValues(e, 'DATA - Weight', nw); | |
end; | |
end; | |
end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment