How to remove an 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.
How to remove an attack ?
My units can take a barrel and throw it :
[event]
name=moveto
first_time_only=no
[filter]
x=16
y=17
[/filter]
[object]
id=b1
name= _ "barrel"
image=items/barrel.png
duration=forever
[filter]
x=16
y=17
[/filter]
[then]
[removeitem]
x,y=16,17
[/removeitem]
[unit_overlay]
x,y=16,17
image=items/barrel.png
[/unit_overlay]
[/then]
[effect]
apply_to=new_attack
name= _ "barrel"
type=impact
range=long
damage=20
number=1
[/effect]
[/object]
[/event]
Ok, after, I can remove the barrel, like this :
[event]
name=attack
first_time_only=no
[filter]
side=1
name=barrel
[/filter]
[remove_unit_overlay]
side=1
image=items/barrel.png
[/remove_unit_overlay]
[/event]
But, the attacks "barrel" is still here ! How to remove it ? please...
Thank you.
[event]
name=moveto
first_time_only=no
[filter]
x=16
y=17
[/filter]
[object]
id=b1
name= _ "barrel"
image=items/barrel.png
duration=forever
[filter]
x=16
y=17
[/filter]
[then]
[removeitem]
x,y=16,17
[/removeitem]
[unit_overlay]
x,y=16,17
image=items/barrel.png
[/unit_overlay]
[/then]
[effect]
apply_to=new_attack
name= _ "barrel"
type=impact
range=long
damage=20
number=1
[/effect]
[/object]
[/event]
Ok, after, I can remove the barrel, like this :
[event]
name=attack
first_time_only=no
[filter]
side=1
name=barrel
[/filter]
[remove_unit_overlay]
side=1
image=items/barrel.png
[/remove_unit_overlay]
[/event]
But, the attacks "barrel" is still here ! How to remove it ? please...
Thank you.
- Elvish_Pillager
- Posts: 8137
- Joined: May 28th, 2004, 10:21 am
- Location: Everywhere you think, nowhere you can possibly imagine.
- Contact:
hmm. That's rather complex.
If you have no other objects than barrels that a unit can take, this code will suffice in the attack event:
However, this only removes it when it is thrown on the attack. You will also need a second event, where the "filter" is replaced with "filter_second" and the $x1 and $y1 in my code are replaced with $x2 and $y2.
If you have no other objects than barrels that a unit can take, this code will suffice in the attack event:
Code: Select all
[store_unit]
[filter]
x=$x1
y=$y1
[/filter]
variable=loser
[/store_unit]
{VARIABLE loser.modifications.object[0].effect[0].apply_to nothing}
[unstore_unit]
variable=loser
[/unstore_unit]
It's all fun and games until someone loses a lawsuit. Oh, and by the way, sending me private messages won't work. :/ If you must contact me, there's an e-mail address listed on the website in my profile.
You could try to modify the attack to do 0-0 damage with the [effect] tag.
Hope springs eternal.
Wesnoth acronym guide.
Wesnoth acronym guide.
- Elvish_Pillager
- Posts: 8137
- Joined: May 28th, 2004, 10:21 am
- Location: Everywhere you think, nowhere you can possibly imagine.
- Contact:
My way is better. It makes the attack not even be there anymore.scott wrote:You could try to modify the attack to do 0-0 damage with the [effect] tag.
It's all fun and games until someone loses a lawsuit. Oh, and by the way, sending me private messages won't work. :/ If you must contact me, there's an e-mail address listed on the website in my profile.
Thanks Elvish, but I don't understand....
see my code (a unit can take a barrel and throw it)
[event]
name=moveto
first_time_only=no
[filter]
x=5
y=17
[/filter]
[object]
id=e1
name= _ "tonneau"
image=items/barrel.png
[filter]
x=5
y=17
[/filter]
[then]
[removeitem]
x,y=5,17
[/removeitem]
[unit_overlay]
x,y=5,17
image=items/barrel.png
[/unit_overlay]
[/then]
[effect]
apply_to=new_attack
name= _ "Barrel"
type=impact
range=long
damage=20
number=1
[/effect]
[/object]
[/event]
So, can you explain me with this example ? Thank you very much.
see my code (a unit can take a barrel and throw it)
[event]
name=moveto
first_time_only=no
[filter]
x=5
y=17
[/filter]
[object]
id=e1
name= _ "tonneau"
image=items/barrel.png
[filter]
x=5
y=17
[/filter]
[then]
[removeitem]
x,y=5,17
[/removeitem]
[unit_overlay]
x,y=5,17
image=items/barrel.png
[/unit_overlay]
[/then]
[effect]
apply_to=new_attack
name= _ "Barrel"
type=impact
range=long
damage=20
number=1
[/effect]
[/object]
[/event]
So, can you explain me with this example ? Thank you very much.
- Elvish_Pillager
- Posts: 8137
- Joined: May 28th, 2004, 10:21 am
- Location: Everywhere you think, nowhere you can possibly imagine.
- Contact:
ok, i'm going to try.Elvish Pillager wrote:What is it that you're asking me to explain?
First, excuse my english because i'm french and so...
i'm asking you to explain how remove the attack "barrel" that I create when an unit take a barrel to throw it.
the code i posted explain how unit can take it and throw it by the creation of a new attack. But... now, i want to remove this attack after this one throw the barrel. I can't do that. I try this :
[event]
name=attack
[filter]
name=Barrel
[/filter]
[effect]
apply_to=attack
[filter]
name=Barrel
[/filter]
increase_attacks=-1
[/effect]
[/event]
this code doesn't remove the attack but I thought that it will reduce the number of attacks at 0... it doesn't work !
And the probleme is that there's another barrel on the map (in fact it's a pub).
So i hope you understand my problem and that you can help me...
Thaks a lot
- Elvish_Pillager
- Posts: 8137
- Joined: May 28th, 2004, 10:21 am
- Location: Everywhere you think, nowhere you can possibly imagine.
- Contact:
Try this.
Code: Select all
[event]
name=attack
[filter]
has_weapon= _ "barrel"
[/filter]
[store_unit]
[filter]
x=$x1
y=$y1
[/filter]
variable=loser
[/store_unit]
{VARIABLE complete no}
{VARIABLE modification_counter 0}
[while]
[variable]
name=complete
equals=no
[/variable]
[do]
[if]
{VARIABLE_OP varname format loser.modifications.object[$modification_counter|].effect[0].apply_to}
{VARIABLE_OP varvalue to_variable $varname}
[variable]
name=varvalue
equals=attack
[/variable]
[then]
{VARIABLE $varname nothing}
{VARIABLE complete yes}
[/then]
[else]
{VARIABLE_OP count add 1}
[/else]
[/if]
[/do]
[/while]
[unstore_unit]
variable=loser
[/unstore_unit]
[/event]
It's all fun and games until someone loses a lawsuit. Oh, and by the way, sending me private messages won't work. :/ If you must contact me, there's an e-mail address listed on the website in my profile.
-
- Posts: 20
- Joined: January 2nd, 2006, 1:59 am
- Location: Pennsylvania, United States
It's Wesnoth Markup Language, a scripting language by which you exercise complete control over what happens during a scenario. It's a lot of fun.
Hope springs eternal.
Wesnoth acronym guide.
Wesnoth acronym guide.
-
- Posts: 20
- Joined: January 2nd, 2006, 1:59 am
- Location: Pennsylvania, United States