combat mechanic for "slayer"?

davidlallen

Deity
Joined
Apr 28, 2008
Messages
4,743
Location
California
I would like some starting point suggestions for a mechanic I am trying to implement for a fantasy mod. The idea is to have single powerful monster units, like a dragon. The dragon has a high regular combat strength and can, in fact destroy armies singlehandedly. Say, a 24 strength for the midgame, when a knight has 14. A big stack of knights might kill it, but probably not.

The counter to the dragon is the hero, which is also a single (human) unit, which by itself cannot destroy armies. Say, a 4-6 strength, so it can take out primitive warrior armies, but not a fortified city defense archer. But still, the point of the hero is that it can slay the single monster unit. So, I want a "slayer" combat mechanic.

One traditional way to do this is with a promotion that gives +300% combat vs a "dragon" unitcombat. This is hard to balance, especially when it interacts with other promotions. I would like several levels of hero, and several levels of monster, with more or less predictable outcomes: a Hero I unit can take on a Monster I unit with a significant risk, a Hero II unit can predictably slay a Monster I unit but would be slaughtered by a Monster III unit. Specifically, equal levels have an outcome which is 10% hero dies, 50% draw with both injured, 40% slay monster, while +1 level has 1% hero dies, 9% draw, 90% slay, and +2 level is automatic slay.

So, I was thinking of a "prepass" somehow in the stack combat code, which looks for slayer type promotions in the attacking stack and matches with monster type promotions in the defending stack. These matchups are resolved with specific combat odds unrelated to their normal combat strength. If this can be done in a way that the combat odds hover help and animations work correctly, that would be great.

I'm not familiar enough with the sdk code to know where to start. But, frequent readers may know, I can probably figure it out with a few clues on the starting point and direction.

Any suggestions?
 
One idea could be to let the Hero take the place of the Great General unit. That way the Hero could either be given a "mission" (like "kill monster" that gives damage to a Dragon type unit, to the point that it might actually kill it) or attached to a regular military unit (like Knight). Just like the GG the Hero would unlock unique promotions to the unit its attached to. (Like "Dragonslayer".)

As the Hero is basically one single individual, I'm not seeing how he could have Combat Strength by himself. He could be invisible to most enemy units though (like the Great Spy), as no one surely would notice one individual sneaking across the border and into the castle of the Dark Lord, right?

In the fantasy mod I'm imagining the Heroes would be Great People, just like Wizards and other powerful individuals.

Perhaps even monsters should be some sort of special units, rather than just over-strength military units. Say that they cannot be attacked by conventional means, but only by units with special promotions. They could in turn cause damage (collateral damage?) by some other, indirect means. A fire breathing dragon would be too much for all the soldiers in the realm to cope with, and special measures would have to be used in order to defeat it. (I'm thinking Hero points come from completing Quests or the like.)

Just some ideas of mine, to discard or to be inspired by.
 
So, I was thinking of a "prepass" somehow in the stack combat code, which looks for slayer type promotions in the attacking stack and matches with monster type promotions in the defending stack. These matchups are resolved with specific combat odds unrelated to their normal combat strength. If this can be done in a way that the combat odds hover help and animations work correctly, that would be great.

You just described an existing tag, albiet for units. UnitClassTargets allows you to set a unit that the Unit will attack against first in a stack, regardless of other units.

Now, if you need this in a promotion, it shouldn't be that hard to mimic.
 
... the Hero could either be given a "mission" (like "kill monster" that gives damage to a Dragon type unit ... As the Hero is basically one single individual, I'm not seeing how he could have Combat Strength by himself. ... Perhaps even monsters should be some sort of special units, rather than just over-strength military units.

Thanks for the suggestions. Having a "kill dragon" action button is an interesting idea. I'm not sure how to make the AI use it effectively; I am hoping that by staying closer inside the existing combat system, the AI would recognize that the hero unit counters the dragon unit. I am aiming for a "Conan" type hero, who could not take out an entire "modern" army, but could either damage that army, or possibly take on a primitive army by himself. I do like the idea of dragons destroying an entire "modern" army, so I would like them to have regular combat strength. Still, I will think about this some more.

afforess said:
You just described an existing tag, albiet for units. UnitClassTargets allows you to set a unit that the Unit will attack against first in a stack

Interesting. I had never heard of that, but it is in the vanilla unit schema. None of the vanilla units use it. Are you aware of any mods which use it, so I can try out an example? That may be part of the solution. It may result in an N^2 number of entries, if there are N hero types and N monster types, but the object looks like a list, so that may be OK.

However, it still leaves me with the unit strength problem. Since heroes would also have access to many normal promotions which boost their strength, it is hard to make a predictable system. For example, a unit with Hero I but also Combat IV might be able to take out a Monster III unit, which is undesirable. That may not be fatal; if I can try out the UCT field, maybe I can design something around that.
 
Interesting. I had never heard of that, but it is in the vanilla unit schema. None of the vanilla units use it. Are you aware of any mods which use it, so I can try out an example? That may be part of the solution. It may result in an N^2 number of entries, if there are N hero types and N monster types, but the object looks like a list, so that may be OK.

However, it still leaves me with the unit strength problem. Since heroes would also have access to many normal promotions which boost their strength, it is hard to make a predictable system. For example, a unit with Hero I but also Combat IV might be able to take out a Monster III unit, which is undesirable. That may not be fatal; if I can try out the UCT field, maybe I can design something around that.

I've seen it used before in a sniper unit that could kill "medic" units in a stack first, but I forget where. I think it was used in Vanilla before invisibility (for subs vs Transports), but I'm not 100% sure.

Also, you could steal the "PromotionOverwrites" (it's a list, don't fear) tag from FF, then make it so the Hero promotion will erase all the promotions you don't want on the unit.
 
Interesting. I had never heard of that, but it is in the vanilla unit schema. None of the vanilla units use it. Are you aware of any mods which use it, so I can try out an example?

Vanilla BtS Khmer UU, the Balista Elefant ;).

But sad, that really only works for combats :(.
I wanted a unit, which could kill the GPs in a stack first, but it doesn't work for units without a combat strength.
 
Oh, UnitCombatTargets is used by siege elephants, UnitClassTargets is unused. It is interesting that both exist. I will think about this, but it still leaves the unpredictable unit strength problem. Maybe that is close enough.
 
You can inflict some damage on dragon depending on slayer ability level before an actual battle starts.
here's a pseudo code:
Code:
BaseSlayerDamagePercent = 0.6;

if (attacker.iSlayer > 0 and defender.isAMonster())
{
	SlayerValue = attacker.iSlayer - defender.GetLevel();
	SlayerFactor = Power(2, -(SlayerValue + Random(say from -0.5 to 0.5)));
	SlayerDamagePercent = Power(BaseSlayerDamagePercent, SlayerFactor);
	defender.SetHPs(defender.GetHPs() * SlayerDamagePercent / 100);
	beginStandardCombat(attacker, defender);
}
an example:
you have a knight with slayer III ability, so his iSlayer value is 3. This knight attacks a dragon of level 2.
SlayerValue = 3 - 2 = 1.
SlayerFactor = 2 ^ - (1 + 0.3 from random) = ~0.41.
SlayerDamagePercent = 0.6 ^ 0.41 = 0.81.

So dragon loses 81% HPs and then a standard battle vs knight starts.
 
Thanks, that is very helpful. With this code, I don't think the combat odds hover help would display anything. If anybody has starting points to affect this, it would be helpful. Maybe in combination with the Unit{Class,Combat}Target feature, I can do what I would like.
 
you could redesign the getPromotionCombatMod tag from FFH which allows to give a Unit with Promotion A a bonus against any unit with Promotion B. You could add two promotion tags, bMonsterPromotion and bHeroPromotion. Every MonsterPromotion gives a 20% bonus against a unit with atleast one HeroPromotion and vice versa. That way a lvl 3 hero (3 hero promotions) would have a 60% bonus against a lvl 2 Monster while the Monster has a 40% bonus against the Hero. Combat odds would also display fine.
 
Top Bottom