Advancement Effect apply_to=bonus_attack
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: 33
- Joined: March 31st, 2018, 7:52 pm
- Location: USA
Advancement Effect apply_to=bonus_attack
I was perusing through Dugi's codebase for legend of the invincibles and found an advancement called arrow storm. I would like to do something similar, and have already instantiated the weapon special, but there is something that I cannot account for. As I search the database for "bonus_attack" in the context of [effect] I return no information.
Has anyone used a similar context modifier for [effect]?
Has anyone used a similar context modifier for [effect]?
Code: Select all
[advancement]
max_times=1
always_display=yes
id=arrowstorm
description= _ "able to shoot a storm on arrows without giving the enemy a chance to counterattack"
image=attacks/bow-elven-magic.png
strict_amla=yes
require_amla=""
[effect]
apply_to=bonus_attack
name=arrow storm
description= _ "arrow storm"
icon=attacks/bow-elven-magic.png
range=ranged
defense_weight=0
damage=-20
number=-40
clone_anim=yes
[specials]
{WEAPON_SPECIAL_DISTANT_ATTACK}
[/specials]
[/effect]
{AMLA_DEFAULT_BONUSES}
[/advancement]
Re: Advancement Effect apply_to=bonus_attack
Given that damage and number is negative, this is only input for his code that creates such attack.
- Celtic_Minstrel
- Developer
- Posts: 2207
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: Advancement Effect apply_to=bonus_attack
Perhaps Dugi is using the feature new to 1.13.x that allows you to define custom values for
[effect]apply_to=
using Lua. See here for details of how to do that.Re: Advancement Effect apply_to=bonus_attack
I don't know what Dugi's effect does but perhaps you could use
That allows you to create a new attack when the unit advances, perhaps it is of some use?
apply_to=new_attack
. That allows you to create a new attack when the unit advances, perhaps it is of some use?
Creator of: The Reign of The Lords Era,The Gnats Franken Dungeon.
Re: Advancement Effect apply_to=bonus_attack
iirc dugis addons implementes this type of effect manually in postadvance etc events, although it could also be implemented via the new 1.13 custom effects. One important different between duigs implementation and a possible 1.13 custom effect implementation is that dugis implementatiojn makes sure the bonus_attack effects are always applied last so that effect modifying the original attack will also effect an eariler bonus_attack
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: 33
- Joined: March 31st, 2018, 7:52 pm
- Location: USA
Re: Advancement Effect apply_to=bonus_attack
Hey so I figured out how dugis is doing it.gfgtdf wrote: ↑April 20th, 2018, 6:48 pm iirc dugis addons implementes this type of effect manually in postadvance etc events, although it could also be implemented via the new 1.13 custom effects. One important different between duigs implementation and a possible 1.13 custom effect implementation is that dugis implementatiojn makes sure the bonus_attack effects are always applied last so that effect modifying the original attack will also effect an eariler bonus_attack
It is not a native functionality of Wesnoth, instead he is adding tags for post addition events as the last poster suggested. I wrote up my own code that will clone animations given that you can provide the unit_type, gender, attack_name, and the attack_name that you want to apply it to.
Dugi's code does it from Legend_of_the_Invincibles\utils\stats.cfg (about half way down ctrl + f "bonus_attack" will take you to it.
Here is what I came up with (I prefixed the names with _0 because I wanted to be able to clone multiple existing attacks)
Code: Select all
#define clone_anim_0 unit_type gender attack_id apply_to
[store_unit_type]
type={unit_type}
variable=unit_type
[/store_unit_type]
[if]
[variable]
name={gender}
equals="male"
[/variable]
[then]
{VARIABLE idx_1 0}
[while]
[variable]
name="idx_1"
less_than=$unit_type.attack_anim.length
[/variable]
[do]
[if]
[variable]
name=unit_type.attack_anim[$idx_1].filter_attack.name
equals={attack_id}
[/variable]
[then]
[set_variables]
name=grab_anim
mode=append
[value]
apply_to=new_animation
name={apply_to}
[insert_tag]
name=attack_anim
variable=unit_type.attack_anim[$idx_1]
[/insert_tag]
[/value]
[/set_variables]
[set_variables]
name=grab_anim.attack_anim[$idx_1].filter_attack
mode=merge
[value]
__remove=yes
[/value]
[/set_variables]
#{VARIABLE grab_anim.attack_anim[$idx_1].filter_attack.name "$empty"}
[/then]
[/if]
{VARIABLE_OP idx_1 add 1}
[/do]
[/while]
{CLEAR_VARIABLE idx_1}
[set_variables]
name=clone_anim_0
mode=append
to_variable=grab_anim
[/set_variables]
{CLEAR_VARIABLE unit_type}
{CLEAR_VARIABLE grab_anim}
[/then]
[/if]
[if]
[variable]
name={gender}
equals="female"
[/variable]
[then]
{VARIABLE idx_1 0}
[while]
[variable]
name="idx_1"
less_than=$unit_type.female.attack_anim.length
[/variable]
[do]
[if]
[variable]
name=unit_type.female.attack_anim[$idx_1].filter_attack.name
equals={attack_id}
[/variable]
[then]
[set_variables]
name=grab_anim
mode=append
[value]
apply_to=new_animation
name={apply_to}
[insert_tag]
name=attack_anim
variable=unit_type.female.attack_anim[$idx_1]
[/insert_tag]
[/value]
[/set_variables]
[set_variables]
name=grab_anim.female.attack_anim[$idx_1].filter_attack
mode=merge
[value]
__remove=yes
[/value]
[/set_variables]
#{VARIABLE grab_anim.female.attack_anim[$idx_1].filter_attack.name "$empty"}
[/then]
[/if]
{VARIABLE_OP idx_1 add 1}
[/do]
[/while]
{CLEAR_VARIABLE idx_1}
[set_variables]
name=clone_anim_0
mode=append
to_variable=grab_anim
[/set_variables]
{CLEAR_VARIABLE unit_type}
{CLEAR_VARIABLE grab_anim}
[/then]
[/if]
#enddef
#define clear_clone_anim_0
{CLEAR_VARIABLE clone_anim_0}
#enddef
call (note that a good deal of my weapon data was generated by pre-made queries so you wont see alot of hard coded values):
Code: Select all
{clone_anim_0 $unit.type unit.gender $attack_id "avatar"}
....do things
[advancement]
id=dwarf_0
always_display=yes
description={desc_dwarf}
image={img_race_dwarf}
max_times=1
strict_amla=yes
require_amla=""
[effect]
apply_to=resistance
[resistance]
blade=-14
impact=-12
pierce=-4
[/resistance]
[/effect]
[effect]
apply_to=new_attack
name=avatar
description= _ "avatar"
icon=Attacks/Melee_Avatar.png
accuracy=-95
type=$attack_type
range=$attack_range
damage=$mod_damage_0
number=$mod_number_0
[specials]
{WEAPON_SPECIAL_CHARGE}
[/specials]
[/effect]
[insert_tag]
name=effect
variable=clone_anim_0
[/insert_tag]
.....do more things
{clear_clone_anim_0}