Here's a fixed version of the Level 2 file that works with patch 1.5 and redscript 0.5+. Melonface, please feel free to upload to your files if you like. Thanks for the original idea and mod.
Just downloaded it and I gota say, this is just one of those mods you wonder "WHY IS THIS NOT IN THE BASE GAME?!?" Especially when if you get a legendary early and want to keep using it, you have to give an arm and a leg late game to keep upgrading it.
An idea for an offshoot mod or something though. Remove the level requirements for upgrading (allowing you to max out an items upgrades at any point) but make it so that the higher away the upgrade from your actual level, the more expensive it is. Just an idea to help you get a slight edge on higher difficulties if you have the resources to burn.
Great idea! I actually modified your changes a little so it basically caps the value of upgradeNumber to a hard upper limit, rather than using a static value. That way you see an initial increase in cost before it levels out completely.
Any chance you could explain / share how you did that tesnitrojack? I have been looking for something like that for quite some time and I don't know how to code for shite. Definitely would rather have an upper limit as the static value feels a little too cheaty on 2. And on the other end of the spectrum a static 4/8 is a little too hardcore. I'd like an upper limit of say 4 so that I at least have to craft 1,2, and 3 before it caps out. Any help would be appreciated thanks! And thanks for the great mod. The concept is solid.
First you need to add these lines of code underneath the existing line as shown here (I'm using a max of 8 upgrades but you can use whatever positive value).
Yeah my original change won't work with new versions of CES. It's a simple fix though. You just need to make the type float explicit. Modify your code to use this and it should compile fine. (Basically just add the decimal to ensure type float).
44 comments
https://drive.google.com/file/d/1CjIkcGM2xub5V6IGq7GUXzcYVI_nS-aM/view?usp=sharing
I took your edits and made the LVL4 and LVL8 files as well. They're all uploaded now and I've credited you for the update. :)
Did NOT have to change anything
An idea for an offshoot mod or something though. Remove the level requirements for upgrading (allowing you to max out an items upgrades at any point) but make it so that the higher away the upgrade from your actual level, the more expensive it is. Just an idea to help you get a slight edge on higher difficulties if you have the resources to burn.
nevermidn i figured it out
I actually modified your changes a little so it basically caps the value of upgradeNumber to a hard upper limit, rather than using a static value. That way you see an initial increase in cost before it levels out completely.
First you need to add these lines of code underneath the existing line as shown here (I'm using a max of 8 upgrades but you can use whatever positive value).
upgradeNumber += 1.00;
if (upgradeNumber > 8) {
upgradeNumber = 8;
};
Then just revert the change made by this mod (the part with all the comments and such) so that upgradeNumber is used again.
I get a Red Script Compilation error, reverted the changes from this mod and added your lines but to lvl 4...
@replaceMethod(CraftingSystem)
public final const func GetItemFinalUpgradeCost(itemData: wref<gameItemData>) -> array<IngredientData> {
let i: Int32;
let ingredients: array<IngredientData>;
let tempStat: Float;
let statsSystem: ref<StatsSystem> = GameInstance.GetStatsSystem(this.GetGameInstance());
let upgradeNumber: Float = itemData.GetStatValueByType(gamedataStatType.WasItemUpgraded);
upgradeNumber += 1.00;
if (upgradeNumber > 4) {
upgradeNumber = 4;
};
ingredients = this.GetItemBaseUpgradeCost(itemData.GetItemType(), RPGManager.GetItemQuality(itemData));
i = 0;
while i < ArraySize(ingredients) {
ingredients[i].quantity = ingredients[i].quantity * Cast<Int32>(upgradeNumber);
ingredients[i].baseQuantity = ingredients[i].quantity;
i += 1;
};
tempStat = statsSystem.GetStatValue(Cast<StatsObjectID>(this.m_playerCraftBook.GetOwner().GetEntityID()), gamedataStatType.UpgradingCostReduction);
if tempStat > 0.00 {
i = 0;
while i < ArraySize(ingredients) {
ingredients[i].quantity = Cast<Int32>(Cast<Float>(ingredients[i].quantity) * (1.00 - tempStat));
i += 1;
};
};
return ingredients;
}
Yeah my original change won't work with new versions of CES. It's a simple fix though. You just need to make the type float explicit. Modify your code to use this and it should compile fine. (Basically just add the decimal to ensure type float).
if upgradeNumber > 4.0 {
upgradeNumber = 4.0;
}
Thanks for fixing this. :)