Berserk-like leadership

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.
Elmor
Posts: 152
Joined: May 5th, 2010, 8:19 am

Berserk-like leadership

Post by Elmor »

hi, is there any way to make unit gives berserk ability to adjacent allies?
User avatar
Sapient
Inactive Developer
Posts: 4453
Joined: November 26th, 2005, 7:41 am
Contact:

Re: Berserk-like leadership

Post by Sapient »

Yes, have a look at the "Initiative" WML Ability example on the wiki.

http://wiki.wesnoth.org/WML_Abilities#Initiative
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
Elmor
Posts: 152
Joined: May 5th, 2010, 8:19 am

Re: Berserk-like leadership

Post by Elmor »

cant get, what is {TYPE}, it some kind of variable for ability or unit?
sorry for such questions
Ceres
Forum Regular
Posts: 620
Joined: September 18th, 2010, 7:56 pm
Location: Germany

Re: Berserk-like leadership

Post by Ceres »

In the example, the firststrike ability would be given to all units adjacent to an allied or own unit of type {TYPE}, as I understand it.
Elmor
Posts: 152
Joined: May 5th, 2010, 8:19 am

Re: Berserk-like leadership

Post by Elmor »

so inside must be unit which grants ability
it must be id or what?
monochromatic
Posts: 1549
Joined: June 18th, 2009, 1:45 am

Re: Berserk-like leadership

Post by monochromatic »

Ids of the unit types you want to be affected, specifically. You can remove that if you want.
User avatar
drachefly
Posts: 308
Joined: March 23rd, 2005, 6:01 pm
Location: Philadelphia, PA

Re: Berserk-like leadership

Post by drachefly »

Huh. This got me thinking that if the Mage of Light still violates RIPLIB, it could avoid that by instead giving neighboring allies fearless, at night (so it doesn't help chaotic allies in the daytime). That'd be weaker than it is with lawful allies at dusk, but it'd be much better against lawful enemies and with chaotic allies.
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
ChaosRider
Posts: 846
Joined: April 15th, 2012, 1:15 pm

Re: Berserk-like leadership

Post by ChaosRider »

Once i try to make leadership berserk ability but its not work : (, is anyone could tell me why its not work :D ? I dont prefer to make it work for only some unit types,i tried to do it work for all not enemies units "type=...". This Initiative aura dont work without this type in filter (i checked only this option :P)

Code: Select all

#define ABILITY_BERSERK_LEADERSHIP
    [dummy]
        id=berserk leadership
        name= _ "fanaticism berserk aura"
        female_name= _ "female^fanaticism berserk aura"
        description=_ "Fanaticism beserk aura:
This unit can inspire adjacent units to attack with the fury frenzy when in melee combat."
    [/dummy]
[/abilities]
	[event]
		name=attack
		first_time_only=no

		[filter]
			[filter_adjacent]
				adjacent=n,ne,se,s,sw,nw
				is_enemy=no
			[/filter_adjacent]
		[/filter]
		
		{FOREACH unit.attack i}
			{VARIABLE unit.attack[$i].specials.berserk.id "berserk"}
		{NEXT i}
		
		[unstore_unit]
			variable=unit
		[/unstore_unit]
	[/event]
	[event]
		name=attack
		first_time_only=no

		[filter_second]
			[filter_adjacent]
				adjacent=n,ne,se,s,sw,nw
				is_enemy=no
			[/filter_adjacent]
		[/filter_second]
		
		{FOREACH second_unit.attack i}
			{VARIABLE second_unit.attack[$i].specials.berserk.id "berserk"}
		{NEXT i}
		
		[unstore_unit]
			variable=second_unit
		[/unstore_unit]
	[/event]
	[event]
		name=attack_end
		first_time_only=no

		[filter]
			[wml_filter]
				[attack]
					[specials]
						[berserk]
							id=berserk
						[/berserk]
					[/specials]
				[/attack]
			[/wml_filter]
		[/filter]
		
		{FOREACH unit.attack i}
			{CLEAR_VARIABLE unit.attack[$i].specials.berserk}
		{NEXT i}
		
		[unstore_unit]
			variable=unit
		[/unstore_unit]
	[/event]
	[event]
		name=attack_end
		first_time_only=no

		[filter_second]
			[wml_filter]
				[attack]
					[specials]
						[berserk]
							id=berserk
						[/berserk]
					[/specials]
				[/attack]
			[/wml_filter]
		[/filter_second]
		
		{FOREACH second_unit.attack i}
			{CLEAR_VARIABLE second_unit.attack[$i].specials.berserk}
		{NEXT i}
		
		[unstore_unit]
			variable=second_unit
		[/unstore_unit]
	[/event]
[+abilities]
#enddef
Creator of WOTG (+2880 units), MWC (+615 units), SurvivorsArea, RandomColosseum, RC WOTG, RC MWC, ColosseumRandomClonesBattle, BetweenDarknessAndLight, StealingWeapons, MoreUnitsForms, MoreDamageTypes, CanBeOnlyOne, ColosseumOneWinner, BonusSpam, CriticalStrike - available at 1.12 Wesnoth server.
User avatar
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: Berserk-like leadership

Post by Dugi »

What is [wml_filter] supposed to do?
Where did you set the value of the berserk you're adding?
Do you realise that all units that aren't enemies can pass the filter?

Even if you manage to code this, there will be no warning about berserk, and the attack calculations will be wrong. I have found a more elegant way to do it, though it has an inconvenience that it will need extra work to affect mainline units.

And please, learn how to debug your damned codes, you are still making beginner errors, even if you have created far more add-ons than me. I pity the players who have downloaded them.
User avatar
ChaosRider
Posts: 846
Joined: April 15th, 2012, 1:15 pm

Re: Berserk-like leadership

Post by ChaosRider »

This other way dont work :P. Did you check this code in game ?
Creator of WOTG (+2880 units), MWC (+615 units), SurvivorsArea, RandomColosseum, RC WOTG, RC MWC, ColosseumRandomClonesBattle, BetweenDarknessAndLight, StealingWeapons, MoreUnitsForms, MoreDamageTypes, CanBeOnlyOne, ColosseumOneWinner, BonusSpam, CriticalStrike - available at 1.12 Wesnoth server.
User avatar
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: Berserk-like leadership

Post by Dugi »

I did it it worked. You must have used it wrongly, probably forgotten to use the special [berserk] tag in [specials] of all units to be affected, that is the limiting factor of the approach. But your code will work too, if you fix its bugs.
User avatar
ChaosRider
Posts: 846
Joined: April 15th, 2012, 1:15 pm

Re: Berserk-like leadership

Post by ChaosRider »

I've got both this codes (one for 30 rounds (as normal berserk) and one for 5 rounds):

Code: Select all



#define ABILITY_FURY_LEADERSHIP
    [dummy]
        id=fury leadership
        name= _ "fanaticism fury aura"
        female_name= _ "female^fanaticism fury aura"
        description=_ "Fanaticism fury aura:
This unit can inspire adjacent units to attack with the fury frenzy when in melee combat."
    [/dummy]
#enddef






#define WEAPON_SPECIAL_LATENT_FURY
    [berserk]
        id=fury forced
        name= _ "fury"
        description= _ "Fury:
Whether used offensively or defensively, this attack presses the engagement until one of the combatants is slain, or 5 rounds of attacks have occurred."
        value=5
   active_on=offense
   [filter_self]
		[filter_adjacent]
            ability=fury leadership
        [/filter_adjacent]
   [/filter_self]
    [/berserk]
#enddef







#define ABILITY_BERSERK_LEADERSHIP
    [dummy]
        id=berserk leadership
        name= _ "fanaticism aura"
        female_name= _ "female^fanaticism aura"
        description=_ "Fanaticism aura:
This unit can inspire adjacent dwarves to attack with the berserker frenzy when in melee combat."
    [/dummy]
#enddef






#define WEAPON_SPECIAL_LATENT_BERSERK
    [berserk]
        id=berserk forced
        name= _ "berserk"
        description= _ "Berserk:
Whether used offensively or defensively, this attack presses the engagement until one of the combatants is slain, or 30 rounds of attacks have occurred."
        value=30
		active_on=offense
		[filter_self]
			[filter_adjacent]
				ability=berserk leadership
			[/filter_adjacent]
		[/filter_self]
    [/berserk]
#enddef
They are in file abilities.cfg, as all other abilities used in WOTG and its not works for units with these leaderships :P.
Creator of WOTG (+2880 units), MWC (+615 units), SurvivorsArea, RandomColosseum, RC WOTG, RC MWC, ColosseumRandomClonesBattle, BetweenDarknessAndLight, StealingWeapons, MoreUnitsForms, MoreDamageTypes, CanBeOnlyOne, ColosseumOneWinner, BonusSpam, CriticalStrike - available at 1.12 Wesnoth server.
User avatar
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: Berserk-like leadership

Post by Dugi »

It doesn't matter at all where they are (it would cause a crash if you used them properly, but placed the macro definition improperly), the macro for the weapon special latent berserk and latent fury have to be used inside the specials tags of all units that have to be affected.
Spoiler:
User avatar
ChaosRider
Posts: 846
Joined: April 15th, 2012, 1:15 pm

Re: Berserk-like leadership

Post by ChaosRider »

Do you have some addon in which is used this your abilitie (i wish to see how it works in game)? Cause this code picked from this http://forums.wesnoth.org/viewtopic.php ... s&start=16 its not working...
__________________________________________________________________________________________________________________________
I made it by my own way (event which have to be used in scenario or era - it works :D)...

Code: Select all

	[event]
		name=attack
		first_time_only=no
		[store_unit]
			[filter]
				[filter_adjacent]
					ability=berserk leadership
					is_enemy=no
				[/filter_adjacent]
			[/filter]
			kill=no
			variable=berserkleadershipunits
		[/store_unit]
		{FOREACH berserkleadershipunits i}
		[object]
			silent=yes
			[filter]
				id=$berserkleadershipunits[$i].id
			[/filter]
			[effect]
				apply_to=attack
				range=melee
				[set_specials]
					mode=append
					{WEAPON_SPECIAL_LATENT_BERSERK}
				[/set_specials]
			[/effect]
		[/object]
		{NEXT i}
		{CLEAR_VARIABLE berserkleadershipunits}
	[/event]
	[event]
		name=attack end
		first_time_only=no
		[store_unit]
			[filter]
				[filter_adjacent]
					ability=berserk leadership
					is_enemy=no
				[/filter_adjacent]
			[/filter]
			kill=no
			variable=berserkleadershipunits
		[/store_unit]
		{FOREACH berserkleadershipunits i}
		[object]
			silent=yes
			[filter]
				id=$berserkleadershipunits[$i].id
			[/filter]
			[effect]
				apply_to=attack
				range=melee
				[remove_specials]
					mode=append
					{WEAPON_SPECIAL_LATENT_BERSERK}
				[/remove_specials]
			[/effect]
		[/object]
		{NEXT i}
		{CLEAR_VARIABLE berserkleadershipunits}
	[/event]
Creator of WOTG (+2880 units), MWC (+615 units), SurvivorsArea, RandomColosseum, RC WOTG, RC MWC, ColosseumRandomClonesBattle, BetweenDarknessAndLight, StealingWeapons, MoreUnitsForms, MoreDamageTypes, CanBeOnlyOne, ColosseumOneWinner, BonusSpam, CriticalStrike - available at 1.12 Wesnoth server.
User avatar
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: Berserk-like leadership

Post by Dugi »

Yeah, I used it over a year ago in RPG AMLA Era's port for 1.10 (that was quite a success on 1.8, but on 1.10, its time was already over, or maybe I added bad extra features, no idea). Its derivative is also used in Legend of the Invincibles, but it's not something I'd call 'a good example'.
Post Reply