OpenXcom Forum

Modding => OpenXcom Extended => Topic started by: Meridian on January 16, 2016, 09:22:18 pm

Title: [DONE] New experience award system / accuracy training system
Post by: Meridian on January 16, 2016, 09:22:18 pm
OK, here goes nothing:

1. vanilla bravery training unchanged
2. vanilla reactions training unchanged
3. vanilla psi strength and psi skill training unchanged
4. vanilla throwing training completely removed!
5. vanilla melee training moved to new common system... mostly unchanged, you cannot train on mind-controlled aliens anymore though
6. vanilla firing training reworked completely
7. vanilla secondary stat (tu, stamina, hp, strength) training unchanged, but is now triggered also by throwing experience gained

General rules:
a/ you can train accuracy (firing / throwing / melee) only if you HIT the enemy
b/ neutrals don't count
c/ enemies under mind-control don't count
d/ friends under mind-control don't count
e/ the hit must be caused by a weapon... i.e. hitting an explosive pipe, which kills the unit doesn't count
f/ you are not limited to firing/throwing/melee only... there is a possibility to override it by 32 new options... more about that later

Default algorithm:
1. if grenade or proxy grenade weapon type => train throwing (+1 for each unit hit)
2. if melee weapon type => train melee (miss is not a hit!)
3. if firearm (or other) train:
3a. if not ranged attack, train melee (e.g. gun butt)
3b. otherwise if arcing shot, train throwing (e.g. flamethrower, javelins, combat bow, grenade launcher, molotov, black powder bomb, stick grenade, acid flask, apple, ...)
3c. otherwise if maxRange > 10, train firing (e.g. panzerfaust, harpoon gun, shotgun, assault rifle, rocket launcher, ...)
3d. otherwise if maxRange between 2 and 10, train throwing (e.g. fuso knives, zapper, ...)
3e. otherwise if maxRange = 1, train melee (e.g. hammer, chainsaw, fusion torch, ...)
3f. otherwise nothing!

Notes:
 - all shotgun pellets fired at the same time count only as one hit only
 - explosive, incendiary, etc. ammo hitting multiple units counts as multiple hits
 - smoke hits too :)
 - stun as well

There is a possibility to skip the default algorithm completely, by adding "experienceTrainingMode" attribute to your weapon.

How it works:
- ignores default algorithm completely
- supports values from 0 to 32 (0 means turned off, i.e. use default algorithm)
- can train all primary skills, but psi strength and psi skill can only be trained if soldier already has psi skill > 0 (without armor buffs!)
- you can only have one override, so weapons with two different attacks are not well suited for that (e.g. rifle's shots and gun butt attack)

A full list of possible overrides:
0 default algorithm -- if nothing is specified
1 train melee
2 train melee 50% chance
3 train melee 33% chance
4 train firing
5 train firing 50% chance
6 train firing 33% chance
7 train throwing
8 train throwing 50% chance
9 train throwing 33% chance
10 train firing and throwing
11 train firing or throwing (coinflip)
12 train reactions
13 train reactions and melee
14 train reactions and firing
15 train reactions and throwing
16 train reactions or melee (coinflip)
17 train reactions or firing (coinflip)
18 train reactions or throwing (coinflip)
19 train bravery
20 train bravery x2
21 train bravery and reactions
22 train bravery or reactions (coinflip)
23 train bravery or reactions (coinflip) x2
24 train psi strength
25 train psi strength x2
26 train psi skill
27 train psi skill x2
28 train psi strength and psi skill
29 train psi strength and psi skill x2
30 train psi strength or psi skill (coinflip)
31 train psi strength or psi skill (coinflip) x2
32 train nothing

Cheers,
Meridian
Title: Re: New experience award system / accuracy training system
Post by: eisenefaust on January 17, 2016, 01:31:23 am
Hi Meridian, thanks for putting in so much effort into this.
Two quick questions for you though, with override 12 through 18 and 21 would it be possible for you train reactions with an active action rather than on the the opponents turn?
Would mortar have a default override of 10?
Thanks
Title: Re: New experience award system / accuracy training system
Post by: Meridian on January 17, 2016, 11:03:57 am
Two quick questions for you though:
1: With override 12 through 18 and 21 would it be possible for you train reactions with an active action rather than on the the opponents turn?
2: Would mortar have a default override of 10?

1: Yes, as I said this training is applicable only when you hit the enemy. For example you can redefine the Cutlass to train Melee+Reactions on every hit (instead of just Melee)
2: I don't have control over PirateZ code, you'll have to ask Dioxine.
Title: Re: New experience award system / accuracy training system
Post by: Dioxine on January 17, 2016, 11:37:29 am
Would mortar have a default override of 10?

In your dreams maybe...
Title: Re: New experience award system / accuracy training system
Post by: eisenefaust on January 17, 2016, 11:10:49 pm
In your dreams maybe...
or 11 maybe for the coin flip?
The point is I think it's rather odd for any weapon to utilize multiple stats for accuracy or damage and no chance or raising some that it uses.
What do you think Dioxine?
Title: Re: New experience award system / accuracy training system
Post by: hellrazor on January 17, 2016, 11:21:06 pm
e/ the hit must be caused by a weapon... i.e. hitting an explosive pipe, which kills the unit doesn't count <--

No more Improvisation? Come on! Let me Blow up those pipes.
Title: Re: New experience award system / accuracy training system
Post by: Meridian on January 17, 2016, 11:30:37 pm
e/ the hit must be caused by a weapon... i.e. hitting an explosive pipe, which kills the unit doesn't count <--

No more Improvisation? Come on! Let me Blow up those pipes.

You would still get the entry in the soldier diaries ;-) If it was in OXCE.
Title: Re: New experience award system / accuracy training system
Post by: Eddie on February 25, 2016, 07:52:43 pm
I would like to suggest a new mechanism for bravery increases.

In normal play, meaning not specifically playing to train a stat, I've only gotten one stat increase so far. And that was because of repeated enemy voodoo use to panic this one gal.
To train bravery, I put an unconscius enemy in a place whithout weapons where I can trap him (cave for example) and then revive him there. Finish rest of the map, then wait 10 turns so low bravery gals panic a lot and then finish off the trapped enemy. This only works for gals with bravery <60 though.
Another method is flag abuse. Have two gals alternate using your flag. Flag use drops your morale under 50 and restores moral for the other gal so she can use the flag next turn.
Both these methods are not fun to do, but bravery is an important stat in XPiratez and stat increases are needed.

Here is my suggestion:
Instead of the resisted panic counter to give a stat increase chance, use the kill counter. Each kill gives a 10% chance to increase bravery. 3 kills, 30% chance to get a bravery increase at the end of the mission. Actual percentages need to be playtested and there could be diminishing returns depending on bravery stat. Like percentage per kill = (10% - bravery/10). But you get the idea I hope.
This mechanic would also force you to make more decisions. Economy wise, you want to stun every enemy to get more money. But to get bravery stat increases, you would need to kill them instead of stunning them. So now decide, stat increase or money?

Edit: fixed typos
Title: Re: New experience award system / accuracy training system
Post by: Arthanor on February 25, 2016, 08:26:25 pm
Kills increasing bravery could make sense. A gal who kills lots should be confident.

By opposition, should getting injured give a chance of reducing bravery? If you get injured a lot, you wouldn't be very confident... thjat could create an interesting dynamic bravery.
Title: Re: New experience award system / accuracy training system
Post by: Dioxine on February 25, 2016, 09:30:36 pm
Well, the opposite can be easily argued. I can't see what killing people has to do with Bravery? It already increases Morale, so it would be a geometrical effect. Conversely, one could argue that getting injured and going back to fight should increase Bravery, as the soldier finds new confidence to fight.
Naturally the issue of Bravery training should be resolved at some point (added Braver training to healing, but medical items do not support training... yet), but privately, I pretty much ignore Bravery - if it's too low, soldier will panic and eventually their Bravery will rise. So unlike with Reactions, I think training bravery by mechanics abuse is a waste of time.
Title: Re: New experience award system / accuracy training system
Post by: Arthanor on February 25, 2016, 09:44:11 pm
I was just thinking along simple lines:

If you kill most of what you meet, you can be confident that upon meeting more opposition, you'll kill 'em too. (until you meet something significantly stronger than what you met previously!)

If you get injured often in the field, you probably won't like being there and be likely to want to run away.

But in general I agree, many of my best soldiers have very low bravery (see capt'n's log) and they do totally fine. The only time it's an issue is when hunting for the last few enemies on a map, by which point the only question is "how long is it going to take for me to win?"
Title: Re: New experience award system / accuracy training system
Post by: Eddie on April 26, 2016, 12:38:22 am
I may have encountered a bug. I had a gal with combat shotgun on a mission and she had 3 shots with hits, but she got no accuracy experiance from the mission. Is this how it is supposed to be?
Title: Re: New experience award system / accuracy training system
Post by: Solarius Scorch on April 26, 2016, 12:41:19 am
I may have encountered a bug. I had a gal with combat shotgun on a mission and she had 3 shots with hits, but she got no accuracy experiance from the mission. Is this how it is supposed to be?

AFAIK only the first pellet can award experience. So it's possible that while other pellets hit, the first one missed and therefore no exp.
Title: Re: New experience award system / accuracy training system
Post by: Eddie on April 26, 2016, 12:55:07 am
Thanks, thats what I thought. I suppose there is no other way to code this?

Maybe this would work: The hitlog can already tell if shotgun pellet hits are from the same shot or not. So this "shot + any number of hits" data could be used for a more accurate xp calculation
Title: Re: New experience award system / accuracy training system
Post by: sambojin on April 26, 2016, 02:11:59 am
I'm still a bit iffy on grenade launchers, flamers and assault cannons training throwing as the default (I can understand why, to save making two arcing lists, but it doesn't make sense). There's plenty of ways of training throwing now, so I don't really think bows need any more help.

And for bravery training, it's fine. Want more self confidence in your ability to take on anything without whimping out? Turn up in a skimpy outfit, or nothing at all, and survive a few missions. By the end of it that gal won't be scared of anything. Boob-swing induced combat stress is very character building, even to the scaredy cats.

Q: Does the "first pellet" thing only apply to shotguns, or does it apply to auto-fire weapons too? And funny ones like flamers?
Title: Re: New experience award system / accuracy training system
Post by: Arthanor on April 26, 2016, 02:24:55 am
The "1st pellet gives xp" was implemented for shotguns, which have good accuracy and if every pellet counted, could grant the equivalent of 8 hits even though that was only one snap/aimed shot. Autoshots count hit for every shots, so miniguns and HMGs are really good for training (if you can hit anything with them multiple times...).

Doing a bit of research in the ruleset:
Flamethrower: Uses Firing, xpMode 9 = trains throwing 33% chance (I assume to reduce the training since autoshots have 8 shots so could yield lots of xp)
Grenade Launcher: Uses firing, xpMode 4 = trains firing (yay!)
Assault Cannon: Uses Firing, xpMode 4 = trains firing (yay!)

So it looks pretty good. I'd agree that a flamethrower is more of a gun than akin to throwing a rock.. but if "arc projection" is the skill represented by throwing (ie being able to tell how to fire a weapon on an arcing shot), then the grenade launcher and assault cannon should train it. As is, it is maybe not too consistent. It could be cool to see more of the xpMode 11, 50/50 throwing and firing, to represent learning about the arc and the aim, leaving only properly throw items (knives, ninja stars, grenades, molotovs and bombs) as training throwing 100% of the time. Even a bow is aimed similarly enough to a gun that I could see it training either.
Title: Re: New experience award system / accuracy training system
Post by: Dioxine on April 26, 2016, 03:08:16 pm
I'm still a bit iffy on grenade launchers, flamers and assault cannons training throwing as the default (I can understand why, to save making two arcing lists, but it doesn't make sense). There's plenty of ways of training throwing now, so I don't really think bows need any more help.

It's quite silly to complain about bugs that exist only in your imagination; GLs and Cannons train Firing, not Throwing. However, I've changed flamethrowers to 33% train firing, since they use Firing for attack. It's indeed more sensible.

Also, no inconsistency, Arthanor. Throwing is the skill bow is using, so Throwing it trains, NOT firing. Let's not get distracted by the semantics of the word 'throwing'. It is one of 3 attack skills we have, we don't have any more to burn, and their irl semantic fields are not really that important; important is, what they represent in-game. IF everything was training everything, why would we need separate Throwing and Firing? We could add bows under Firing and be done with it, but IMO that would be really boring compared to how it's working now, as in "useless throwing skill is now important".
Title: Re: New experience award system / accuracy training system
Post by: Arthanor on April 26, 2016, 04:26:02 pm
If you flip the flamethrower to training firing, then I think it all makes sense.

I was merely suggesting one way the use of both skills could be rationalized: Firing = proper aiming, Throwing = arcing shots. It is maybe less diverse (since it would have bows and other aimed arcing weapons train both firing and throwing), but it is a rationalization.

I understand that you prefer of more strongly divided way with weapons being either one or the other, and with the change to the flamethrower, I agree that works too. It just seemed odd before (and the defaults are probably what was confusing sambojin. Not everyone goes to dig in the ruleset when they have questions, and.. I guess not everyone asks questions when they have them, it's easy to just assume and criticize).
Title: Re: New experience award system / accuracy training system
Post by: Dioxine on April 26, 2016, 06:06:29 pm
My definition for Throwing in Piratez would be, 'skill to use muscle-propelled weapons that usually, but not neccesarily, have arcing shots; a primitive alternative to Firing'. That's why it's used in some melee weapons, for instance. However I'm not sure about the Mortar. It uses Firing/2 + Throwing/2 but does to not conform to the above definition. I'd preferably use Firing/2 + Intelligence/2, but there is no such stat in XCom... Any suggestions?
Title: Re: New experience award system / accuracy training system
Post by: Arthanor on April 26, 2016, 06:48:07 pm
Interesting challenge. The stats are very physical.. If not throwing:

I could see bravery, to represent the ability to keep your cool under fire/when your friends are under fire, communicate well to get the positions from spotters and then make the right calculations and minute adjustments to engage something you can't see.

Or reactions, which is a measure of your ability to act/react in combat to mean also an ability to think in combat.
Title: Re: New experience award system / accuracy training system
Post by: ivandogovich on April 26, 2016, 07:01:32 pm
Just to chime in:  I for one don't see a real issue with tying Throwing skill in general to "Arcing" weapons, but in terms of skill required as well as skill trained.  Its just a bit more abstracted from the "muscle powered tossing" Throwing sense.    I still think its nice to have the variation overall.
Title: Re: New experience award system / accuracy training system
Post by: Arthanor on April 26, 2016, 08:15:58 pm
Neither do I, it's more of a matter of everything being consistent, and what definition to be consistent about. Now we have one which Dioxine has provided, and it is an easy one to make consistent with the flamethrower being fixed.
Title: Re: New experience award system / accuracy training system
Post by: bluberd on April 28, 2016, 01:47:29 pm
My definition for Throwing in Piratez would be, 'skill to use muscle-propelled weapons that usually, but not neccesarily, have arcing shots; a primitive alternative to Firing'. That's why it's used in some melee weapons, for instance. However I'm not sure about the Mortar. It uses Firing/2 + Throwing/2 but does to not conform to the above definition. I'd preferably use Firing/2 + Intelligence/2, but there is no such stat in XCom... Any suggestions?

I would put mortar under throwing skill completely. I know it might seem strange, but look: mortar is available from the very start of the game, meaning you do not have very experienced gals. In the beggining of xcom I tend to buy a lot of soldiers, check their statistics, looking mainly for TU/firing/bravery/reactions in that order and then sack the crappy ones. Piratez adds melee somewhat in that equation but in general throwing is somewhat of a less useful skill. Obviously in the beggining your soldiers shoot like crap, so one dedicated soldier with high throwing skill is pretty usefull, but then when your other soldiers shoot better, you use less granades. In Piratez you have bows/blowpipes, so your dedicated throwing gal stays pretty useful somewhat longer, but when lasers/gauss are somewhat common I see no use for bow and dart pistols are better than blowpipes.
Dojo helps a lot with low throwing and in general I find throwing at the level of 50 to be enough for assault troops to safely use granades in combat situations, so not so much use for a dedicated thrower.
So in the mid game I see no use for high throwing skill. Correct me if I'm wrong, but there is no interesting throwing usage beside hellerium granades.

I know we could discuss logic behind every skill but we need to think of game balancing as well. You have set of just a few skills, let's make them useful. I've seen that issue multiple times with pen and paper RPG games, game balancing mechanics with character skills is tedious task

Also: If you really want to get into skill set for different weapons, quasi real life, logic and all, then light weapons like pistols might use also reaction (firing is aiming reaction is coordination of motor skills and perception); for example (firing+reaction)/2 - to reflect the fact of poor aim for non-shoulder weapons (takes way longer to aim) and the fact that in the combat situation there is no time to aim well with them. I know it is somewhat included in the accurancy of the pistols and the low TU cost, but the skill is somewhat different in real life to shoot for example dual hand mp5k and mk5 with a stock.
Same with throwing knifes - I know throwing is crucial, but with knifes you need to throw fast and flat and in combat there is no time to aim (I guess, I never used knife in a bar fight ;D).
Really heavy weapons might use (firing+throwing)/2 cause bipodded/tripodded heavy weapons, espacially at long distances have less in common with handheld firearms.
But then you are complicating the mechanics even more, you already need to calculate damage bonus and think which gal is the best to use specific weapon. Making the game mechanics more real-life means you need whole military chain of command to think of at every stage of the game - I know it is supposed to be mentally stimulating, but too much micromanagement is making players miserable.
Title: Re: New experience award system / accuracy training system
Post by: legionof1 on April 28, 2016, 02:49:00 pm
I will disagree with throwing becoming useless midgame. The more advanced bows have excellent stat scaleing. A longbow can get 82 base dmg before outfits are considered. With amazon base becomes 87. Brute armor reaches 94 base. Future bows top out at 107 PLASMA dmg. Do not discount archer support or being able to use the archer gals to throw flares or smoke all the way across a map. All from the safety of the landing craft.

Oh and longbows are a mere 3 tiers deep in the tree from the start point. Future bows are not particularly deep either if you can manage a few merc captain captures. Oh and no special buildings for ammo production unlike comparable damage weapons.
Title: Re: New experience award system / accuracy training system
Post by: yrizoud on April 28, 2016, 04:50:59 pm
I think he means there is a "gap" mid-game when throwing becomes comparatively less interesting.
Dioxine takes care to put throwing weapons at different states of technology and power, but since there are considerably more firearms than throwing weapons, it is very likely that during a campaign there are moments when the available "throwing tech" stagnates, while better and better firearms become available.
IMO it's not an issue since throwing weapons keep unique advantages, and thus a mixed team is better than a specialized one.
Title: Re: New experience award system / accuracy training system
Post by: bluberd on April 28, 2016, 05:05:12 pm
I will disagree with throwing becoming useless midgame. The more advanced bows have excellent stat scaleing. A longbow can get 82 base dmg before outfits are considered. With amazon base becomes 87. Brute armor reaches 94 base. Future bows top out at 107 PLASMA dmg. Do not discount archer support or being able to use the archer gals to throw flares or smoke all the way across a map. All from the safety of the landing craft.

aww, there you go, had no idea.
I used longbow for a quite a time, but at some point it stopped to be good and I have never seen plasma bow O_O. case is I have plenty plasma weapons in storage and cannot research them in any way.
When I get bigger transport the throwing gals will get in, but at 6-8 gals, throwers were not crucial as long as assaulters can throw granade somewhat accurate at 10-15 tiles.
Title: Re: New experience award system / accuracy training system
Post by: legionof1 on April 28, 2016, 05:25:00 pm
Bow do suffer against heavily armored foes more then guns do because of the 60+ pierce and plasma dmg rule. A 60+ hit from those 2 types will always remove some armor even if they fail to do hp dmg.
Title: Re: New experience award system / accuracy training system
Post by: The Reaver of Darkness on March 13, 2018, 06:43:02 am
Can you add more overrides? I wanted strength gains from using certain weapons (like melee weapons).

Example:
33 train strength
34 train strength x2
35 train strength 50%
36 train strength 33%
37 train strength and melee
38 train strength or melee (coinflip)
39 train strength and reactions
40 train strength or reactions (coinflip)

Then I also wanted some options higher than 50% chance:

41 train firing accuracy 67% chance
42 train throwing accuracy 67% chance
43 train melee 67% chance
44 train reactions 67% chance
45 train bravery 67% chance
46 train strength 67% chance
47 train psionic strength 67% chance
48 train psionic skill 67% chance

And some lopsided combos...

49 train firing accuracy or throwing accuracy (67/33)
50 train firing accuracy or throwing accuracy (33/67)
51 train melee or reactions (67/33)
52 train melee or reactions (33/67)
53 train melee or strength (67/33)
53 train melee or strength (33/67)
55 train melee or reactions or strength (33/33/33)
56 train psionic strength or psionic skill (67/33)
56 train psionic strength or psionic skill (33/67)
Title: Re: New experience award system / accuracy training system
Post by: Ethereal_Medic on March 13, 2018, 08:54:18 am
I don't understand what those examples mean to be honest.
If you ramp up experience gain for stats any further, the purpose of recruiting warriors and veterans becomes pointless.
Those costly options for hiring troopers is meant to give you 'decent' and 'good' soldiers which require less to no further training to become awesome.

I guess there's a reason for non-trainable voodoo-power. Those with <30 V-Power either sit in the barracks or wear armor with +50% voodoo defence.
Training v-skill for those voodoo-wimps is still worth it and it does reduce the efficency of enemy panic-attacks.
It's not recommended to give them rocket-launchers, grenades and other mass-destruction tools.
Title: Re: New experience award system / accuracy training system
Post by: Meridian on March 13, 2018, 09:47:50 am
Can you add more overrides? I wanted strength gains from using certain weapons (like melee weapons).

Yankes added scripting possibility for experience gain, you can define all these options via a script.

Except for strength, which is not a primary skill and cannot be trained directly.
Title: Re: New experience award system / accuracy training system
Post by: The Reaver of Darkness on March 13, 2018, 06:55:42 pm
If you ramp up experience gain for stats any further, the purpose of recruiting warriors and veterans becomes pointless.
I can't speak for Piratez specifically, but in general it is useful to the modder to have options to give soldiers more or less experience. If a weapon is very slow and cumbersome, it may make sense to have that weapon grant a lot of exp per use. But a very fast weapon might need to give less exp. If you feel your soldiers are skilling up too fast, then you might suggest to Dioxine to adjust that. The discussion should never approach the subject of removing a modder's feature, as modders should always be given more tools, not have them taken away.


Yankes added scripting possibility for experience gain, you can define all these options via a script.

Except for strength, which is not a primary skill and cannot be trained directly.
Can you give me an example of how to script it?
Title: Re: New experience award system / accuracy training system
Post by: Meridian on March 13, 2018, 07:02:47 pm
Can you give me an example of how to script it?

No, I have close to no idea how scripts work... but maybe @Ohartenstein could help... I'll ping him.
Title: Re: New experience award system / accuracy training system
Post by: ohartenstein23 on March 13, 2018, 07:27:30 pm
I'll start off by saying I don't get yet all the intricacies of the awardExperience script, but here's the complete documentation from the verbose debug log (https://github.com/ohartenstein23/Yankes-Scripting/blob/master/yankesScript.txt#L2277).  At it's most basic, the script will run whenever experience is awarded to your unit, modifying the experience gain by a multiplier, and then returning it.  The following example just outputs the experience type and multiplier values to the openxcom.log file, so you can see what's going on:

Code: [Select]
extended:
  scripts:
    awardExperience:
      - offset: 1
        code: |
          debug_log 1 experience_multipler;
          debug_log 2 experience_type;

          return experience_multipler;
And no, "experience_multipler" is not a typo in the script, that's just what the variable is called.

An autoshot from a rifle on an alien looks like this in openxcom.log:
Code: [Select]
[13-03-2018_12-14-25] [DEBUG] Script debug log at     0x23: 1 100
[13-03-2018_12-14-25] [DEBUG] Script debug log at     0x46: 2 4
[13-03-2018_12-14-26] [DEBUG] Script debug log at     0x23: 1 100
[13-03-2018_12-14-26] [DEBUG] Script debug log at     0x46: 2 4
[13-03-2018_12-14-27] [DEBUG] Script debug log at     0x23: 1 100
[13-03-2018_12-14-27] [DEBUG] Script debug log at     0x46: 2 4
Note that the experience_type variable corresponds to the types Meridian wrote down in the first post of this thread; type 4 is firing accuracy experience, trained at 100% of normal rate.

If you want to simply double experience gain for all actions, that can be done by this:
Code: [Select]
extended:
  scripts:
    awardExperience:
      - offset: 1
        code: |
          mul experience_multipler 2;

          return experience_multipler;

Or if you wanted to replace 100% firing accuracy training with your request for 67% firing accuracy training, you could do it like this:
Code: [Select]
extended:
  scripts:
    awardExperience:
      - offset: 1
        code: |
          if eq experience_mode 4;
            muldiv experience_multipler 67 100;
          end;

          return experience_multipler;

You can write more complex logic based on a large number of variables; I'd recommend looking at some of the script example Yankes and I have written (https://openxcom.org/forum/index.php/topic,5245.0.html) to get an idea of how to set ruleset tags on an item to influence the logic in scripts.
Title: Re: New experience award system / accuracy training system
Post by: Meridian on March 13, 2018, 08:02:44 pm
Hmm, looks like I overestimated what the script can do... this would mean only the second group of your requests (the 67% chances) is doable.

Maybe worth asking Yankes if we even understand it correctly... and if yes, if he plans on extending it...
Title: Re: New experience award system / accuracy training system
Post by: The Reaver of Darkness on March 13, 2018, 08:08:54 pm
So I guess I could add a script to change a given exp gain mode that I don't use into one I do use.

Code: [Select]
extended:
  scripts:
    awardExperience:
      - offset: 1
        code: |
          if eq experience_mode 4;
            muldiv experience_multipler 2 3;
          end;

          return experience_multipler;

muldiv experience_multipler 2 3 should make more sense, it's not supposed to be exactly 67% but rather exactly 2/3rds, but it should make little difference either way.


Can you give an example of changing the ratio for 2 attribute types? Say I wanted to get melee 75% of the time and reactions 25% of the time. Or what if it's training melee AND reactions? Could I have it give 1 melee, plus 50% of the time 1 additional melee, or 50% of the time 1 reactions?
Title: Re: New experience award system / accuracy training system
Post by: ohartenstein23 on March 13, 2018, 08:15:50 pm
It doesn't matter terribly much whether you use muldiv 67 100 or muldiv 2 3, as the decimal part will just be truncated in either case due to integer math.  Also, what Meridian just said is that you can't change the ratio of two types of experience, only the changes of granting experience to the types already chosen; in the case of melee or reactions on a coin flip, that flip is already done by the time the script runs, and the script doesn't know which was chosen.  If it's training both and you want +1 experience and a 50% chance at additional +1, then you just need to have experience_multipler be 150 when you return it.
Title: Re: New experience award system / accuracy training system
Post by: FG on June 14, 2018, 06:14:29 pm
So, both these lines do the same thing?
> set experience_multipler 200;
> mul experience_multipler 2;

e.g.

Code: [Select]
extended:
  scripts:
    awardExperience:
      - offset: 1
        code: |
          set experience_multipler 200;

          return experience_multipler;
Title: Re: New experience award system / accuracy training system
Post by: ohartenstein23 on June 14, 2018, 06:18:50 pm
Close, but not quite.  For some experience training modes, the experience_multiplier is not equal to 100, for example, any of the ones that train at a 50% rate.
Title: Re: New experience award system / accuracy training system
Post by: FG on June 14, 2018, 06:29:54 pm
Close, but not quite.  For some experience training modes, the experience_multiplier is not equal to 100, for example, any of the ones that train at a 50% rate.
Oh, i see. thx for clarifying :)
Title: Re: [DONE] New experience award system / accuracy training system
Post by: Ethereal on July 30, 2018, 12:45:34 pm
In General, I did not understand anything, I did not find a script template, but the problem remained.

Not enough options for Training Mode;

?? train firing and melee (100%)
?? train firing or melee (coinflip)
?? train throwing and melee (100%)
?? train throwing or melee (coinflip)

Please explain to noob how to do this.
Title: Re: [DONE] New experience award system / accuracy training system
Post by: Ashghan on May 28, 2019, 07:42:02 pm
I know this is a bit of a necro, but this seems a good topic to ask the question - is there a way to set a training mode separate for secondary melee attack? Ie. I want my gun to train firing when shooting, but stabbing with the bayonet should train melee. What I'm looking for is something like MELEEexperienceTrainingMode: XX setting, separate from experienceTrainingMode: (and overriding it in melee combat).
Title: Re: [DONE] New experience award system / accuracy training system
Post by: ohartenstein23 on May 28, 2019, 09:43:39 pm
I know this is a bit of a necro, but this seems a good topic to ask the question - is there a way to set a training mode separate for secondary melee attack? Ie. I want my gun to train firing when shooting, but stabbing with the bayonet should train melee. What I'm looking for is something like MELEEexperienceTrainingMode: XX setting, separate from experienceTrainingMode: (and overriding it in melee combat).

What you're describing is the default behavior for firearms in OXCE - if a gun has a "hit" attack, it will train melee.
Title: Re: [DONE] New experience award system / accuracy training system
Post by: Ashghan on May 29, 2019, 07:07:35 pm
I admit - I chose my previous example poorly. The default work like this, yes.  But if you use the  experienceTrainingMode: to override the default behaviour, then any attack made with that weapon gives the same type of training. So if I override a rifle to type 14 experience training Firing + Reactions, it's gunbutt melee attack will also give fire + react not melee. My question is - would be possible to apply different types of experience to different attacks. Ideally something like - Aimed (Firing), Snap (Reactions), Gunbutt (Melee) - or whatever other skill defined by use.