Changing a side mid-scenario

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
Stupidbro
Posts: 22
Joined: March 5th, 2019, 12:08 am

Changing a side mid-scenario

Post by Stupidbro » March 15th, 2019, 1:17 am

So, I've been working on a campaign and I ran into an interesting issue; to make a scenario more difficult, I wanted to give the enemy side more gold and improve it's recruit list, BUT it has to happen at a specific turn event. Ideas?

User avatar
octalot
Developer
Posts: 381
Joined: July 17th, 2010, 7:40 pm

Re: Changing a side mid-scenario

Post by octalot » March 15th, 2019, 2:06 am

Like this:

Code: Select all

  [event]
    name=turn 10
    [allow_recruit]
      side=2
      type="Drake Arbiter,Drake Flare"
    [/allow_recruit]
  [/event]

  [event]
    name=turn 30
    [gold]
      side=2
      amount=200
    [/gold]
    [allow_recruit]
      side=2
      type="Drake Flameheart"
    [/allow_recruit]
    [disallow_recruit]
      side=2
      type="Drake Burner"
    [/disallow_recruit]
  [/event]

Stupidbro
Posts: 22
Joined: March 5th, 2019, 12:08 am

Re: Changing a side mid-scenario

Post by Stupidbro » March 15th, 2019, 12:01 pm

@octalot
Thanks! It looks like it's working!

User avatar
Vilebeggar
Posts: 38
Joined: September 5th, 2018, 5:21 pm
Location: Albania

Re: Changing a side mid-scenario

Post by Vilebeggar » March 26th, 2019, 10:56 am

A question, how do you make so that enemy side becomes your ally mid game.

Stupidbro
Posts: 22
Joined: March 5th, 2019, 12:08 am

Re: Changing a side mid-scenario

Post by Stupidbro » March 26th, 2019, 11:26 am

I don't know the syntax, but I'd guess that you would literally have to change the side.

I've noticed that near the end of a side's script, you have to list a display name for that side, and an ID for that side. I'd guess that you would have to change the ID to match the player's side's ID.
Again though, I have no idea how to do that.

User avatar
octalot
Developer
Posts: 381
Joined: July 17th, 2010, 7:40 pm

Re: Changing a side mid-scenario

Post by octalot » March 26th, 2019, 11:30 am

My first step would be to try and remember if there were mainline campaigns which had an enemy side change sides.

Legend_of_Wesmere/scenarios/chapter1/02_Hostile_Mountains.cfg has several possible changes for side 3:

Code: Select all

                [modify_side]
                    side=3
                    team_name=player
                    user_team_name= _ "Player"
                [/modify_side]
The_South_Guard/scenarios/07a_Into_the_Depths.cfg has a neutral side join with you, and all of its units change to side 1. That requires several modifications:

Code: Select all

        [store_villages]
            owner_side=5
            variable=side_5_villages
        [/store_villages]

        {MODIFY_UNIT side=5 side 5}

        [foreach]
            array=side_5_villages
            [do]
                [capture_village]
                    x,y=$this_item.x,$this_item.y
                    side=1
                [/capture_village]
            [/do]
        [/foreach]

        {CLEAR_VARIABLE side_5_villages}

        [modify_unit]
            [filter]
                side=5
            [/filter]
            side=1
        [/modify_unit]
TSG S07a also has the allies leave your team at the end of the scenario:

Code: Select all

        [kill]
            side=1
            race=troll
        [/kill]
TSG S05 has an enemy side joining you, the code is similar to TSG S05 but the other parts of the scenario are more complex.

Post Reply