Author Topic: [DONE] [Suggestion] Ability to mod stat improvement algorithm  (Read 10940 times)

Offline Joe

  • Sergeant
  • **
  • Posts: 11
    • View Profile
[DONE] [Suggestion] Ability to mod stat improvement algorithm
« on: October 04, 2018, 08:26:20 am »
I really like open xcom, lots of fun.

So I just want to make some small changes instead of big mods. Currently playing the x files mod.

I wanted to change

1- how much experience you gain, but didn't find any rules anywhere in the rules files about it, and I looked hard.
2-  and the maximum stats of soldiers : I did find the rules file and changed them. The problem is I think the formula for experience gained is based on the maximum stats caps, so if I change the stats caps it messes up the experience formula, so I need to be able to change both.

Does anyone know?

Thanks
« Last Edit: October 07, 2018, 10:00:02 pm by Meridian »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9094
    • View Profile
Re: Modding experience gained and stat caps
« Reply #1 on: October 04, 2018, 09:36:04 am »
1/ there are no such rules in the ruleset

2/ improvement of bravery, reactions, firing, throwing, melee, psi skill and psi strength don't depend on max stats... only on experience gained during the mission;
TU, stamina, HP and strength depend on the difference between max stats and current stats

Offline Joe

  • Sergeant
  • **
  • Posts: 11
    • View Profile
Re: Modding experience gained and stat caps
« Reply #2 on: October 04, 2018, 10:00:04 am »
Thanks for the answer.

1- So there's no way I can create my own rule for experience?

2- And is there a way I can change the way that works too?

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9094
    • View Profile
Re: Modding experience gained and stat caps
« Reply #3 on: October 04, 2018, 10:11:19 am »
1/ correct
2/ no

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11728
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: Modding experience gained and stat caps
« Reply #4 on: October 04, 2018, 12:13:26 pm »
Just curious, what would you do with the experience formula if you could?

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1512
    • View Profile
Re: Modding experience gained and stat caps
« Reply #5 on: October 04, 2018, 09:12:16 pm »
This is what you can do to change experience gain rates: New experience award system / accuracy training system

You can reduce experience gain rates by selecting a lower value, for example experienceTrainingMode: 6 trains firing accuracy only 1/3 of the time. You can't increase an individual attribute's training rate above 1, but you can train faster by applying multiple attributes. For example, experienceTrainingMode: 14 trains both firing accuracy and reactions.

As you probably figured out by reading Meridian's thread, this only affects experience gained by hitting hostile targets with weapons. If you want extra training in addition to this, you can implement a training facility into your mod, which can have any training rate you like.

Another way to alter the rate of training is to change all of the attributes. You can cut all training in half by doubling every attribute except psi strength. You can double the rate of training by halving all attributes except psi strength. You can change psi strength as well, but you'll need to understand that doubling psi strength and doubling psi skill quadruples psi offense power while increasing psi defense to slightly more than double.
Let me know if you want an in-depth tutorial for how to do this.
« Last Edit: October 04, 2018, 09:14:12 pm by The Reaver of Darkness »

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: Modding experience gained and stat caps
« Reply #6 on: October 05, 2018, 12:11:15 am »
1/ there are no such rules in the ruleset

2/ improvement of bravery, reactions, firing, throwing, melee, psi skill and psi strength don't depend on max stats... only on experience gained during the mission;
TU, stamina, HP and strength depend on the difference between max stats and current stats

3/ For sadist: there is script that can read max stats and adjust stat grain per attack.

Offline Joe

  • Sergeant
  • **
  • Posts: 11
    • View Profile
Re: Modding experience gained and stat caps
« Reply #7 on: October 05, 2018, 12:28:56 am »
This is what you can do to change experience gain rates: New experience award system / accuracy training system

You can reduce experience gain rates by selecting a lower value, for example experienceTrainingMode: 6 trains firing accuracy only 1/3 of the time. You can't increase an individual attribute's training rate above 1, but you can train faster by applying multiple attributes. For example, experienceTrainingMode: 14 trains both firing accuracy and reactions.

As you probably figured out by reading Meridian's thread, this only affects experience gained by hitting hostile targets with weapons. If you want extra training in addition to this, you can implement a training facility into your mod, which can have any training rate you like.

Another way to alter the rate of training is to change all of the attributes. You can cut all training in half by doubling every attribute except psi strength. You can double the rate of training by halving all attributes except psi strength. You can change psi strength as well, but you'll need to understand that doubling psi strength and doubling psi skill quadruples psi offense power while increasing psi defense to slightly more than double.
Let me know if you want an in-depth tutorial for how to do this.

Thanks for the answer. I read the thread and If I understand correctly, I have to put the line experienceTrainingMode : xx  on every weapon in the game? Or on every soldier? I know how to edit the text files but I'm a beginner, I found the ruleset for soldiers and units.

Offline Joe

  • Sergeant
  • **
  • Posts: 11
    • View Profile
Re: Modding experience gained and stat caps
« Reply #8 on: October 05, 2018, 12:32:33 am »
Just curious, what would you do with the experience formula if you could?

I want to put the stats cap higher and lower the experience gain rate, and maybe not use training facilities altogether. Just for fun, cause I remember playing xcom apocalypse and having all my soldiers maxed out very early, then I felt it got less fun.

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: Modding experience gained and stat caps
« Reply #9 on: October 05, 2018, 01:33:41 am »
Basic exp grain have minimum 33% chance, but script can reduce it to 1%

Offline Joe

  • Sergeant
  • **
  • Posts: 11
    • View Profile
Re: Modding experience gained and stat caps
« Reply #10 on: October 05, 2018, 01:38:38 am »
Basic exp grain have minimum 33% chance, but script can reduce it to 1%

Which script? I'm interested.

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1512
    • View Profile
Re: Modding experience gained and stat caps
« Reply #11 on: October 05, 2018, 02:45:40 am »
For simple modding, you have to add the line to each weapon.

In my mod, pistols use mode 14 (reactions and firing) since there's not a lot of other ways to train reactions anyway, and pistols need a buff:
Code: [Select]
  - type: STR_PISTOL
    accuracySnap: 60
    accuracyAimed: 88
    tuSnap: 18
    tuAimed: 30
    experienceTrainingMode: 14
Fully automatic weapons are using training mode 5 (firing 50%), since they're hitting more often, so they will train firing accuracy at a rate comparable to slower-firing weapons:
Code: [Select]
  - type: STR_MACHINEGUN
    accuracyAuto: 44
    accuracySnap: 44
    accuracyAimed: 86
    tuAuto: 32
    tuSnap: 18
    tuAimed: 52
    autoShots: 5
    experienceTrainingMode: 5
For auto-pistols I use mode 17 (reactions or firing):
Code: [Select]
  - type: STR_AUTO_PISTOL
    accuracyAuto: 40
    accuracySnap: 45
    accuracyAimed: 66
    tuAuto: 19
    tuSnap: 13
    tuAimed: 22
    experienceTrainingMode: 17

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9094
    • View Profile
Re: Modding experience gained and stat caps
« Reply #12 on: October 05, 2018, 07:32:52 pm »
I want to put the stats cap higher and lower the experience gain rate, and maybe not use training facilities altogether. Just for fun, cause I remember playing xcom apocalypse and having all my soldiers maxed out very early, then I felt it got less fun.

Well, it won't be easy.

Although what Reaver and Yankes said is all true, it doesn't help you much... because as I said at the beginning, you can't change how the stats improve, the algorithm is hardcoded.

a/ There's absolutely nothing you can do about TU, stamina, HP and strength stat improvement.
b/ There's almost nothing you can do about bravery, psi skill/strength and reactions... the new experience system can only help you increase them quicker... but you want slower
c/ melee accuracy is relevant only for mods... but if you're using some mods that depend on it, you can slow it down... a little
d/ throwing has been changed in OXCE and is now only trained when you actually hit an enemy with a grenade or something thrown... just throwing random stuff around doesn't do anything... so I guess here you can be happy at least
e/ as for firing accuracy, you can slow it down a little, same as for melee... but it probably won't be enough for you... even 33% experience gain compared to vanilla doesn't translate into 33% stat improvement... the formula for stat improvement is not linear... Last, most drastic thing you could do for firing accuracy, is turn off firing accuracy training for some weapons completely... but that somehow doesn't feel right.


My best advice... allow your soldiers to die... vanilla xcom is balanced in a way that even most veteran players can't keep them alive for more than 20 missions or so. Unless you of course don't use them; or use all possible cheesy tactics in the world. The game is MUCH more fun when soldiers die, believe me.
« Last Edit: October 05, 2018, 07:39:12 pm by Meridian »

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: Modding experience gained and stat caps
« Reply #13 on: October 05, 2018, 11:17:35 pm »
I think I could reorganize my script to be call after stat improvement and expose result of that to it.
With this you could overwrite or adjust final change of stats after mission and this will not made mess in code.

Another thing is that I will expose current exp of each stat to script with this you could create custom training function.

Offline Joe

  • Sergeant
  • **
  • Posts: 11
    • View Profile
Re: Modding experience gained and stat caps
« Reply #14 on: October 07, 2018, 12:38:05 am »
Thanks to all for the answers, for now I use a little hack work around, not too pretty but does the job. I'd be interested in your script Yankes though.