Earthquakes events and kill units in a precise area

The place to post your WML questions and answers.

Moderators: Forum Moderators, Developers

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.
Post Reply
User avatar
Graziani
Posts: 96
Joined: December 20th, 2010, 1:04 am
Location: France

Earthquakes events and kill units in a precise area

Post by Graziani » December 6th, 2013, 2:17 pm

Hi wesnoth community!

I have a question about earthquakes in Wesnoth (like in burning suns in final confrontation for example).

In the burning suns xml, i found this

Code: Select all


  [scroll]
            x=25
        [/scroll]
        [scroll]
            x=-25
        [/scroll]
        [scroll]
            x=25
        [/scroll]
        [scroll]
            x=-25
        [/scroll]
        [scroll]
            x=25
        [/scroll]
        [scroll]
            x=-25
        [/scroll]

        [redraw]
        [/redraw]

        [delay]
            time=400
        [/delay]

        [color_adjust]
            red,green,blue=40,0,100
        [/color_adjust]

        [redraw]
        [/redraw]

        [delay]
            time=250
        [/delay]

        [color_adjust]
            red,green,blue=0,0,0
        [/color_adjust]

        [redraw]
        [/redraw]


I presume that scroll is for the view, it's shake all the screen up and down.

But delay, color and redraw, what is it? I mean how use it to create some colors in the earthquake?


A last question, i would like to make an event that kills every units that are in a precise area (because of earthquake) with a change of terrain. I know how to modify terrain, but to kill the units i don't know at all how to do



Thanks in advance for your responses!
Currently on goblin campaign "A goblin adventure" (available) and troll campaign "From Rocks and Blood"(not available yet)

Ceres
Forum Regular
Posts: 620
Joined: September 18th, 2010, 7:56 pm
Location: Germany

Re: Earthquakes events and kill units in a precise area

Post by Ceres » December 6th, 2013, 2:43 pm

Graziani wrote:But delay, color and redraw, what is it?
[scroll] is used to shake the screen by scrolling back and fourth by 25 pixels, [color_adjust] changes the color to a specified RGB value, [redraw] redraws the screen, [delay] creates a pause, the value is the duration given in milliseconds. To create an earthquake-y effect, you could use the same code and modify the values/add more/different colors.
A last question, i would like to make an event that kills every units that are in a precise area (because of earthquake) with a change of terrain. I know how to modify terrain, but to kill the units i don't know at all how to do
To kill units, use the [kill] tag. You can specify the area where you want to eradicate everything as a Standard Location Filter inside the Standard Unit Filter, like this

Code: Select all

[filter]
  [filter_location]
    x=1-20
    y=1-15
  [/filter_location]
[/filter]

User avatar
Paulomat4
Moderator Emeritus
Posts: 715
Joined: October 16th, 2012, 3:32 pm
Location: Wesmere library, probably summoning Zhangor

Re: Earthquakes events and kill units in a precise area

Post by Paulomat4 » December 6th, 2013, 2:47 pm

to create an earthquake effect, you better use the EARTHQUAKE macro

Code: Select all

{EARTHQUAKE (put your kill tag or any other action wml in here)}
Creator of Dawn of Thunder and Global Unitmarkers

"I thought Naga's used semi-automatic crossbows with incendiary thermite arrows . . . my beliefs that this race is awesome are now shattered." - Evil Earl

User avatar
Graziani
Posts: 96
Joined: December 20th, 2010, 1:04 am
Location: France

Re: Earthquakes events and kill units in a precise area

Post by Graziani » December 6th, 2013, 6:08 pm

Thanks a lot both of you i'm going to try the two codes!
Currently on goblin campaign "A goblin adventure" (available) and troll campaign "From Rocks and Blood"(not available yet)

User avatar
Graziani
Posts: 96
Joined: December 20th, 2010, 1:04 am
Location: France

Re: Earthquakes events and kill units in a precise area

Post by Graziani » December 6th, 2015, 10:40 pm

Code: Select all

[kill]
[filter]
  [filter_location]
    x=1-20
    y=1-15
  [/filter_location]
[/filter]
[/kill]
Strangely, every unit on the entire map is killed by this event... I tried some issues but everytime all the units are getting killed.
Currently on goblin campaign "A goblin adventure" (available) and troll campaign "From Rocks and Blood"(not available yet)

User avatar
Ravana
Forum Moderator
Posts: 2244
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Earthquakes events and kill units in a precise area

Post by Ravana » December 6th, 2015, 10:48 pm

Empty filter matches all units. You should reread the reference http://wiki.wesnoth.org/DirectActionsWML#.5Bkill.5D.

User avatar
zookeeper
WML Wizard
Posts: 9740
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: Earthquakes events and kill units in a precise area

Post by zookeeper » December 6th, 2015, 10:57 pm

Ceres wrote:
A last question, i would like to make an event that kills every units that are in a precise area (because of earthquake) with a change of terrain. I know how to modify terrain, but to kill the units i don't know at all how to do
To kill units, use the [kill] tag. You can specify the area where you want to eradicate everything as a Standard Location Filter inside the Standard Unit Filter, like this

Code: Select all

[filter]
  [filter_location]
    x=1-20
    y=1-15
  [/filter_location]
[/filter]
Except as the link says, don't use a [filter] tag. Also, you don't need to wrap x= and y= in a [filter_location], because those are part of StandardUnitFilter too.

User avatar
Graziani
Posts: 96
Joined: December 20th, 2010, 1:04 am
Location: France

Re: Earthquakes events and kill units in a precise area

Post by Graziani » December 7th, 2015, 8:47 pm

Code: Select all

[kill]
  [filter_location]
    x=1-20
    y=1-15
  [/filter_location]
[/kill]
It works perfectly like this. Thank you !
Currently on goblin campaign "A goblin adventure" (available) and troll campaign "From Rocks and Blood"(not available yet)

Post Reply