Scenario doesn't load sides from previous

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
User avatar
Zydin
Posts: 116
Joined: June 24th, 2012, 3:42 pm

Scenario doesn't load sides from previous

Post by Zydin »

Hey everyone!
I'm a noob at this campaign thing, but I decided to research and try to build a two-scenario campaign just for fun. So, I picked up some scenarios I was building long ago and apply to a campaign.

I ran into problems, however. The first scenario plays perfectly, exactly as programmed. The second scenario, however, doesn't seem to load sides 1 and 2 (both human sides, allies, but not with separate turns). If I leave shroud and fog =yes for these sides (as I want), the map remains entirely black and turns just move in an endless sequence. I see in the status table that the AI enemy sides are recruiting and going about their business. If, however, I set shroud and fog =no, which I did as a test, it immediately shows defeat, as if the player leaders were killed. The objectives screen doesn't even appear, which is further indication that the sides are not loaded, for some reason. My intention was for the leaders, sides and full recall list, to carry over from the previous scenario.

So, in summary, it seems the problem is with loading the sides from the previous scenario. Can anyone give me hand to make this work, please?

_main.cfg:

Code: Select all

#textdomain wesnoth-tcoa

[campaign]
    id=The_Curse_of_Altakar
    name= _ "The Curse of Altakar"
    abbrev= _ "TCOA"
	description= _ "King Ruadrigh of the human lands and King Iolaire of the elven realm have maintained their peaceful alliance, inherited from their forefathers. The nearly half a millenium pact is now threatened by a plague of undeath that sickens both their lands. Honoring their alliance, they join forces to destroy this evil."
	define=The_Curse_of_Altakar
    first_scenario=The_Dead_Mountain

    [about]
        title = _ "Author"
        [entry]
            name = "Zydin"
        [/entry]
    [/about]


[/campaign]
#ifdef The_Curse_of_Altakar

	[binary_path]
    path=data/add-ons/The_Curse_of_Altakar
    [/binary_path]
	{~add-ons/The_Curse_of_Altakar/scenarios}

#endif
Scenario 1:

Code: Select all

#textdomain wesnoth-tcoa
[scenario]
    id=The_Dead_Mountain
    name= _ "The Dead Mountain"
    description= _ "by Zydin"    
    map_file="The_Dead_Mountain.map"
    random_start_time="yes"
    next_scenario=Desert_Curse
    experience_modifier=100%
	victory_when_enemies_defeated=yes
	turns=-1

    {DAWN}
    {MORNING}
    {AFTERNOON}
    {DUSK}
    {FIRST_WATCH}
    {SECOND_WATCH}

    [time_area]
        x = 27-33, 32, 27-31, 28-32, 16, 17, 18-21, 21, 22, 0-4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 7-11
        y = 21-25, 25, 24-26, 23-25, 35, 35, 34-35, 34, 34, 27-36, 28-36, 28-36, 29-36, 29-36, 30-36, 30-36, 31-36, 31-36, 32-36, 21-23
        {UNDERGROUND}
    [/time_area]

    {DEFAULT_MUSIC_PLAYLIST}

[story]
	[part]
            story=_ "King Ruadrigh of the human lands and King Iolaire of the elven realm have maintained their long-lasting peaceful and cooperative alliance, inherited from their forefathers. The nearly half a millenium pact is now, however, threatened by a plague of undeath that sickens both their lands. Perhaps stirred by the foulness of walking death, or perhaps possessed by some cunning evil spirit, orcs came out of their holes and hideouts and raid unafraid upon human and elf prey alike. Even the secluded dwarves, that had been harbouring fugitive thieves and criminals for quite some time, seem to have taken arms against both Kings."
	[/part]
	
	[part]
            story=_ "Their court mages were sure that the signs indicated that the pestilence  and evil emerged from the fabled 'Dead Mountain', that bordered their lands. It was so named after its barrenness, but also due to the foul smell of its surrounding bogs on the shore of the river Eik. Honoring their alliance, they join forces to destroy this evil. Resolved in their council, they left with hasty preparation to desperately try to tackle this evil before it destroys their shared world..."
	[/part]
[/story]

[objectives]
[objective]
condition=win
description=Destroy all opposing leaders.
[/objective]
[objective]
condition=lose
description=Death of either of the allied Kings.
[/objective]
[/objectives]

    [side]
        side=1
		color=green
        canrecruit=yes
        controller=human
        team_name=1
        user_team_name= _ "teamname^1"
        fog=yes
        shroud=yes
        village_gold=4
        faction=Rebels
		type=Elvish Marshal
        name= _ "King Iolaire"
		id=Iolaire
		save_id=Iolaire
        unrenamable=yes

    [/side]

    [side]
        side=2
		color=red
        canrecruit=yes
        controller=human
        team_name=1
        user_team_name= _ "teamname^1"
        fog=yes
        shroud=yes
        village_gold=4
        faction=Loyalists
		type=General
        name= _ "King Ruadrigh"
		id=Ruadrigh
		save_id=Ruadrigh
        unrenamable=yes

    [/side]

    [side]
        side=3
		color=purple
        canrecruit=yes
        controller=ai
        team_name=2
        user_team_name= _ "teamname^2"
        fog=yes
        shroud=no
        village_gold=2
        faction=Undead
		type=Necromancer
        name= _ "Karek"
        unrenamable=yes
    [/side]

    [side]
        side=4
		color=orange
        canrecruit=yes
        controller=ai
        team_name=2
        user_team_name= _ "teamname^2"
        fog=yes
        shroud=no
        village_gold=2
        faction=Knalgan Alliance
		type=Dwarvish Lord
        name= _ "Orimach"
id=Orimach
        unrenamable=yes
    [/side]

    [side]
        side=5
		color=blue
        canrecruit=yes
        controller=ai
        team_name=2
        user_team_name= _ "teamname^2"
        fog=yes
        shroud=no
        village_gold=2
        faction=Northerners
		type=Orcish Sovereign
        name= _ "Kashuruk"
id=Kashuruk
        unrenamable=yes
    [/side]

    [side]
        side=6
		color=brightorange
        canrecruit=yes
        controller=ai
        team_name=2
        user_team_name= _ "teamname^2"
        fog=yes
        shroud=no
        village_gold=2
        faction=Drakes
		type=Drake Flameheart
        name= _ "Rukar"
        unrenamable=yes
    [/side]

    [side]
        side=7
		color=brown
        no_leader=yes
        controller=null
        team_name=2
        user_team_name= _ "teamname^2"
        fog=yes
        shroud=no
        faction=Monsters
    [unit]
type=Giant Spider
x,y=26,24
max_moves=1
max_hitpoints=100
max_experience=1000
	[status]
	guardian=yes
	[/status]
    [/unit]
    [unit]
type=Giant Spider
x,y=18,34
max_moves=1
max_hitpoints=100
max_experience=1000
	[status]
	guardian=yes
	[/status]
    [/unit]
    [/side]
	

	[event]
name=start
	[message]
	speaker=narrator
	message=_ "The two allied Kings reach the dead mountain, hoping to tackle the source of the pestilence that roams the land."
	[/message]
	[message]
	speaker=narrator
	message=_ "With their armies about them, they are determined to cleanse the land of the curse that blights it."
	[/message]
	[message]
	speaker=narrator
	message=_ "Whatever awoke inside the dead mountain is no superstition, but an unliving, unbreathing evil that needs to conquered for life to prosper."
	[/message]
[/event]

    [event]
        name=moveto
        [filter]
            side=1,2
            x=9,10,11,12
            y=21,21,22,22
        [/filter]
                [message]
                    speaker=unit
                    message= _ "Sire! There are strange markings here on the floor... beside it... something was carved recently, someone left a message in our tongue!"
                [/message]
                [message]
                    speaker=unit
                    message= _ "I think I can read it: «The two puppets, the tall and the short, must both spend their life for this spell to be broken. Their beating heart holds the gate.»"
                [/message]
    [/event]


	[event]
	name=last breath
	[filter]
	id=Orimach
	[/filter]
	[terrain]
	      x=9
                    y=23
                    terrain=Qxua^Bs/
	[/terrain]
	[volume]
	sound=100
	[/volume]
	[sound]
	name="rumble.ogg"
	[/sound]
	[/event]

	[event]
	name=last breath
	[filter]
	id=Kashuruk
	[/filter]
	[terrain]
	      x=10
                    y=22
                    terrain=Qxua^Bs/
	[/terrain]
	[volume]
	sound=100
	[/volume]
	[sound]
	name="rumble.ogg"
	[/sound]
	[/event]

              [event]
	name=last breath
	[filter]
	id=Iolaire
	[/filter]
	[message]

	speaker=Iolaire
	message= _ "It is... finished..."

	[/message]
	[message]

	speaker=Ruadrigh
	message= _ "All is lost without the alliance! Retreat to the castles!"

	[/message]
	[endlevel]
	result=defeat
	[/endlevel]
	[/event]


              [event]
	name=last breath
	[filter]
	id=Ruadrigh
	[/filter]
	[message]

	speaker=Ruadrigh
	message= _ "Vanquished... no..."

	[/message]
	[message]

	speaker=Iolaire
	message= _ "All is lost without the alliance! Retreat to the forests!"

	[/message]
	[endlevel]
	result=defeat
	[/endlevel]
	[/event]


	[event]
name=victory
	[message]
	speaker=narrator
	message=_ "In the remains, a very old and strange parchment was found, penned in an unknown script."
	[/message]
	[message]
	speaker=narrator
	message=_ "It was taken to the allied Kings, for their mages and sages to decypher."
	[/message]
		[message]
	speaker=narrator
	message=_ "In it, they discovered that they had not conquered the source of the evil upsetting their realms, but merely a branch, growing from its stem..."
	[/message]
	[message]
	speaker=narrator
	message=_ "A curse, an old curse had awakened in the old mines of Altakar... and the Kings knew they had to break it there... or be eaten off like a corpse consummed by ancient worms..."
	[/message]
[/event]
	
[/scenario]
Scenario 2 (and last), the one that doesn't load sides 1 and 2:

Code: Select all

#textdomain wesnoth-tcoa

[scenario]
    id=Desert_Curse
    name= _ "Desert Curse"
    description= _ "by Zydin"    
    map_file="Desert_Curse.map"
    random_start_time="yes"
    experience_modifier=100%
    victory_when_enemies_defeated=no
	turns=-1

    {DAWN}
    {MORNING}
    {AFTERNOON}
    {DUSK}
    {FIRST_WATCH}
    {SECOND_WATCH}

    [time_area]
        x = 14-29, 22-38, 19-31, 30-39
        y = 9-25, 6-9, 26-29, 10-28
        {UNDERGROUND}
    [/time_area]

    {DEFAULT_MUSIC_PLAYLIST}

[objectives]
[objective]
condition=win
description=Find a way to break the curse of Altakar.
[/objective]
[objective]
condition=lose
description=Death of both allied Kings.
[/objective]
[/objectives]

    [side]
        side=1
		color=green
        canrecruit=yes
        controller=human
        team_name=1
        user_team_name= _ "teamname^1"
        fog=no
        shroud=no
        village_gold=12
        faction=Rebels
		id=Iolaire
		save_id=Iolaire
        unrenamable=yes
    [/side]

    [side]
        side=2
		color=red
        canrecruit=yes
        controller=human
        team_name=1
        user_team_name= _ "teamname^1"
        fog=no
        shroud=no
        village_gold=12
        faction=Loyalists
		id=Ruadrigh
		save_id=Ruadrigh
        unrenamable=yes
    [/side]

    [side]
        side=3
		color=blue
        canrecruit=yes
        controller=ai
        team_name=2
        user_team_name= _ "teamname^2"
        fog=no
        shroud=no
        village_gold=6
        faction=Northerners
		type=Orcish Sovereign
        name= _ "Tosharuk"
		
    [/side]

    [side]
        side=4
		color=purple
        canrecruit=yes
        controller=ai
        team_name=2
        user_team_name= _ "teamname^2"
        fog=no
        shroud=no
        village_gold=6
        faction=Undead
		type=Lich
        name= _ "Risen Mage"

    [/side]

    [side]
        side=5
		color=orange
        no_leader=yes
		canrecruit=no
        controller=ai
        team_name=2
        user_team_name= _ "teamname^2"
        fog=no
        shroud=no
        faction=Monsters
    [unit]
type=Fire Guardian
x,y=26,6
max_hitpoints=200
max_experience=1000
max_moves=0
	[status]
	guardian=yes
	[/status]
    [/unit]
    [unit]
type=Fire Guardian
x,y=30,6
max_hitpoints=200
max_experience=1000
max_moves=0
	[status]
	guardian=yes
	[/status]
    [/unit]
    [unit]
type=Fire Guardian
x,y=19,2
max_hitpoints=150
max_experience=1000
max_moves=1
	[status]
	guardian=yes
	[/status]
    [/unit]
    [unit]
type=Fire Guardian
x,y=19,4
max_hitpoints=150
max_experience=1000
max_moves=1
	[status]
	guardian=yes
	[/status]
    [/unit]
    [/side]
    
	[side]
        side=6
		color=brown
        no_leader=no
	type=Giant Spider
	name= _ "Spider Queen"
	canrecruit=yes
	x,y=1,7
max_hitpoints=150
max_experience=1000
        controller=ai
        team_name=2
        user_team_name= _ "teamname^2"
        fog=no
        shroud=no
	gold=350
        village_gold=10
	recruit="Giant Spider,Giant Scorpion"
    [/side]

[event]
name=start
	[message]
	speaker=narrator
	message=_ "The allied armies travelled long and far to the ruins of the Altakar Mines."
	[/message]
	[message]
	speaker=narrator
	message=_ "Once an important resource of the long fallen Empire, Altakar is now but a desecrated shadow of its former glory"
	[/message]
	[message]
	speaker=narrator
	message=_ "and host to whichever evil brought the Desert Curse that had spread a blight throughout the lands."
	[/message]
	[message]
	speaker=narrator
	message=_ "Instructed on the curse by the court wizards, both Kings knew they had to find and break seals to gain access to the caves. Some scriptures say these seals are guarded by powerful fire elementals."
	[/message]
	[message]
	speaker=narrator
	message=_ "With that in mind, they made camp by the foot of the mountain and started marching their men towards their quest."
	[/message]
[/event]

    [event]
        name=moveto
        [filter]
            side=1,2
            x=5,6,7,8,9,10,11
            y=8,8,9,9,10,10,11
        [/filter]
                [message]
                    speaker=unit
                    message= _ "Sire! These ruins appear to have once been a gate. There is a carved inscription that looks recent!"
                [/message]
                [message]
                    speaker=unit
                    message= _ "It reads «The sentinels guard the only way through the dimensional rift. Only the unliving shall pass while they stand.»"
                [/message]
                [terrain]
                    x=5,8,11
                    y=7,8,10
                    terrain=Cdr
                [/terrain]
                [terrain]
                    x=6,7,9,10
                    y=7,8,9,9
                    terrain=Hd
                [/terrain]
    [/event]

[event]
	name=moveto
        [filter]
            side=1,2
            x=19
            y=2
        [/filter]
		[volume]
		sound=100
		[/volume]
		[sound]
		name="rumble.ogg"
		[/sound]
                [message]
                    speaker=unit
                    message= _ "Something triggered!"
                [/message]
                [terrain]
                    x=20
                    y=2
                    terrain=Qxua^Bsb/
                [/terrain]
[/event]

[event]
	name=moveto
        [filter]
            side=1,2
            x=19
            y=4
        [/filter]
		[volume]
		sound=100
		[/volume]
		[sound]
		name="rumble.ogg"
		[/sound]
                [message]
                    speaker=unit
                    message= _ "Something triggered!"
                [/message]
                [terrain]
                    x=21
                    y=2
                    terrain=Qxua^Bsb/
                [/terrain]
[/event]

    [event]
        name=moveto
        [filter]
            side=1,2
            x=30
            y=6
        [/filter]
		[volume]
		sound=100
		[/volume]
		[sound]
		name="rumble.ogg"
		[/sound]
                [message]
                    speaker=unit
                    message= _ "This seal is broken! The mountain is opening! Stand fast!"
                [/message]

                [terrain]
                    x=29
                    y=7
                    terrain=Uu
                [/terrain]
[/event]

    [event]
        name=moveto
        [filter]
            side=1,2
            x=26
            y=6
        [/filter]
		[volume]
		sound=100
		[/volume]
		[sound]
		name="rumble.ogg"
		[/sound]
                [message]
                    speaker=unit
                    message= _ "This seal is broken! The mountain is opening! Stand fast!"
                [/message]

                [terrain]
                    x=27
                    y=7
                    terrain=Uu
                [/terrain]
    [/event]

[event]
name=die
first_time_only=no   #Not only one enemy leader will die
id=activate_dragon  #This is just to mark this event somehow, because of its later removal.
 [filter]
  canrecruit=yes   #Activate only if a leader dies, otherwise it would be fired uselessly.
 [/filter]
 [if]
  [have_unit]   #Checks if at least one of enemy sides have a leader remaining.
   canrecruit=yes
   side=3,4,5 #List the enemy sides here, 3,4,5 is just a guess from my side
  [/have_unit]
  [else]  #If the condition above fails, therefore there is no enemy leader, the following will be fired
   [event]
    id=activate_dragon   #Removing this event, to prevent it from firing again and creating another dragon
    remove=yes
   [/event]
      [volume]   #Your code.
      sound=100
      [/volume]
      [sound]
      name="dragonstick.ogg"
      [/sound]
                [terrain]
                    x=23-27,25
                    y=27,28
                    terrain=Uu^Dr
                [/terrain]
     
[sound]
name="drake-hit-2.ogg"
[/sound]
[unit]
side=4
canrecruit=yes
type=Fire Dragon
id=Dragon Boss
x,y=25,28
name=Ancient Fire Dragon
unrenamable=yes
max_hitpoints=666
max_experience=2000
[/unit]
                [message]
                    speaker=narrator
                    message= _ "And thus the true overlord showed itself. An ancient Fire Dragon emerged from the depths of the mountain and stood as the final guardian of the curse."
                [/message]
				[message]
                    speaker=Dragon Boss
                    message= _ "Cower in fear, pitiful creatures! The firstborn dragon of old is here to reclaim the world as its legitimate playground!"
                [/message]
				[message]
                    speaker=Iolaire
                    message= _ "By the Great Tree, the firstborn!"
                [/message]
				[message]
                    speaker=Iolaire
                    message= _ "Elves! Stand your ground, stand with me, stand for all that is beautiful and fresh and living!"
                [/message]
				[message]
                    speaker=Ruadrigh
                    message= _ "The dragon of legend... so it is true! The firstborn..."
                [/message]
				[message]
                    speaker=Ruadrigh
                    message= _ "Men! Die by my side, if such is our fate, but fight evil to the last breath!"
                [/message]
  [/else]
 [/if]
[/event]

    [event]
	name=last breath
	[filter]
	id=Iolaire
	[/filter]
	[message]

	speaker=Iolaire
	message= _ "It is... finished..."

	[/message]
	[message]

	speaker=Ruadrigh
	message= _ "I will press on! Men! Honor King Iolaire's memory! Elves! Fight on for your fallen King!"

	[/message]
	[/event]
    
	[event]
	name=last breath
	[filter]
	id=Ruadrigh
	[/filter]
	[message]

	speaker=Ruadrigh
	message= _ "It is... finished..."

	[/message]
	[message]

	speaker=Iolaire
	message= _ "I will press on! Elves! Honor King Iolaire's memory! Men! Fight on for your fallen King!"

	[/message]
	[/event]

[event]
name=die
first_time_only=no
[filter]
id=Dragon Boss
[/filter]
[endlevel]
result=victory
[/endlevel]
[/event]

[event]
name=victory
	[message]
	speaker=narrator
	message=_ "With their victory, present survival was ensured for both their realms... They could now start their voyage back to celebrate their achievement, the breaking of the Desert Curse, and to honor their dead."
	[/message]
	[message]
	speaker=narrator
	message=_ "As for the future, however, that is completely uncertain... for darkness is never truly vanquished and it feeds on the weakness of Men's hearts."
	[/message]
[/event]

[event]
name=defeat
	[message]
	speaker=narrator
	message=_ "With the death of the two Kings, the last hope was gone. The lands of mankind and elfdom were razed forever by the darkness that poured out of the mountain."
	[/message]
	[message]
	speaker=narrator
	message=_ "No one survived to tell of the bravery of this quest. Living men and elves stood their last, side by side, attempting to break the Desert Curse."
	[/message]
[/event]


[/scenario]
User avatar
Straff
Posts: 124
Joined: September 27th, 2020, 2:53 pm

Re: Scenario doesn't load sides from previous

Post by Straff »

Copy the side definitions from the first scenario to the second scenario, because they are complete, while the side definitions in the second scenario are incomplete.

Edit:
In addition, the enemy sides should have an id.
User avatar
Zydin
Posts: 116
Joined: June 24th, 2012, 3:42 pm

Re: Scenario doesn't load sides from previous

Post by Zydin »

Thank you! Do you mean the type? I thought I shouldn't put that, in case the leader levelled up in the first scenario, would that revert its level?

I will add ids to all AIs too!
Straff wrote: May 18th, 2025, 10:49 am Copy the side definitions from the first scenario to the second scenario, because they are complete, while the side definitions in the second scenario are incomplete.

Edit:
In addition, the enemy sides should have an id.
User avatar
Straff
Posts: 124
Joined: September 27th, 2020, 2:53 pm

Re: Scenario doesn't load sides from previous

Post by Straff »

Zydin wrote: May 18th, 2025, 10:58 am Thank you! Do you mean the type? I thought I shouldn't put that, in case the leader levelled up in the first scenario, would that revert its level?
Don't worry about that, that will never happen.
User avatar
Zydin
Posts: 116
Joined: June 24th, 2012, 3:42 pm

Re: Scenario doesn't load sides from previous

Post by Zydin »

It worked! Thank you! :D
Straff wrote: May 18th, 2025, 11:53 am
Zydin wrote: May 18th, 2025, 10:58 am Thank you! Do you mean the type? I thought I shouldn't put that, in case the leader levelled up in the first scenario, would that revert its level?
Don't worry about that, that will never happen.
Post Reply