sellPriceCoefficient:
I was trying to use the current implentation of sellPriceCoefficient and I was running into the exact same problem as stated here:
I can adjust the Sellprices but this largely effects the manufacturing money making machine I balanced the economy in Hardmode Expansion around.
May I suggest to add a nested list, of Items to which the sellPriceCoefficient should be applied to?Code: [Select]sellPriceCoefficient: [100, 85, 70, 60, 50]
sellPriceCoefficientAffectedItems:
- STR_PLASMA_PISTOL
- STR_PLASMA_RIFLE
- STR_HEAVY_PLASMA
- STR_MIND_PROBE
All other Items would still have their fixed price, and if the list is empty (as by default), then the sellPriceCoefficient would be applied to all available items.
This would this awesome feature for me exactly the thing I need to balance the economy in Hardmode Expansion for lower diffciulty levels (my goal is to enable players to also enjoy lower diffciculties, in case they wanna do so.)
I basically only want to have the sellPriceCoefficient effect collectable loot from aliens.
Hope this is going to be heared, you guys are awesome :)
hellrazor, I completely agree, but it would be better if such a modifier for the sale and purchase price, depending on the difficulty level, was a property of the item itself. That is, there is a global modifier “sellPriceCoefficient”, and there is an individual modifier in the item itself. Plus "buyPriceCoefficient".
As long as I can set it up so only a selections of Items gets the "sellPriceCoefficient", I would not mind this solution either.
We have agreed with Yankes to skip this solution... and introduce Y-scripting for sell-prices (and later for buy-prices) directly instead.
Once implemented, I will paste a sample Y-script for hellrazor here.
extended:
scripts:
sellCostItem:
- offset: 12
code: |
var ptr Time t;
geoscape_game.getTime t;
t.getDaysPastEpoch cost_current;
mod cost_current 100;
add cost_current 100;
return cost_current;
This is very dumb version that set all items cost to values from 100 to 200 based on current day.
This should be available in OXCE 7.12.6Code: [Select]extended:
This is very dumb version that set all items cost to values from 100 to 200 based on current day.
scripts:
sellCostItem:
- offset: 12
code: |
var ptr Time t;
geoscape_game.getTime t;
t.getDaysPastEpoch cost_current;
mod cost_current 100;
add cost_current 100;
return cost_current;
Basic info about script is available here: https://www.ufopaedia.org/index.php?title=Script_(OpenXcom)
For functionality, yes, you can return arbitrary price, this mean disable default scaling, add custom scalling is possible too.
Scripts hooks itself expose:
`cost_current` -> current cost, after difficulty coefficient and possible change by other scripts hooks
`cost_base` -> original cost from item ruleset
`difficualty_coefficient` -> difficulty multiplier,
to have always control over default behavior.
[ps]
I see I make typo in `difficualty_coefficient`, I probaby soon push new version that will fix it as there is not lot of mods that depend on this.
is not really understandable for me.
User Perspective vs Programmer perspective I guess.
There is no way back.
We have agreed with Yankes to skip this solution... and introduce Y-scripting for sell-prices (and later for buy-prices) directly instead.
Once implemented, I will paste a sample Y-script for hellrazor here.
I agree, no. But there is a path in any other direction, and we happily march in all directions at the same time.
Sample Y-script below and attached:extended:
tags:
RuleItem:
HELLRAZOR_SUPERHUMAN_SELL_PRICE: int
scripts:
sellCostItem:
- offset: 12
code: |
var int temp;
geoscape_game.difficultyLevel temp; # get difficulty
if eq temp DIFF_SUPERHUMAN;
item_rule.getTag temp Tag.HELLRAZOR_SUPERHUMAN_SELL_PRICE; # custom item sell price
if neq temp 0;
set cost_current temp;
end;
end;
return cost_current;
items:
- type: STR_RIFLE
tags:
HELLRAZOR_SUPERHUMAN_SELL_PRICE: 999
- type: STR_RIFLE_CLIP
tags:
HELLRAZOR_SUPERHUMAN_SELL_PRICE: 88
void init (int elem[], int nelems)
{
int i;
for (i=0; i < nelems; i++)
elem[i] = i;
}