Modifying Veterancy System
Posts: 515
So far, I've increased the XP required for each level substantially (as to not let damage accumulate XP) and then have been toying around with trying to figure out how I am going to award a squad XP when they kill a unit.
I was fiddling around with the kill_action command, using it combined with action_veterancy (to no avail), as well as combining it with counter_with_ability_action, and trying to activate an ability on the "shooter" called "veterancy", which awards 1,000,000XP (since 8,000,000 XP required for vet1). None of these ideas have worked.
Could any of you help? What would be the best way to design a squad so it gains no (or negligible compared to XP required for vet) XP from damaging enemy units, and only gains (or gains substantial numbers of) XP from killing enemy units?
Edit: right now I have something working, where I combined kill_actions with actions/change_target, set the target type to squad, and the acociated action with action\veterancy. It works SOMETIMES... some kills the squad gets will award 1,000,000 XP (1/8 of the progress bar), and some kills will award 0 XP. Not sure why or how to fix.
Posts: 2742
There are the changes that were made in recent patches to reduce the xp gained from infantry AT. I think it reduces the damage done directly by the weapon that gives the squad veterancy, and instead the remaining damage is applied directly through an action. You'd have to do this with every weapon though, which would be very clunky and time consuming to do.
The balance team or relic would have to clarify. I only have access to my coh2 computer on weekends.
However I think this method is what has resulted in things like bazookas being bugged so they don't kill their targets when they're reduced to 0 health...
Also this method doesn't affect units getting veterency from taking damage I think. And that's kind of a whole other monster.
I'll dig up my old test mod and see if theres anything useful related to vet in there. I think I ended up rebuilding purchased vet and gave up on adjusting how veterency was gained back in like 2015.
I think you could potentially leave giving and taking damage alone and just massively scale up vet requirements as I think it would be easier to do what you're doing and have a much, much larger amount of xp given per kill.
Argh I wish I had mod tools handy here so I could help before friday.
Posts: 515
The only way I can see it happening is increasing the XP required to gain veterency by a huge amount as so that damage gives negligible XP, and then awarding XP to the squad when it kills entities. But even this has proven to be a feat.
Posts: 2742
Posts: 2636 | Subs: 17
I've never used kill_actions. However it sounds much cleaner than what I am about to recommend, so I suggest you continue toying around that.
1. Awarding veterancy
If you look at the tiger ace files, there's an action that awards veterancy to the tiger (it's either in the ebps file or the sbps file; can't remember). What you need to do is find a trigger for it.
2. Adding a Trigger (try to avoid it, if a better way exists)
If no such trigger exists, you can create your own trigger as follows:
- Go through each entity in the files and look for their death criticals (e.g., vehicle_destroy for vehicles, and I don't know what the name for soldiers is).
- Remove the destroy/brew-up/whatever criticals from the entity file; you're going to add them manually to the weapons
- For every weapon in the game, add a post-damage action that checks for the HP of the target:
Do so as follows:
- If the enemy unit has 0% HP, you should trigger vehicle_destroy on the enemy vehicle
- You should also trigger a veterancy-awarded action on your own unit (change-target-action -> self; award veterancy)
- To keep the interface clean, I recommend creating a special my_vehicle_destroy_crit and my_infantry_kill_crit. Inside each of those crits you call the actual vehicle destroy crit, and you also award the veterancy to the killer
- Inside the my_vehicle_destroy crit, you should also specify how much veterancy each vehicle should award (check Brit Command Vehicle to see how you can have a "switch" statement like this).
3. Removing on-hit veterancy
Once you've done the had part, what remains is to prevent units from awarding veterancy when hit (but are still alive). The way to do this is add an "awarded_veterency" (sic) modifier to each squad sbps with a multiplier set to 0. You can find the precise name of this modifier under sbps -> veterancy.
Currently this modifier is used to add 20% XP worth to each unit as it vets up.
4. Schreck veterancy (not a solution, but for reference)
The hack we used to fix schreck veterancy is commute some raw damage to a 'damage' action. That is because we, accidentally, discovered that the damage-action awards no veterancy of its own.
The schreck-veterancy method is ugly, and you should probably avoid this, as it will make your files difficult to read. Even if this works, I would only integrate this at the final stages of your mod, so that you have the flexibility to update the weapon files in a more humane way.
Posts: 2636 | Subs: 17
I don't know what kind of criticals exist with respect to infantry. However, the fact that you get inconsistent performance is because some crits might count as a kill while others may not.
Posts: 515
Note that the reason why your solution might sometimes fail to work is if the kill fails to register as a kill. For instance, brew-up criticals might register as a ritual suicide rather than a kill.
I don't know what kind of criticals exist with respect to infantry. However, the fact that you get inconsistent performance is because some crits might count as a kill while others may not.
Thanks for the lengthy and detailed reply. I went ahead and tried the suggestion in this quote first before looking towards the other one - and this fixed the issue. There were two infantry death crits when dying to small arms fire, one called soldier_killed with 75% occurrence rate, and another called make_casualty with 25% occurrence. Removing the make_casualty now causes every kill my Rifleman squad gets to award veterancy.
However, I'm also fiddling around with what you said. But I'm stuck - how do I do a check on the targets HP? I see a requirement action where I can specify a health requirement ... but not sure how I can trigger an action on self depending on a target's HP?
Posts: 515
The kill_action combined with the veterancy_action only applies veterancy to the squad when it causes soldier_killed critical, not make_casualty.
Removing make_casualty from the target critical table fixes this. However, this makes it so there are no casualties being produced, and abilities such as interrogate wont work anymore.
I tried the method you described above, however, when changing target to "self" on the post-damage actions, I'm pretty sure self is the gun, not the squad, and thus when I tried the veterancy_action, it had no effect.
The best solution I could possibly think of would be to use the death_action on the entity, but I would have to somehow find a way to target the squad responsible for causing the death. If I could simply do that, I could make each entity reward a certain amount of experience to whatever killed it. This would be the best solution I think. Do you know if it's possible to target a squad who is attacking you, or has killed an entity?
Posts: 2636 | Subs: 17
I tried the method you described above, however, when changing target to "self" on the post-damage actions, I'm pretty sure self is the gun, not the squad, and thus when I tried the veterancy_action, it had no effect.
Self is probably the entity that fired the shot. Try the following:
Change target -> self
Change target -> squad
veterancy
To make sure that your setup works until that point, try this:
change target -> self
make dead
The above should make it so that every time you damage something, the squad member that did it died.
Then, to make this action only trigger if the squad is at 0% health, you need a requirement action that checks the health of the target. I really don't remember what it's called, but I'm sure it exists. You just need to check that the health percentage is at 0%.
First do your check for squads that have 30% or lower HP. That's because 0% HP entities tend to die.
Then. To make it so that you only award XP when the entities die:
- Remove soldier_killed and make_casualty from the criticals
- Change your requirement threshold from 30% to 0%
- Add the two to the weapon file you are modifying (along with the veterancy action but, obviously, not wrapped inside change-target-self); to preserve randomness, add them as a random action with weights similar to what they had
The kill_action combined with the veterancy_action only applies veterancy to the squad when it causes soldier_killed critical, not make_casualty.
Removing make_casualty from the target critical table fixes this. However, this makes it so there are no casualties being produced, and abilities such as interrogate wont work anymore.
I'm thinking there's no other way to implement this, other than messing around with the weapon files. Even if you manage to get the kill-action method working, you will have no way to tell what died. Then, you will end up in a situation where you will have to award the same amount of XP for a conscript kill as for a King Tiger kill.
The best solution I could possibly think of would be to use the death_action on the entity, but I would have to somehow find a way to target the squad responsible for causing the death. If I could simply do that, I could make each entity reward a certain amount of experience to whatever killed it. This would be the best solution I think. Do you know if it's possible to target a squad who is attacking you, or has killed an entity?
I don't think that any such action exists. At best you can use a target action to pick a random squad close to the squad that died to award the veterancy. However, that's probably not what you need. To see how the 'Target' action is used check the medic-auto-heal ability on USF medics.
Posts: 515
Self is probably the entity that fired the shot. Try the following:
Change target -> self
Change target -> squad
veterancy
Funnily enough, the night before you posted this, I also found this solution, and it worked. I was able to award experience to a squad whenever it triggered make_casualty (since I guess it counts as an alive entity with 0 health, so the requirement_health check of 0 sees this).
To make sure that your setup works until that point, try this:
Then. To make it so that you only award XP when the entities die:
- Remove soldier_killed and make_casualty from the criticals
- Change your requirement threshold from 30% to 0%
- Add the two to the weapon file you are modifying (along with the veterancy action but, obviously, not wrapped inside change-target-self); to preserve randomness, add them as a random action with weights similar to what they had
This part was very interesting and got me thinking.
I am not able to test this until I'm home again on Monday, but I'll ask anyway, in case you know. If I go to say, the pioneer_mp entity and go to health -> criticals, and delete all the criticals that trigger at 0 health, would the entity then be invincible? Or put another way, is an entity without 0 health death criticals unable to die? If so, I was thinking I could merely just remove all the death criticals from German soldiers, and create them on the USA guns instead.
Example, on the M1_Garand, I could do:
post_damage_action:
requirement action:
change target -> self
change target -> squad
veterancy action -> award 1,000,000 XP (so 8 pioneer kills yields Vet1)
requires all:
unit_type = infantry
requirement_health = max 0, min 0
requirement action:
random action:
trigger critical: soldier killed
trigger critical: make casualty
requires all:
unit_type = infantry
requirement_health = max 0, min 0
So 1 action checks health and unit type and rewards XP, and then the next does the same check but will kill the target. I could then just copy/paste this action to all infantry weapons, and in theory can do the same to AT weapons as well (just change the death crits and unit type check).
What do you think?
Posts: 2636 | Subs: 17
This part was very interesting and got me thinking.
I am not able to test this until I'm home again on Monday, but I'll ask anyway, in case you know. If I go to say, the pioneer_mp entity and go to health -> criticals, and delete all the criticals that trigger at 0 health, would the entity then be invincible? Or put another way, is an entity without 0 health death criticals unable to die?
That's pretty much it, yep!
For instance, the OKW Breakthrough officer model has a bug in that it is immortal to flame damage, due to the absence of death critical from flame weapons.
This means that if you try to take the officer 1-on-1 with a flamethrower, you can knock his health down, but he will never die
If so, I was thinking I could merely just remove all the death criticals from German soldiers, and create them on the USA guns instead.
Yep! That's precisely what you should do.
Note that you need to do this for -every- weapon that can attack german soldiers, though.
This list should include:
- USA weapons
- Soviet/UKF weapons (since they can also attack germans)
- Grenades
- All tank MGs
- All tank cannons etc
- Offmap abilities (even though you don't care about veterancy, offmaps should still kill units!)
- Damage-over-time weapons (e.g., molotov-like abilities deal both direct damage and damage-over-time)
- German slot items (which can drop and be picked by americans)
Also, note that some weapons already have insta-death-critical actions (e.g., snipers, pathfinders, demos). For instance, Pathfinder slot items have a chance to kill infantry units below 50% HP. If you don't fix this, pathfinders that trigger the snipe will kill enemy units but not gain any HP for it. For those weapons, you should also award XP, but double-check that you are not awarding double-XP (one for the snipe and one for the 0-HP).
Since I suspect that you want CoH1-style veterancy for USF, and if you want only USF guys to gain veterancy from kills, you can add a requirement for the ownership of the enemy unit to be german on west_german.
Example, on the M1_Garand, I could do:
post_damage_action:
So 1 action checks health and unit type and rewards XP, and then the next does the same check but will kill the target. I could then just copy/paste this action to all infantry weapons, and in theory can do the same to AT weapons as well (just change the death crits and unit type check).
What do you think?
That could work. Personally, I would place both actions under the same requirement check, as follows:
requirement action:
{
change target -> self
change target -> squad
veterancy action -> award 1,000,000 XP (so 8 pioneer kills yields Vet1)
}
{
random action:
trigger critical: soldier killed
trigger critical: make casualty
}
requires all:
unit_type = infantry
(required ownership german or west_german)
requirement_health = max 0, min 0
To minimize resource consumption, I would also set the following two flags to True:
- No-retrigger
- Instant requirement check
Posts: 2636 | Subs: 17
requirement action1:
{
{
requirement action2:
[b]check_requirement_self to TRUE[/b]
{
change target -> self
change target -> squad
veterancy action -> award 1,000,000 XP (so 8 pioneer kills yields Vet1)
}
requires ownership: USF
}
{
random action:
trigger critical: soldier killed
trigger critical: make casualty
}
requires all:
unit_type = infantry
requires_any_in_list
(required ownership german)
(required ownership west_german)
requirement_health = max 0, min 0
Requirement action 1 checks if the unit should die (and kills it).
Requirement action 2 checks if the killer is a USF unit and awards veterancy as necessary.
Requirement action 2 is inside requirement action 1, as the first action. You need to have instant requirement check to true for both actions.
Once you get implement this, and we verify it can work (for a small number of weapons), tell me and we can work on rephrasing requirement action 2 so that it awards a different amount of veterancy per unit type.
Posts: 515
Posts: 2636 | Subs: 17
You think there's a way if incorporating different unit types to the same action? I was originally just thinking of have several post_damage_actions, one for each unit type I want where I can simply copy the previous code in its entirety, and change unit_type to say, sniper, and then change the veterancy to 3,000,000.
You could. That would be very difficult to maintain in the long-run though (e.g., what if you want the sniper to be worth 2x the experience? You'd have to remodify every single weapon).
Instead, I suggest (ab)using the slot item system to streamline XP worth.
- Each slot item, e.g., will be worth 50XP
- Each squad will hold a specific amount of (blank) slot-items denoting their worth (e.g., pioneer entities will be worth 4 slot items, and grenadiers will be worth 6 slot items).
Then, in your nested requirement action, the victor will gain 50XP points per special slot items that the squad was carrying
Then, to award 50XP per slot item, you have two options:
1) Create a nested requirement action, as follows:
Requirement action_1:
{
Award 50 XP
requirement action_2
{
50 XP
requirement_action_3
{
....
}
required_slot_item count min = 3, max = 100
required_slot_item count min = 2, max = 100
required_slot_item count min = 1, max = 100
2) Flat list of requirement actions
- Same as above, but not nested
The benefit of using slot-items is that you can extend it later on so that, e.g., when units gain veterancy they are worth more XP.
The reason I gave you two options is to see which one causes the least amount of lag; if any.
For the examples above, 50 XP is your unit quantum, and you should pick it as the greatest common divisor of all veterancy values.
Otherwise, you can further extend the system as follows:
- If you are comfortable with binary math, you can create (e.g.) 10 slot item types, to represent XP values 1, 2, 4, 8, 16, etc. That way you can represent all integer XP values from 0 to 1023, without having to check for slot item stacking (which means fewer checks to run)
- Otherwise, you can use different slot item denominators like how we use for money IRL (5-dollar bills, 500-dollar bills, etc).
Posts: 515
So already I have come upon an issue.
I started with my original setup:
post damage:
required action:
action: target self/squad/vet 1,000,000
requirements:
type: german_infantry
health: 0
slot_item: xp_1_vet
And this setup worked.
But, as soon as I tried to do put the xp_1_vet slot item into a nested requirement (so the action for requirement 1 was a requirement action with the slot_item requirement, and the veterancy action) it no longer works.
Posts: 2636 | Subs: 17
I'd have to see a screenshot to verify what's wrong.
Just make sure that you don't nest your requirement action inside a change-target-action->self, otherwise, you're checking your own unit for the slot item etc.
Posts: 8
Or, better yet, something you can copy-paste to all weapons in the game (including german once etc) is the following nested requirement action:
Code
requirement action1:
{
{
requirement action2:
[b]check_requirement_self to TRUE[/b]
{
change target -> self
change target -> squad
veterancy action -> award 1,000,000 XP (so 8 pioneer kills yields Vet1)
}
requires ownership: USF
}
{
random action:
trigger critical: soldier killed
trigger critical: make casualty
}
requires all:
unit_type = infantry
requires_any_in_list
(required ownership german)
(required ownership west_german)
requirement_health = max 0, min 0
Thank you both for this solution. I implemented this for my CoH-Retro mod, where I wanted the US faction to have the veterancy system like in CoH 1. And it actually works really well (beside being some amount of work changing all weapons - but I had to do that anyways).
First I was also looking for the death_actions in combination with shooter_action (or something called similar). But soon I realised there was a comment on this action saying it does currently not work (at least the way we want it to do). That's why I looked up here.
For the amount of xp earned I used the slot item solution. For detecting correct the critical death action I used the entity type.
To get this solution work I had to play around a bit with the trigger options of the requirement_actions. It does only work in a specific setup. I would have to look it up, but if you didn't manage to make it work I could paste my code here.
Posts: 515
I'm just curious, what do you mean by CoH retro mod? When making this thread, I was myself attempting to clone CoH1 into CoH2. I managed to create the USA Headquarters (and all units/upgrades), Barracks (all units and ugprades), WSC, and Motor Pool (all units and upgrades). I also created a functional doctrine system, and finished the creating the Airborne doctrine. It was quite tedious producing all the weapons, especially since each has a unique target table with over 40 entries. I've since been slacking for the last 3 months and haven't touched it (since my mortar barrage failed to work, sniper was being buggy, and I couldn't get a visual gunner on my M8). How's your progress going? Any chance maybe on doing a collaborative work?
Posts: 8
You can view a stable version of my progress at Steam Workshop
My mod is at some playable point, but not finished yet. You may add me on Steam: Profile
I'm not hunting for credit or something - I just really want CoH 1 back. Let's do this together.
Livestreams
Ladders Top 10
-
#Steam AliasWL%Streak
- 1.831222.789+37
- 2.615222.735-2
- 3.35057.860+15
- 4.1110614.644+11
- 5.276108.719+27
- 6.306114.729+2
- 7.918405.694+2
- 8.262137.657+3
- 9.722440.621+4
- 10.1041674.607-2
Replay highlight
- cblanco ★
- 보드카 중대
- VonManteuffel
- Heartless Jäger
Board Info
5 posts in the last week
33 posts in the last month
Welcome our newest member, ko66compro
Most online: 2043 users on 29 Oct 2023, 01:04 AM