Chance to hit
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.
Chance to hit
Is there a way to modify the units chance to hit? Kinda like magical, but it only adds a boost and doesn't set it to 70%
I speak what's on my mind.
Which is why nothing I say makes sense.
Which is why nothing I say makes sense.
- Elvish_Pillager
- Posts: 8137
- Joined: May 28th, 2004, 10:21 am
- Location: Everywhere you think, nowhere you can possibly imagine.
- Contact:
There is no way to do this inside a unit definition. However, you can, by complex and incredibly inconvenient WML, not to mention that it will not display properly, do it in a scenario.
It's all fun and games until someone loses a lawsuit. Oh, and by the way, sending me private messages won't work. :/ If you must contact me, there's an e-mail address listed on the website in my profile.
You can add specials to an existing attack:
http://wesnoth.slack.it/?EffectWML
Effects are granted through objects, so you can grant an invisible object to a unit that causes the effect:
http://wesnoth.slack.it/?DirectActionsWML
Let's see here...
Not too sure if this would do the trick, but it's a starting point. I don't know under what conditions you want to change the CTH. There are examples in httt for giving objects to units.
http://wesnoth.slack.it/?EffectWML
Effects are granted through objects, so you can grant an invisible object to a unit that causes the effect:
http://wesnoth.slack.it/?DirectActionsWML
Let's see here...
Code: Select all
[event]
name=turn 2
[object]
[filter]
description=Jo Mama
[/filter]
[effect]
apply_to=attack
range=short
set_special=magical
[/effect]
duration=level
silent=yes
[/object]
[/event]
Hope springs eternal.
Wesnoth acronym guide.
Wesnoth acronym guide.
- Elvish_Pillager
- Posts: 8137
- Joined: May 28th, 2004, 10:21 am
- Location: Everywhere you think, nowhere you can possibly imagine.
- Contact:
Code: Select all
[event]
name=attack
[store_unit]
[filter]
x=$x2
y=$y2
[/filter]
variable=victim
[/store_unit]
[if]
[variable]
name=victim.variables.old_type
not_equals=none
[/variable]
[then]
{VARIABLE_OP victim.type to_variable victim.variables.old_type}
{VARIABLE victim.variables.old_type none}
[unstore_unit]
variable=victim
[/unstore_unit]
[/then]
[/if]
[/event]
[event]
name=attack
[filter]
description=bonused_unit
[/filter]
[store_unit]
[filter]
x=$x2
y=$y2
[/filter]
variable=victim
[/store_unit]
{VARIABLE_OP victim.variables.old_type to_variable victim.type}
{VARIABLE_OP victim.type format ($victim.type| with less defense)}
[unstore_unit]
variable=victim
[/unstore_unit]
[/event]
It's all fun and games until someone loses a lawsuit. Oh, and by the way, sending me private messages won't work. :/ If you must contact me, there's an e-mail address listed on the website in my profile.