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

Offline hellrazor

  • Commander
  • *****
  • Posts: 2025
  • Deep Ruleset Digger & Bughunter
    • View Profile
    • Github Account
Re: [Suggestion] Sell/Buy price coefficients for items
« Reply #15 on: May 18, 2024, 01:04:36 pm »
Sample Y-script below and attached:

Spoiler:
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

Thanks for the example. I think i can work with the example you provided and play around with it until I get my desired result.

The Polish Notation is kinda hard to read btw, if you are not used to it.

I am more used to stuff like this

Code: [Select]
void init (int elem[], int nelems)
{
int i;

for (i=0; i < nelems; i++)
elem[i] = i;
}