How to fix the current problem of bows hitting 100% of the time

I posted this in Heavenfall's bigfix thread, but figured I would post it here too.

Create a file called Whateverthehellyouwant.xml and stick thees lines in there:

Code: xml
  1. <?xml version="1.0" encoding="iso-8859-1"?>
  2. <Spells>
  3.  <DataChecksum NoParse="1">
  4.   <Ignore>DisplayName,Description,IconFG,IconBG,IconColor,SoundFX,ParticleEffect,EffectScale</Ignore>
  5.   <Translate>DisplayName,Description</Translate>
  6.  </DataChecksum>
  7. <SpellDef InternalName="BasicBowAttack">
  8. <GameModifier InternalName="ArrowDamage">
  9. <Calculate InternalName = "MinValue">
  10.   <Expression><![CDATA[[Value]*.2]]></Expression>
  11.    </Calculate>
  12.    <Calculate InternalName = "MaxValue">
  13.      <Expression><![CDATA[[Value]*1]]></Expression>
  14.    </Calculate>
  15.     </GameModifier>
  16. </SpellDef>
  17. </Spells>

 You can mess around with the numbers if you like. It's fairly straigtforward. But this will at least generate a range of damage instead of 100%.

 

4,557 views 8 replies
Reply #1 Top

Thanks. Saves me from messing with it.

Now if we could get armour working right, and change combat from my side goes/your side goes to one of my guys goes/one of your guys goes/repeat, combat might actually be fun again. I hope with Python we can really adjust the flow and parameters used in combat along with other things. B)

Reply #2 Top

do we have to do this for all bows?

 

Reply #3 Top

Quoting EviliroN, reply 2
do we have to do this for all bows?

 
End of EviliroN's quote

 

No.  This is the SpellDef that ALL bows use.  Just fix it in one place.

Reply #4 Top

No, this effects the ranges attack ability (spelldef) that all bows have. Probably need one for the catapults too.

Reply #5 Top

I'm looking at the xml and I'm thinking to myself: there is NO WAY this can work in-game.

Reply #6 Top

I was editing the firebreath ranged attack (there are 3, this one, bows and catapults in RangedAttackSpells.xml)

It was different of the rest of things, whose  code I checked. I needed the base value to be positive or I would miss all the time. Having ValueOwner in multiple clauses, caused the max damage bug (in this case it didn't matter if the value was positive or negative).

Working tested code part for the damage:

Code: xml
  1. <Calculate InternalName = "Value" ValueOwner="CastingUnit">
  2.  <Expression><![CDATA[[UnitStat_Attack]*1]]></Expression>
  3. </Calculate>
  4. <Calculate InternalName = "MinValue">
  5. <Expression><![CDATA[0.5*[Value]]]></Expression>
  6. </Calculate>
  7. <Calculate InternalName = "MaxValue">
  8. <Expression><![CDATA[1*[Value]]]></Expression>
  9. </Calculate>

 

Hope this helps someone.

Reply #7 Top

lol, looks like forum formats smiles inside xml

Reply #8 Top

LOL, I would swear that wasn't there before xDD

bugs in the forum?

 

Her'es the full code that has been tested and works, the partial solution from initial post didn't work for me, although it should. Needed to correct the negative base damage again.

 

Code: xml
  1. <?xml version="1.0" encoding="iso-8859-1"?>
  2. <Spells>
  3. <DataChecksum NoParse="1">
  4. <Ignore>DisplayName,Description,IconFG,IconBG,IconColor,SoundFX,ParticleEffect,EffectScale</Ignore>
  5. <Translate>DisplayName,Description</Translate>
  6. </DataChecksum>
  7. <SpellDef InternalName="BasicBowAttack">
  8. <DisplayName>Bow Attack</DisplayName>
  9. <Description>Attack a unit from a distance with a single arrow from your bow.</Description>
  10. <Image>Action_BowArrow.png</Image>
  11. <IconFG>Action_BowArrow.png</IconFG>
  12. <IconBG>Action_BowArrow.png</IconBG>
  13. <IconColor>255,255,255</IconColor>
  14. <Range>2.0</Range>
  15. <ManaCost>0</ManaCost>
  16. <MoveCost>10</MoveCost>
  17. <SpellType>Strategic</SpellType>
  18. <SpellClass>Offensive</SpellClass>
  19. <IsRangedAttack>1</IsRangedAttack>
  20. <SpellTargetType>EnemyUnit</SpellTargetType>
  21. <ValidTerrainCategory>Land</ValidTerrainCategory>
  22. <ValidTerrainCategory>Beach</ValidTerrainCategory>
  23. <ValidTerrainCategory>Forest</ValidTerrainCategory>
  24. <ValidTerrainCategory>City</ValidTerrainCategory>
  25. <ValidTerrainCategory>Water</ValidTerrainCategory>
  26. <ValidTerrainCategory>Cliff</ValidTerrainCategory>
  27. <ValidTerrainCategory>Mountain</ValidTerrainCategory>
  28. <GameModifier InternalName="ArrowDamage">
  29. <ModType>Unit</ModType>
  30. <Attribute>DefendableDamage</Attribute>
  31. <!-- Use the unit's attack stat to determine damage done by the arrow -->
  32. <Calculate InternalName = "Value" ValueOwner="CastingUnit">
  33. <Expression><![CDATA[[UnitStat_Attack]*1]]></Expression>
  34. </Calculate>
  35. <Calculate InternalName = "MinValue">
  36. <Expression><![CDATA[[Value]*.2]]></Expression>
  37. </Calculate>
  38. <Calculate InternalName = "MaxValue">
  39. <Expression><![CDATA[[Value]*1]]></Expression>
  40. </Calculate>
  41. </GameModifier>
  42. <SpellCastEffectName>Arrow</SpellCastEffectName>
  43. <SpellCastEffectScale>0.50</SpellCastEffectScale>
  44. <SpellCastProjectile>1</SpellCastProjectile>
  45. <SpellCastProjectileSpeed>750</SpellCastProjectileSpeed>
  46. <SoundFX>Hit_Arrow1</SoundFX>
  47. <SoundFX>Hit_Arrow2</SoundFX>
  48. </SpellDef>
  49. </Spells>