Anti-marksman

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
User avatar
drachefly
Posts: 308
Joined: March 23rd, 2005, 6:01 pm
Location: Philadelphia, PA

Anti-marksman

Post by drachefly »

I wanted to make a 'flailing' weapon special, that was like anti-marksman. No matter how bad at dodging the target is, hit rate never gets above 50%.

I couldn't work out how to do this, so provisionally I set it to always hit at 40%, but that's not what I had in mind. The AbilitiesWML wiki page is more than a little murky on the interaction of the value, add, multiply, and cumulative key-value pairs.

Is there a way to do this?

Alternately, what if I merely wanted to average the hit rate with 40%? Would I use multiply=0.5 and add=40% keys-value pair in the same [chance_to_hit] tag, or should I put them in separate [chance_to_hit] tags, and if so, does order matter?
What saves a man is to take a step. Then another step. It is always the same step, but you have to take it. -- You-know-who
The Kingdom Of Loathing Era
User avatar
Astoria
Inactive Developer
Posts: 1007
Joined: March 20th, 2008, 5:54 pm
Location: Netherlands

Re: Anti-marksman

Post by Astoria »

Code: Select all

    [dummy]
        id=anti-marksman
        name= _ "anti-marksman"
        description= _ "Anti-Marksman:
When used offensively, this attack always has at least a 0% chance to hit."
[/dummy]
[event]
name=attack
[filter_attack]
special="anti-marksman"
[/filter_attack]
[if]
[filter_second]
defence=60
[/filter_second]
[or]
[filter_second]
defence=70
[/filter_second]
[/or]
[then]
[store_unit]
[filter_attack]
special=anti-marksman
[/filter_attack]
kill=no
variable=anti-marksman
[/store_unit]
{FORCE_CHANCE_TO_HIT anti-marksman.id "[not]side=anti-marksman.side[/not]" 50}
[/then]
[/if]
[/event]
I think this will work.
Formerly known as the creator of Era of Chaos and maintainer of The Aragwaithi and the Era of Myths.
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: Anti-marksman

Post by zookeeper »

LightFighter wrote:

Code: Select all

    [dummy]
        id=anti-marksman
        name= _ "anti-marksman"
        description= _ "Anti-Marksman:
When used offensively, this attack always has at least a 0% chance to hit."
[/dummy]
[event]
name=attack
[filter_attack]
special="anti-marksman"
[/filter_attack]
[if]
[filter_second]
defence=60
[/filter_second]
[or]
[filter_second]
defence=70
[/filter_second]
[/or]
[then]
[store_unit]
[filter_attack]
special=anti-marksman
[/filter_attack]
kill=no
variable=anti-marksman
[/store_unit]
{FORCE_CHANCE_TO_HIT anti-marksman.id "[not]side=anti-marksman.side[/not]" 50}
[/then]
[/if]
[/event]
I think this will work.
No, that will not work. That's pretty much complete nonsense.
User avatar
drachefly
Posts: 308
Joined: March 23rd, 2005, 6:01 pm
Location: Philadelphia, PA

Re: Anti-marksman

Post by drachefly »

Are there no ideas on this? I would like not to have flailing just be 'lousy magical' if I can avoid it.
What saves a man is to take a step. Then another step. It is always the same step, but you have to take it. -- You-know-who
The Kingdom Of Loathing Era
fog_of_gold
Posts: 637
Joined: December 20th, 2009, 5:59 pm
Location: Germany

Re: Anti-marksman

Post by fog_of_gold »

drachefly wrote:Alternately, what if I merely wanted to average the hit rate with 40%? Would I use multiply=0.5 and add=40% keys-value pair in the same [chance_to_hit] tag, or should I put them in separate [chance_to_hit] tags, and if so, does order matter?
Order doesn't matter, as far as I tested (only in [set_variables], but I think, it's all the same), the order of calculate is the following(I haven't beta):
1. value
2. add
3. multiply
4. divide
So if you want to include the formula this_chance_to_hit=normal_chance_to_hit*50%+40%, you'll need to make something like this:

Code: Select all

[chance_to_hit]
        add=80%
        multiply=0.5
[/chance_to_hit]
But you said, that you want to get the chance more near to 40% and your formula, if I understood right, will give you at least 40%. If you have 0% chance to hit, you'll have (0/2+40)%=40% to hit. To get the chance more near to 40%, you should use this:

Code: Select all

[chance_to_hit]
        add=40%
        multiply=0.5
[/chance_to_hit]
User avatar
drachefly
Posts: 308
Joined: March 23rd, 2005, 6:01 pm
Location: Philadelphia, PA

Re: Anti-marksman

Post by drachefly »

Thanks!
What saves a man is to take a step. Then another step. It is always the same step, but you have to take it. -- You-know-who
The Kingdom Of Loathing Era
Post Reply