Hit and Run multiplying itself on lvl-up
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.
Hit and Run multiplying itself on lvl-up
So i just noticed this bug, obviously i missed something vital.
Bug: If unit with the ability gets killing blow to level up on offense, then the amount of moves given by the ability is multiplied by itself for all units on same side with the ability. This unwanted multiplication occurs everytime unit lvls up.
Example: Unit has the ability, gains 2 moves back, after leveling up to its next lvl, its 4 for all units with the ability. Upon L3 gains all 6 moves back and i have overpowered Thief/Rogue/Assassins darting overall the place, now that was unintended.
Related ability:
Bug: If unit with the ability gets killing blow to level up on offense, then the amount of moves given by the ability is multiplied by itself for all units on same side with the ability. This unwanted multiplication occurs everytime unit lvls up.
Example: Unit has the ability, gains 2 moves back, after leveling up to its next lvl, its 4 for all units with the ability. Upon L3 gains all 6 moves back and i have overpowered Thief/Rogue/Assassins darting overall the place, now that was unintended.
Related ability:
Code: Select all
#define ABILITY_HITANDRUN
[dummy]
id=MRhitandrun
name= _ "hit and run"
description= _ "hit and run:
This unit gains 2 moves back after attacking an enemy."
[/dummy]
[/abilities]
[event]
name=attack_end
first_time_only=no
[store_unit]
[filter]
side=$side_number
ability=MRhitandrun
x,y=$x1,$y1
[/filter]
variable=lerunner
[/store_unit]
{VARIABLE_OP lerunner.moves add 2}
[unstore_unit]
variable=lerunner
{COLOR_HARM}
text= _ "FLEE!"
find_vacant=no
[/unstore_unit]
[/event]
[+abilities]
#enddef
- Alarantalara
- Art Contributor
- Posts: 786
- Joined: April 23rd, 2010, 8:17 pm
- Location: Canada
Re: Hit and Run multiplying itself on lvl-up
See how the feeding ability does it in core.
You'll notice that the event has an id to prevent duplication.
You'll notice that the event has an id to prevent duplication.
Re: Eagle 11 noob wml questions
I have this ability that is supposed to help economy a bit on a cannonfodder unit of an side in my mod. However its severely impacting the game balance, thus i want to add following to it: Needs to remain stationary, not having spent any movement points to produce the gold. And checks what terrain its standing on, if its a village, keep, castle, swamp or water tile doesnt produce the gold.
related:
I have couple of broken weapon specs. This one is supposed to let the unit deal 50% more dmg on targets that are of a certain race. However its functioning against targets of every race, it needs to be told to filter the opponent, if equals undead then multiply dmg, else deal original dmg. (prolly inside an [event], i guess)
related:
This one is supposed to be a completory side-spec found on attacks with berserk. It's supposed to let the unit deal double dmg near death, after its hp is >11
Same problem as one above, works always. It needs to be told to filter self, if unit hitpoints equal less than 11 then multiply dmg with 2x, else deal normal dmg.
related:
related:
Code: Select all
#define ABILITY_EXTRACT_LVL1
[leadership]
value=0
id=MRextract1
cumulative=no
name="extract"
description= _ "Digger: Extracting minerals from the ground under it's current position, this unit is able to help maintain the economy to some extent. It produces it's level in gold per turn, or one gold if level 0."
[/leadership]
[/abilities]
[event]
id=MRextractors
name=turn refresh
first_time_only=no
[if]
[have_unit]
side=$side_number
ability=extract1
[/have_unit]
[/if]
[store_unit]
[filter]
side=$side_number
ability=extract1
[/filter]
variable=extractors1
kill=no
[/store_unit]
{FOREACH extractors1 i}
[gold]
side=$side_number
amount=1
[/gold]
#[scroll_to_unit]
#find_in=extractors1[$i]
#check_fogged=true
#[/scroll_to_unit]
[unstore_unit]
variable=extractors1[$i]
text="1"
red,green,blue=255,255,0
[/unstore_unit]
[delay]
time=100
[/delay]
{NEXT i}
{CLEAR_VARIABLE extractors1}
[/event]
[+abilities]
#enddef
related:
Code: Select all
#define WEAPON_SPECIAL_LICHBANE
[damage]
id=MRlichbane
name= _ "lichbane"
description= _ "Lichbane:
This attack cuts at the tie between the undead and its corrupted source of animation, dealing additional damage to the unholy target."
multiply=1.5
[filter_opponent]
race=undead
[/filter_opponent]
[/damage]
#enddef
Same problem as one above, works always. It needs to be told to filter self, if unit hitpoints equal less than 11 then multiply dmg with 2x, else deal normal dmg.
related:
Code: Select all
#define WEAPON_SPECIAL_LASTSTAND
[damage]
id=MRlaststand
name= _ "last stand"
description= _ "Last Stand:
This attack will hit harder when unit's health is extremely low.
When the unit has only 10 hitpoints or less, this attack deals double damage."
multiply=2
apply_to=self
[filter]
[status]
[filter_self]
hitpoints="1, 2, 3, 4, 5, 6, 7, 8, 9, 10"
[/filter_self]
[/status]
[/filter]
[/damage]
#enddef
Re: Hit and Run multiplying itself on lvl-up
For economy units, write the event like something like this (untested, petty errors might be present):
Lichbane is analogical to misanthropia from Legend of the Invincibles:
Last stand has wrongly written filters (FIXME: how do I properly use the formula in filter? the information on the wiki isn't sufficient):
Code: Select all
[event]
id=MRextractors
name=turn end
first_time_only=no
[store_unit]
[filter]
side=$side_number
ability=extract
[/filter]
variable=extractors
kill=no
[/store_unit]
{FOREACH extractors i}
[if]
[variable]
name=extractors[$i].moves
equals=$extractors[$i].max_moves
[/variable]
[then]
[gold]
side=$side_number
amount=$($extractors[$i].level+1)
[/gold]
[/then]
[/if]
{NEXT i}
{CLEAR_VARIABLE extractors}
Spoiler:
Code: Select all
#define WEAPON_SPECIAL_LASTSTAND
[damage]
id=MRlaststand
name= _ "last stand"
description= _ "Last Stand:
This attack will hit harder when unit's health is extremely low.
When the unit has only 10 hitpoints or less, this attack deals double damage."
multiply=2
apply_to=self
[filter_self]
formula="hitpoints<11" #Not sure about this line, can somebody correct me if I am wrong?
[/filter_self]
[/damage]
#enddef
Re: Hit and Run multiplying itself on lvl-up
On the economy one:
Didnt function, it seems to give the gold needs set to turn refresh but then cant check the remaining moves, since turn end is needed for that. Now fearing that i wanted to do something impossible without knowing ?
Thanks for the Misanthrophia one, Lichbane and Manslayer specs are fixed now.
EDIT: Just checked the formular one, and its working too
Didnt function, it seems to give the gold needs set to turn refresh but then cant check the remaining moves, since turn end is needed for that. Now fearing that i wanted to do something impossible without knowing ?
Thanks for the Misanthrophia one, Lichbane and Manslayer specs are fixed now.
EDIT: Just checked the formular one, and its working too
Re: Hit and Run multiplying itself on lvl-up
Indeed that it's impossible to do that, that's why it's a turn end event in my code and not a turn refresh event. If it doesn't work at turn end either, I think that there is just a small error, that might be quite easy to locate.Didnt function, it seems to give the gold needs set to turn refresh but then cant check the remaining moves, since turn end is needed for that. Now fearing that i wanted to do something impossible without knowing ?
Re: Eagle 11 noob wml questions (resume)
The idea is to group {TRAIT_STRONG} with _WEAK}, _QUICK} with _SLOW}, INTELLIGENT} with _DIM}. I need to tell the game to pick one of the pairs so there aint a unit with strong and weak(and so on). Probably should define pairs, then point the trait set to those pairs but how i do the "dont pick 2 of same group" part. Another slightly related question: Is there any method to make some traits rarely chosen in a pool of atleast a dozen.
Next issue is something ive found in a certain BSH era, an non-serious one with an kittens faction. Anyways there is this magnificent piece, that allows an ranged attack to be fired over multiple hex distance using a right-click menu option. Range is defined at unit, inside weapon's [specials] clause via {ARTILLERY FIRE RANGE}, splash is only present at highest lvl advance of unit using an {SPLASH_DAMAGE VALUE TYPE} used inside [specials] again.
Also i noticed there is a typo, notice the SHPLASH. Naturally it doesnt work when ported over because of that, however it works like that at the source, how come ? The farthest i could get is to get the game able to read it via removing all splash related stuff outside, but the menu item never appeared.
I thought it would be fitting for Troll Rock- and Boulder-lobber, given their superior height.
The range definer:
The splash damage:
artillery-events:
In Era of Chaos, there is this ability that allows a Vampire to transform into a bat(again via an rightclick menu option) and back. In my mod wanted to give this to the Malborn unit, since its a lvl1 "assassin" that cant do [censored], to actually make that unit worth a damn.
The bat is a copy of original, which has a unit_variation for each type that is supposed to have the ability. Problem is that the menu item didnt appear(again)
the unit:
variation ding:
the ability's event itself
graphical parts:
Next issue is something ive found in a certain BSH era, an non-serious one with an kittens faction. Anyways there is this magnificent piece, that allows an ranged attack to be fired over multiple hex distance using a right-click menu option. Range is defined at unit, inside weapon's [specials] clause via {ARTILLERY FIRE RANGE}, splash is only present at highest lvl advance of unit using an {SPLASH_DAMAGE VALUE TYPE} used inside [specials] again.
Also i noticed there is a typo, notice the SHPLASH. Naturally it doesnt work when ported over because of that, however it works like that at the source, how come ? The farthest i could get is to get the game able to read it via removing all splash related stuff outside, but the menu item never appeared.
I thought it would be fitting for Troll Rock- and Boulder-lobber, given their superior height.
The range definer:
Code: Select all
#define ARTILLERY_FIRE RANGE
[artillery]
id=artillery_fire
name=_"artillery fire {RANGE}"
description=_"this weapon always hits..something..It can be fired at targets {RANGE} hexes away, but may deviate to one of the neighbouring hexes instead of the primary target..better not to aim it anywhere near your own units"
value={RANGE}
[/artillery]
#enddef
Code: Select all
#define SPLASH_DAMAGE DAM TYPE
[splashing]
id=splash_damage
name=_"splashing"
value={DAM}
type={TYPE}
description=_"The explosion from where this weapon hits may deal some damage also to neighbouring units (in this weapons case - {DAM} {TYPE} damage) unless they manage to protect against the shockwave.
(depends on unit defence on its terrain)
That means - while it's a good idea not to aim normal artillery anywhere near your own units, then those with splash damage should not be aimed anywhere near the anywhere near as well."
[/splashing]
#enddef
Spoiler:
The bat is a copy of original, which has a unit_variation for each type that is supposed to have the ability. Problem is that the menu item didnt appear(again)
the unit:
Spoiler:
Code: Select all
#textdomain wesnoth-mental-rework
[unit_type]
id=Malborn Bat
name= _ "Malborn (Bat)"
[base_unit]
id=True Vampire Bat
[/base_unit]
hitpoints=32
experience=37
hide_help=true
[abilities]
{ABILITY_VAMPIRE_TRANSFORMATION}
[/abilities]
{VAMPIRE_INFO_VARIATION ("Malborn") units/vampires/malborn.png}
[female]
name= _ "female^Malborn (Bat)"
[/female]
{VAMPIRE_INFO_FEM_VARIATION units/vampires/malborn+female.png}
[/unit_type]
Spoiler:
Spoiler: