Scenario Editor - Ranged damage

Started by kolt16, January 04, 2018, 08:31:44 AM

Previous topic - Next topic

kolt16

So my question is. does anybody know of a way to change all damage values together. It looks like there are at least 4 or 5 stat values adjusting melee damage and not a single one of them effects firearms. (tried blunt and sharp as well, nothing. I was hoping bullets would just count as sharp.)

Is there maybe a way to manually add the bullet parameter, <damageAmountBase> as a modifier to a scenario?

I'd like to make combat a bit faster, but it's a real pain to change all values by hand for tons of mods, on by one.

Shurp

You could reduce the hit points of the pawns and their body parts.

(admittedly that could make animals even more dangerous)
If you give an annoying colonist a parka before banishing him to the ice sheet you'll only get a -3 penalty instead of -5.

And don't forget that the pirates chasing a refugee are often better recruits than the refugee is.

kolt16

I tried that. But the hit points value seems to reduce mainly structure hitpoints whitch is a pain. I could see no indication of it affecting pawns.

Editing them manually could work, but it's probably the same story as edidting guns. Allthough maybe esayer to balance right.

Dashthechinchilla

Firearms do sharp damage. They can be used as a blunt weapon at touch range. I think the damage value is stored in the weapon, not in the types.

kolt16

#4
The blunt and sharp damage in stats are unfortunately also melee weapon specific, does not affect bullet damage. (I also tested this with a new unmoded game, guns deal exactly the damage specified on the bullet) disregarding any multiplier on sharp damage, or anything else for that matter.

<ThingDef ParentName="BaseBullet">
    <defName>Bullet_Revolver</defName>
    <label>revolver bullet</label>
    <graphicData>
      <texPath>Things/Projectile/Bullet_Small</texPath>
      <graphicClass>Graphic_Single</graphicClass>
    </graphicData>
    <projectile>
      <flyOverhead>false</flyOverhead>
      <damageDef>Bullet</damageDef>
      <damageAmountBase>11</damageAmountBase>
      <speed>55</speed>
    </projectile>
  </ThingDef>



Pain threshold kindoff works, but there is no more damage done just shorter shootouts.

For melee, "melee damage multiplier", and "melee DPS" seems to work fine together. Later is necessary for animals and unarmed combat in general.


I wonder if it would be somehow possible to define a new stat for projectiles. Are stats hardcoded? I can see the list of them in xml, but don't know how they are referenced, or how is their functionality is defined.

Scrabbling

Quote from: kolt16 on January 05, 2018, 03:20:35 AM
I wonder if it would be somehow possible to define a new stat for projectiles. Are stats hardcoded? I can see the list of them in xml, but don't know how they are referenced, or how is their functionality is defined.

As far as I can "read" the code: Stats themselves are not hardcoded. There is just a StatDef.cs which defines the possible attributes of a stat. The problem is that there is a lot of functionality attached to stats. More complex stats have a corresponding StatWorker_<name>.cs where the calculations happen. But that is not strictly necessary, MeleeWeapon_DamageMultiplier for example has no StatWorker (but uses the existing classes StatPart_Quality.cs and StatPart_Health.cs) . But there is an obvious difference whenever a stat value gets called in comparison to a "normal" attribute.

Random examples:
ownerEquipment.GetStatValue(StatDefOf.MeleeWeapon_DamageMultiplier, true);
versus
int damageAmountBase = this.def.projectile.damageAmountBase;

So my conclusion is: If you want damageAmountBase to be tied to a stat (and if it is has a StatDef you could indeed modify it in a scenario) you not only have to add it via xml but modify (patch) all references in the code to use GetStatValue() or GetStatValueAbstract().

There are some weapon stats like SharpDamageMultiplier (defined in Stats_Weapons_Melee.xml) that aren't referenced directly in the code at all. (Except being listed in StatDefOf.cs. "Find all" in "entire solution" returns nothing else.) and those stats work (Tried a scenario with Sharp Damage set to 500% and the Plasteel Knife indeed states 44.5 DPS and in the detailed view on the right cutting and piercing damage are increased). So I had a look how this works: The stat "SharpDamageMultiplier" is set as attribute "multStat" for "Sharp" in DamageArmorCategoryDefs.xml. This is then used in C# in StatWorker_MeleeDamageAmount.cs where the damage category (blunt, sharp etc.) is checked and the damage is then multiplied by "req.StuffDef.GetStatValueAbstract(statDef, null)"  where statDef is "this.CategoryOfDamage(def).multStat" which is in case of sharp damage the SharpDamageMultiplier. So sadly again, no easy xml only way to create a new stat and have it do anything at all.


malloc

If you just want shorter battles, what about giving a 100% chance to Wimp trait so everybody gets one/two-hit downed?

kolt16

@Scrabbling thanks for looking. I'll think about it if i want to go this far to solve this. With my feable porgraming skills, it might be easier to just find or hack up some phraser that searches and rewrites damage values in the xmls directly, if manul editing becomes such a pain that I have the incentive to do something like this.. :D


Wimp triat probably modifies the pain threshold, and there is a stat for that. So I can play around with that one on the fly.