aliens

Author Topic: [SOLVED] XPZ sub-mod, !add to commendations' killCriteria?  (Read 3576 times)

Offline Nilex

  • Colonel
  • ****
  • Posts: 316
    • View Profile
[SOLVED] XPZ sub-mod, !add to commendations' killCriteria?
« on: June 15, 2021, 12:07:13 am »
Was hoping to simply add a line similar to box bellow but it doesn't work. Same without !add. Seems commendations are sensitive in general so OXCE freezes if it does not like what it sees, in instances XPZ calculates them (end of battle/month).
Code: [Select]
commendations:
  - type: STR_MEDAL_whatever
    killCriteria: !add
      -
         - [1, ["STR_abovetopsecret", "FACTION_HOSTILE", "STATUS_DEAD"]]

So far I've learned "!add" tag only works in select few places with more being added on case-by-case basis (to prevent breaking sensitive orderly lists), or due to popular demand. Now I'm a nobody in the local modding scene but assuming !add is indeed not supported here (and my formatting checks out) would it be too much to ask that it gets added? Just killCriteria specifically.

My reasoning is copy-pasting whole sections from master (with my stuff added in) would work but greatly inflate the rule file, and more importantly become obsolete the instant Dio shuffles stuff around (pretty common), or at best become a nightmare to maintain. Btw, the stuff I intend to add spans across many different killCriteria otherwise I wouldn't bother asking.

UPDATE
Well it suddenly works and exactly as I wanted too, with the !add tag exclusively. What went wrong before? Hell if I know, must have been a minor case of miss-formatting or something. I simply copy-pasted the same thing from master again and truncated the unwanted stuff like before... and voila. Don't you just love that shit? Anyway, please ignore the request.
« Last Edit: June 22, 2021, 04:53:55 am by Nilex »

Offline Nilex

  • Colonel
  • ****
  • Posts: 316
    • View Profile
Re: [RE-OPENED] XPZ sub-mod, !add to commendations' killCriteria?
« Reply #1 on: June 15, 2021, 09:22:57 pm »
UPDATE 2
Discovered what was wrong but it feels unintended so I'm reopening the case. Btw all this is happening in sub-modded "Piratez_Globals.rul".

Desired but freezes OXCE:
Code: [Select]
commendations:
  - type: STR_MEDAL_whatever
    killCriteria: !add
      -
         - [1, ["STR_abovetopsecret", "FACTION_HOSTILE", "STATUS_DEAD"]]

Undesired but works:
Code: [Select]
commendations:
  - type: STR_MEDAL_whatever
    criteria:
      killsWithCriteriaCareer: [numbers copy-pasted from master]
    killCriteria: !add
      -
         - [1, ["STR_abovetopsecret", "FACTION_HOSTILE", "STATUS_DEAD"]]

The devil is that "criteria" and its sub-line must be included for added killCriteria of individual commendation type to work (and not crash OXCE). It makes no sense to force it since it defeats the purpose of !add tag bellow, by making "criteria" set in stone while allowing "killCriteria" to auto-adjust to future master updates. If I change just criteria numbers than it unacceptably affects whole killCriteria in master as well. Can't leave criteria empty, append !add tag, or delete it altogether. Crashes all the same. Is this an oversight or I'm just terrible with tags?
« Last Edit: June 15, 2021, 09:25:08 pm by Nilex »

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: [RE-OPENED] XPZ sub-mod, !add to commendations' killCriteria?
« Reply #2 on: June 17, 2021, 12:13:58 pm »
There could be special code that handle loading, I will look today to see what cause this crash

Offline Nilex

  • Colonel
  • ****
  • Posts: 316
    • View Profile
Re: [RE-OPENED] XPZ sub-mod, !add to commendations' killCriteria?
« Reply #3 on: June 17, 2021, 04:09:30 pm »
Thanks for taking a look, I'll send a PM with save, instructions and my sub-mod setup for a quick test.

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: [RE-OPENED] XPZ sub-mod, !add to commendations' killCriteria?
« Reply #4 on: June 17, 2021, 07:56:57 pm »
I know what happens, in current version you could not even hope to add any thing to `commendations` it always overwrite EVERY thing and leak memory on top of that.
I will try fix this, and add support for `!add` tag.

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: [RE-OPENED] XPZ sub-mod, !add to commendations' killCriteria?
« Reply #5 on: June 20, 2021, 02:40:04 am »
I push fix in version 7.0.12, not tested because I do not lot of time I could commit to this,
I would welcome testing to see if I do not break somting with my change.

Offline Nilex

  • Colonel
  • ****
  • Posts: 316
    • View Profile
Re: [RE-OPENED] XPZ sub-mod, !add to commendations' killCriteria?
« Reply #6 on: June 20, 2021, 03:33:13 am »
I would test but not sure how to merge 7.0.12 with current XPZ since they come together. Just plop new OXCE exe in there and hope for the best? Does XPZ come with 32 or 64-bit OXCE version?
Memory leak is beyond what I can test (XPZ runs as usual even on my potato with changes above), but freeze fix and new tag workings would be simple enough.

Just letting you know in case it's expected that I perform the test.

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: [RE-OPENED] XPZ sub-mod, !add to commendations' killCriteria?
« Reply #7 on: June 20, 2021, 01:57:36 pm »
new OXCE can run XPZ, you need reduce level of checks in config:
Code: [Select]
  oxceModValidationLevel: 1

Offline Nilex

  • Colonel
  • ****
  • Posts: 316
    • View Profile
Re: [RE-OPENED] XPZ sub-mod, !add to commendations' killCriteria?
« Reply #8 on: June 20, 2021, 05:53:12 pm »
XPZ refuses to load (oxceModValidationLevel: 1) with this error:
Quote
Error for 'STR_BOUNTY_HUNTING_CHALLENGE_MA': wrong node type, expected a map at line 112613

Tried deleting what felt like 4 unneeded lines around that spot but same error occurs. Level: 0 also spits out same error. That's as far as I got I'm afraid.

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: [RE-OPENED] XPZ sub-mod, !add to commendations' killCriteria?
« Reply #9 on: June 21, 2021, 11:26:54 pm »
I tried load XPZ previous version and it work fine with that config switch, is this error from your mod or XPZ?

Offline Nilex

  • Colonel
  • ****
  • Posts: 316
    • View Profile
Re: [RE-OPENED] XPZ sub-mod, !add to commendations' killCriteria?
« Reply #10 on: June 22, 2021, 04:52:50 am »
Error is in XPZ vL9 "Piratez.rul".

Gave XPZ vL8 a shot using OXCE 7.0.12 executable and it finally worked as desired in my 2nd post. No more freezes.
I'll assume commendations will sort themselves out in new XPZ version and mark this as solved. Thank you for help!

I would however suggest to please test the changes yourself, when you find the time. When I tested to understand what did you mean by "`commendations` it always overwrite EVERY thing" I ended up in a very deep dark rabbit hole. Conclusion is 7.0.12 calculates sub-modded commendations more accurately but I dare not be more specific than that. Finding a definitive answer proved far too complicated for me...

Offline Nilex

  • Colonel
  • ****
  • Posts: 316
    • View Profile
Re: [SOLVED] XPZ sub-mod, !add to commendations' killCriteria?
« Reply #11 on: June 22, 2021, 06:12:02 am »
Got something more conclusive. Setup: XPZ vL8 + OXCE 7.0.12 + my own 2 sub-mods from before.

Landed on mission and immediately aborted so all commendations update. Reloaded and completed that same mission so I can examine the differences.
Used only XG Rifle because it doesn't fall into my sub-mod, but shares commendation category. Wanted to see how non-included guns affect rewarding.

Now the interesting part. Loading quicksave and ending turn usually completes the mission, but reward "Grunt" is not the same in two cases bellow (Piratez_Globals.rul) although it should be:

Code: [Select]
commendations:
  - type: STR_MEDAL_RIFLEKILL_NAME
    criteria:
      killsWithCriteriaCareer: [15, 16, 17, 18, 19, 20, 21, 22, 23, 24]
    killCriteria: !add
      -
         - [1, ["STR_sub_modded_gun1", "FACTION_HOSTILE", "STATUS_DEAD"]]
      -
         - [1, ["STR_sub_modded_gun2", "FACTION_HOSTILE", "STATUS_DEAD"]]
Gives "Grunt" for using XG Rifle.

Code: [Select]
commendations:
  - type: STR_MEDAL_RIFLEKILL_NAME
    criteria:
      killsWithCriteriaCareer: [15, 16, 17, 18, 19, 20, 21, 22, 23, 24]
    killCriteria: !add
      -
         - [1, ["STR_sub_modded_gun1", "FACTION_HOSTILE", "STATUS_DEAD"]]
      -
         - [1, ["STR_sub_modded_gun2", "FACTION_HOSTILE", "STATUS_DEAD"]]
      -
         - [1, ["STR_XG_RIFLE", "FACTION_HOSTILE", "STATUS_DEAD"]]
Gives higher "Grunt" ranks for some reason.

This is confusing the hell outta me and makes me nervous that commendations got broken in 7.0.12. Maybe this is helpful, maybe the opposite...
Kill numbers are in 15-24 so the "Grunt" rewards properly trigger on semi-experienced soldiers, for testing purposes.

2 sub-mods and 2 saves sent via PM (quicksave & pre-landing) for troubleshooting. Good luck.

UPDATE
After this somewhat dramatic post it has been determined the behavior is intended and normal actually. Double the entry - double the rewards. Who knew. Since XG Rifle was only used to test against same commendation category and won't be included in the final sub-mod this topic can finally rest for eternity.
« Last Edit: June 26, 2021, 09:43:19 pm by Nilex »