aliens

Author Topic: [Suggestion] Sell/Buy price coefficients for items  (Read 1159 times)

Offline Ethereal

  • Commander
  • *****
  • Posts: 634
    • View Profile
[Suggestion] Sell/Buy price coefficients for items
« on: March 15, 2024, 06:32:15 am »
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.

Suggest entering "sellPriceCoefficient" and "buyPriceCoefficient" for items and ships.  :)
« Last Edit: March 20, 2024, 12:37:40 am by Ethereal »

Offline hellrazor

  • Commander
  • *****
  • Posts: 2014
  • Deep Ruleset Digger & Bughunter
    • View Profile
    • Github Account
Re: [Suggestion] Sell\Buy price coefficients for itmes.
« Reply #1 on: March 20, 2024, 03:15:32 pm »
Thanks mate for moving this over to here :)

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8671
    • View Profile
Re: [Suggestion] Sell/Buy price coefficients for items
« Reply #2 on: April 03, 2024, 08:53:22 am »
Removed offtopic posts.

Todolisted.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8671
    • View Profile
Re: [Suggestion] Sell/Buy price coefficients for items
« Reply #3 on: April 28, 2024, 05:27:28 pm »
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.

Offline hellrazor

  • Commander
  • *****
  • Posts: 2014
  • Deep Ruleset Digger & Bughunter
    • View Profile
    • Github Account
Re: [Suggestion] Sell/Buy price coefficients for items
« Reply #4 on: May 14, 2024, 03:13:38 pm »
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.

Looking forward towards this ;) Thank you both for all the hard work.

Offline Yankes

  • Commander
  • *****
  • Posts: 3220
    • View Profile
Re: [Suggestion] Sell/Buy price coefficients for items
« Reply #5 on: May 14, 2024, 03:57:29 pm »
This should be available in OXCE 7.12.6

Code: [Select]
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.

Offline hellrazor

  • Commander
  • *****
  • Posts: 2014
  • Deep Ruleset Digger & Bughunter
    • View Profile
    • Github Account
Re: [Suggestion] Sell/Buy price coefficients for items
« Reply #6 on: Today at 08:45:09 am »
This should be available in OXCE 7.12.6

Code: [Select]
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.

Thanks. Is it possible to define the price reduction effect, for only a specific list of items (defined via strings in the script), and sell price reduction is then handled depending on difficultylevel, via a defined percentage?

Is there any description or help in regard of scripting parameters and valid syntax??

Offline Yankes

  • Commander
  • *****
  • Posts: 3220
    • View Profile
Re: [Suggestion] Sell/Buy price coefficients for items
« Reply #7 on: Today at 11:17:55 am »
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.

Offline hellrazor

  • Commander
  • *****
  • Posts: 2014
  • Deep Ruleset Digger & Bughunter
    • View Profile
    • Github Account
Re: [Suggestion] Sell/Buy price coefficients for items
« Reply #8 on: Today at 11:47:10 am »
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.

Thanks but: https://www.ufopaedia.org/index.php?title=Script_(OpenXcom) is not really understandable for me.
User Perspective vs Programmer perspective I guess.