Unit Ability: Elusive

The place to post your WML questions and answers.

Moderators: Forum Moderators, Developers

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
Ultimatum479
Posts: 188
Joined: March 31st, 2007, 3:53 pm
Location: The Void, usually.

Unit Ability: Elusive

Post by Ultimatum479 »

I'm trying to make an ability which halves an opponent's chance to hit while the unit is defending. I'd tell you how far I've gotten so far and ask if you have any idea what I'm doing wrong, but so far there's nothing I've tried which I didn't already know would fail miserably. Do I have to do a trick with Events? I s'pose I could make an event which stores the unit's side as a variable and halves his chance-to-be-hit when that side's turn ends while doubling it again when that side's turn begins, but that's a messy last resort. Any other suggestions?
Chosen to be: Avatar of the God of Vengeance

Duty-bound to be: Last chance for the oppressed non-humans of the world

Accidentally became: Co-founder of the Council of Linac Mux

Self-nominated (pending election): Forum SUPERMOD!

User avatar
zookeeper
WML Wizard
Posts: 9741
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

Wow, I'm surprised. This actually works:

Code: Select all

		[chance_to_hit]
			id=elusive
			name= _ "elusive"
			description= _ "Elusive:
When attacking or retaliating using this attack, the enemy always has only half the normal chance to hit."
			multiply=0.5
			apply_to=opponent
		[/chance_to_hit]
I didn't test how it interacts with magical or marksman.

Ultimatum479
Posts: 188
Joined: March 31st, 2007, 3:53 pm
Location: The Void, usually.

Post by Ultimatum479 »

...

*feels stupid*

Thanks. Testing it out now.
Chosen to be: Avatar of the God of Vengeance

Duty-bound to be: Last chance for the oppressed non-humans of the world

Accidentally became: Co-founder of the Council of Linac Mux

Self-nominated (pending election): Forum SUPERMOD!

User avatar
zookeeper
WML Wizard
Posts: 9741
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

Added some actual documentation about some of these undocumented keys: http://www.wesnoth.org/mw/index.php?tit ... rcid=13548.

Ultimatum479
Posts: 188
Joined: March 31st, 2007, 3:53 pm
Location: The Void, usually.

Post by Ultimatum479 »

Sweet. Thanks again. It does work indeed.

Here's the ability in its final form, in case anyone else wants to use it. It's pretty overpowered, though, but I'm sure one could find a balanced use for it for some units which are weak enough in other aspects.

Code: Select all

#define ABILITY_ELUSIVE
	[chance_to_hit] 
		id=elusive 
		name= _ "elusive" 
		description= _ "Elusive: 
Attackers have only half the usual chance to hit this unit."
		multiply=0.5 
		apply_to=opponent
		active_on=defense
	[/chance_to_hit]
#enddef
Chosen to be: Avatar of the God of Vengeance

Duty-bound to be: Last chance for the oppressed non-humans of the world

Accidentally became: Co-founder of the Council of Linac Mux

Self-nominated (pending election): Forum SUPERMOD!

Ultimatum479
Posts: 188
Joined: March 31st, 2007, 3:53 pm
Location: The Void, usually.

Post by Ultimatum479 »

Meh. I didn't edit a thing since that last post, and suddenly, when I re-opened Wesnoth, Elusive stopped working. ¿Por qué?
Chosen to be: Avatar of the God of Vengeance

Duty-bound to be: Last chance for the oppressed non-humans of the world

Accidentally became: Co-founder of the Council of Linac Mux

Self-nominated (pending election): Forum SUPERMOD!

User avatar
Noyga
Inactive Developer
Posts: 1790
Joined: September 26th, 2005, 5:56 pm
Location: France

Post by Noyga »

The problem would be to guess what would happen if an elusive unit is attcked by a unit with the marksman or magical special...
"Ooh, man, my mage had a 30% chance to miss, but he still managed to hit! Awesome!" ;) -- xtifr

User avatar
zookeeper
WML Wizard
Posts: 9741
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

Ultimatum479 wrote:Meh. I didn't edit a thing since that last post, and suddenly, when I re-opened Wesnoth, Elusive stopped working. ¿Por qué?
Did you try to use it as an ability, instead of a weapon special (your macro naming and the description would imply this)?

Ultimatum479
Posts: 188
Joined: March 31st, 2007, 3:53 pm
Location: The Void, usually.

Post by Ultimatum479 »

zookeeper wrote:Did you try to use it as an ability, instead of a weapon special (your macro naming and the description would imply this)?
...Aha. That's why I didn't think of your idea earlier: I wanted to make an ability, not a weapon special. Meh. The weapon special will work if necessary, but I'd really like it to be an ability. Any ideas on how I can do that?

I've pretty much got the aforementioned last-resort event trigger coded.
Chosen to be: Avatar of the God of Vengeance

Duty-bound to be: Last chance for the oppressed non-humans of the world

Accidentally became: Co-founder of the Council of Linac Mux

Self-nominated (pending election): Forum SUPERMOD!

User avatar
zookeeper
WML Wizard
Posts: 9741
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

Ultimatum479 wrote:
zookeeper wrote:Did you try to use it as an ability, instead of a weapon special (your macro naming and the description would imply this)?
...Aha. That's why I didn't think of your idea earlier: I wanted to make an ability, not a weapon special. Meh. The weapon special will work if necessary, but I'd really like it to be an ability. Any ideas on how I can do that?
Well, if your unit has both a ranged and a melee attack, then you just give both attacks this special. Make the specials be invisible in-game and write an ability that just provides the description, so it looks like it's the ability and not the specials that provide the effect. If the unit doesn't have both a ranged and a melee attack, then I don't really see how you'd do it without resorting to [event] trickery, with which it probably would indeed be possible.

Ultimatum479
Posts: 188
Joined: March 31st, 2007, 3:53 pm
Location: The Void, usually.

Post by Ultimatum479 »

Ah. Should work. I was debating that earlier, but wasn't sure how to make 'em invisible. Now I just realized it. :P Thanks.
Chosen to be: Avatar of the God of Vengeance

Duty-bound to be: Last chance for the oppressed non-humans of the world

Accidentally became: Co-founder of the Council of Linac Mux

Self-nominated (pending election): Forum SUPERMOD!

ced_ne
Posts: 46
Joined: September 18th, 2006, 2:38 am
Location: France

Post by ced_ne »

I have already done it :
Shocktroopers in my scenarii have a ranged attack of 1-0 (wesnoth want at least 1 damage per strike) named (and iconified) Tower Shield. With number of strike = 0 this shocktroopers don't attack but have a weapon special named "Tower Shield Ranged" that cut by 2 the chance to hit of an opponent ranged attack.

It works well.
The only things is that you can stupidly choose the tower shield attack, which does nothing except forcing an opponent to use his ranged attack against you :)
attack_weight=0 must be insert in [attack], preventing AI controller doing this stupid things.
-- please don't blame me about my bad english spoken ! --

Post Reply