a couple of [chance_to_hit] questions

The place to post your WML questions and answers.

Moderator: Forum Moderators

Forum rules
  • Please use [code] BBCode tags in your posts for embedding WML snippets.
  • To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Post Reply
deoxy
Posts: 208
Joined: May 16th, 2007, 5:22 pm
Location: Texas

a couple of [chance_to_hit] questions

Post by deoxy »

1. Based on the way Marskman and Magic are implemented, it would appear that "cumulative" in [chance_to_hit] works a little different than one might think - that is, a [chance_to_hit] that is "cumulative" overlaps with the existing chance to hit, so that Marskman is the better of normal chance to hit or 60%.

I had an idea to create a weapon special, "Skillful" - your chance to hit is improved by 10%.

So, if the unit you are attacking has 70% defense, you would have a 40% chance to hit, and if they have a 20% defense, you would have a 90% chance to hit, etc.

Is there any way to implement this in WML right now?

2. Affecting the opponent's chance to hit.

Let's say I wanted to make a weapon special "take cover" - a ranged "attack" that does no damage, but makes you harder to hit with ranged attacks (for example, it drops your opponent's chance to hit). How would this interact with "Magic" or "Marksmen" (or custom abilities of that type)?
Insert nifty witticism here... if only I had one.
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

deoxy wrote:1.
Hmmh...instead of value=60 (or whatever), try add=10 (with both values for cumulative=, I don't know which you should use). I just glanced at the weapon specials code, and it looks like there's an add= key available in addition to value= and multiply=, but looks like it's undocumented. If you'd try this and report back on whether it works, it'd be nice.
deoxy wrote:2.
Hard to say. Try it?
toni
Posts: 42
Joined: April 13th, 2007, 7:28 pm
Location: berlin, germany

Post by toni »

is it possible to hit with 100%?? i think it should, because it's the chance to hit.
aka mysticspiral
deoxy
Posts: 208
Joined: May 16th, 2007, 5:22 pm
Location: Texas

Post by deoxy »

zookeeper wrote:1. Hmmh...instead of value=60 (or whatever), try add=10 (with both values for cumulative=, I don't know which you should use). I just glanced at the weapon specials code, and it looks like there's an add= key available in addition to value= and multiply=, but looks like it's undocumented. If you'd try this and report back on whether it works, it'd be nice.
Thanks! (Yes, I do try to check the documentation fairly well before I ask this stuff.) I'll give it a shot.
zookeeper wrote:2. Hard to say. Try it?
Well, "try it" is a bit hard, since

small amount of change + randomness = hard to know what exactly happened

I've had 18 attacks in a row miss a surrounded 70% unit before (3 attacks per surrounding unit), so judging the actually chances from game results is definitely not as easy as it might sound.

I guess I could set up some fairly extreme situations and run them multiple times... someone who actually knows how it works would be better, though.

Thanks for the quick response! I'll try out that first thing later today (if I get time).
Insert nifty witticism here... if only I had one.
Post Reply