Pillage

The place to post your WML questions and answers.

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.
Post Reply
WINR
Posts: 7
Joined: April 12th, 2014, 4:33 pm

Pillage

Post by WINR »

Is that possible to pillage an hexagon of terrain through WML?
If not how you do it?
If I recall well the Under_Burning_Sun campaign allow to pillage a village (destroy it) and maybe also some other campaign.
The real fun starts when you code your first campaign
User avatar
Lord-Knightmare
Discord Moderator
Posts: 1305
Joined: May 24th, 2010, 5:26 pm
Location: Somewhere in the depths of Irdya, gathering my army to eventually destroy the known world.
Contact:

Re: Pillage

Post by Lord-Knightmare »

Is that possible to pillage an hexagon of terrain through WML?
If not how you do it?
can you please clarify what you mean by this?

Do you mean that you want to trigger an event when a particular village is captured?
Or, do you want a side to capture some villages within a defined radius?

For the former, you can use an event named capture with the filter for the capturing side (that is side 1)
If I recall well the Under_Burning_Sun campaign allow to pillage a village (destroy it) and maybe also some other campaign.
I am assuming it's that scenario where you are ambushed by the Undead, so it's a capture event. A second example is in the code of LoW, in the scenario where you raid the Saurian capital when Landar decides to take his revenge on them.
Pilauli
Posts: 115
Joined: August 18th, 2020, 12:56 pm

Re: Pillage

Post by Pilauli »

Another example in scenario 2 of The South Guard. I've copied and commented the relevant event here for reference.

Code: Select all

    [event]
        name=capture          # Activates when a unit captures a village.
        first_time_only=no    # Continues happening after the first time.
        [filter]              # This will activate only when the capturing unit is a human on side 2.
            side=2
            race=human
        [/filter]

        [sound]        # Play a sound.
            name=torch.ogg
        [/sound]

        # This next part removes the village (sets terrain to Gg, plain grass with no village) and adds (PLACE_IMAGE) a random burnt village image.

        {VARIABLE_OP random_string value "scenery/village-human-burned1.png,scenery/village-human-burned2.png,scenery/village-human-burned3.png,scenery/village-human-burned4.png"}
        {RANDOM $random_string}

        {PLACE_IMAGE $random $x1 $y1}

        {MODIFY_TERRAIN Gg $x1 $y1}

        # It also gives gold to side 2.  They need to pillage villages to get money, because they can't earn money just by owning villages like normal.
        [gold]
            side=2
            amount=10
        [/gold]
    [/event]
If you want to do more varied stuff, you can filter to only replace certain kinds of village (e.g. only the wooden ones) by adding pieces to the filter. For example...

Code: Select all

        [filter]
            side=2
            race=human
            [filter_location]
                terrain=*^Vh, *^Vha
                # These are respectively "anything with an ordinary wooden village on top" and "anything with a snowy (but otherwise ordinary) wooden village on top.
            [/filter_location]
        [/filter]
If you want to modify specific terrain in other contexts, you will most likely want the PLACE_IMAGE and/or MODIFY_TERRAIN macros. For example, maybe you want a particular house to turn into a fire (there is a terrain for that) on turn 2 and then turn into a burnt house (flat terrain with placed image) on turn 3.

If you want something like "orcs burn forest" then you should be able to use a "moveto" event (instead of "capture"), and use the terrain filter to indicate forest.

I hope some of this is useful to you.
WINR
Posts: 7
Joined: April 12th, 2014, 4:33 pm

Re: Pillage

Post by WINR »

If you want something like "orcs burn forest" then you should be able to use a "moveto" event (instead of "capture"), and use the terrain filter to indicate forest.
That's what I wanted to do (same concept).
Despite being an absolute noob at WML I might manage to do it

Also the other implementations you proposed are very interesting. I'll definetly have a look.

Thanks a lot
The real fun starts when you code your first campaign
WINR
Posts: 7
Joined: April 12th, 2014, 4:33 pm

Re: Pillage & Harvest

Post by WINR »

Thanks to the code you posted it was super-easy. While doing it I realised that what I wanted is better described as harvesting rather than pillaging.
I post the code I came out with in case someone is interested.
It changes Farmland and Semi-dry grass to grass

Code: Select all

[event]
        name=moveto          
        first_time_only=no    # Continues happening after the first time.
        [filter]              
            side=1
            race=human
            [filter_location]
                #FarmLand and Semi-dry grass
                terrain=Rb^Gvs, Gg^Gvs, Re^Gvs
            [/filter_location]
        [/filter]

        [sound]        # Play a sound.
            name=torch.ogg
        [/sound]

        # This next part removes the village (sets terrain to Gg, plain grass).
        {MODIFY_TERRAIN Gg $x1 $y1}

        # It also gives gold to side 2.
        [gold]
            side=1
            amount=2
        [/gold]
[/event]
Tnx again
The real fun starts when you code your first campaign
Post Reply