Laststrike

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
colten
Posts: 3
Joined: January 20th, 2012, 6:45 am

Laststrike

Post by colten »

I am trying to create a weapon that will always strike last in combat. I've tried the following and it has no effect. Can anyone point out my mistake or suggest another way of doing this?

Code: Select all

	#define WEAPON_SPECIAL_LASTSTRIKE
		[firststrike]
			id=laststrike
			name= _ "last strike"
			description= _ "This unit always strikes last with this attack, even if they are attacking."
			apply_to=opponent
		[/firststrike]
	#enddef
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: Laststrike

Post by zookeeper »

Seems to work just fine for me. It only strikes first when attacking another unit with laststrike, which is something you can probably solve somehow with [filter_attacker/defender] [filter_weapon].
User avatar
Eagle_11
Posts: 759
Joined: November 20th, 2013, 12:20 pm

Re: Laststrike

Post by Eagle_11 »

By default the attacker hits first, unless defender has first strike, then defender hits first.
colten
Posts: 3
Joined: January 20th, 2012, 6:45 am

Re: Laststrike

Post by colten »

Thanks Zookeeper. If that code works for you, then I must have a bug somewhere else. I'll go back and debug the rest and at least I'll know that this part works.
User avatar
WhiteWolf
Forum Moderator
Posts: 769
Joined: September 22nd, 2009, 7:48 pm
Location: Hungary

Re: Laststrike

Post by WhiteWolf »

Sorry if you solved this already, but I interpret your question in a bit different way.
By last strike do you mean to achieve that the absolute last strike will belong to this unit? Let's say this unit tries 3 times, the enemy 6 times, but this unit will always get a last revenge hit at the end?
[firststrike] won't get you there. Your code achieves that at the start of the combat, always the enemy hits first. If you want to do something like I described, you'll need to do it in [even] name=attacker/defender hits events.
Main UMC campaigns: The Ravagers - now for 1.16, with new bugs!
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
Post Reply