Is it possible to get opponent's level in weapon specials?
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.
-
- Posts: 60
- Joined: December 23rd, 2008, 5:01 am
Is it possible to get opponent's level in weapon specials?
I'm thinking of making a weapon special that does more damage to higher-level enemies. But I cannot figure out an easy way to do it. Certainly I can use an event to give the unit damage modifier when attacking while removing the modifier after the attack finishes. But the code looks ugly. Is there some better way to do it? For instance:
Is it doable?
Code: Select all
[damage]
id=more_damage_to_stronger_enemies
apply_to=self
add="a formula that gets the opponent's level"
[damage]
Re: Is it possible to get opponent's level in weapon specials?
yes im quite sure that would work. It it doesn't maybe you could tell what exact syntax you have tried?
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
-
- Posts: 60
- Joined: December 23rd, 2008, 5:01 am
Re: Is it possible to get opponent's level in weapon specials?
did you try putting it in parentesis like
add="(other.level)"
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
-
- Posts: 60
- Joined: December 23rd, 2008, 5:01 am
Re: Is it possible to get opponent's level in weapon specials?
ohh hmm it seems like this was written mostly with the leadership ability in mind where one unit has the ability and the 'other' unit it the unit that 'received' the ability.
So it seems that is itnot possibel that way maybe we can add this possiblity to wesnoth 1.15 in time.
So it seems that is itnot possibel that way maybe we can add this possiblity to wesnoth 1.15 in time.
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
- lhybrideur
- Posts: 369
- Joined: July 9th, 2019, 1:46 pm
Re: Is it possible to get opponent's level in weapon specials?
do you create your "other" with a
?
If yes, other.level should normally work.
Code: Select all
[store_unit]
[filter]
x,y=$x2,$y2
[/filter]
variable=other
[/store_unit]
If yes, other.level should normally work.
- Celtic_Minstrel
- Developer
- Posts: 2209
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: Is it possible to get opponent's level in weapon specials?
ihybrideur – That's not how this works. Your code creates a WML variable, but the formulas in a weapon special use WFL variables, which are not the same thing (I know, it's a little confusing to have three types of variables, but that's how it is).
The
The
other
WFL variable is created by the engine in the weapon special filters, but I guess it's not included when calculating values in the weapon special itself.