Invalid side problem

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
revansurik
Posts: 604
Joined: October 17th, 2012, 11:40 pm
Location: Brazil
Contact:

Invalid side problem

Post by revansurik »

Hi folks! I'm having some trouble with the following error: "Error while playing the game: game_error: invalid side(4) found in unit definition", which prevents the scenario from ending. There isn't any side=4 in this scenario, but there was one (with persistent=yes) in the 3 previous scenarios, which the player controls, and which is played with again in the following scenario. From the error message, I thought that there was a side 4 unit in this scenario, but there is none, which makes me think it has something to do with the player-controlled side 4 not being there.
This is the coding of the scenario with the problem; the error message appears right after the last character message appears:

Code: Select all

#textdomain wesnoth-Soldier_of_Wesnoth
[scenario]
    id=30_The_Hand_That_Cuts_The_Other
    name= _ "The Hand that Cuts the Other"
    next_scenario=31_In_The_Name_Of_Justice
    map_data="{~add-ons/Soldier_of_Wesnoth/maps/30_The_Hand_That_Cuts_The_Other.map}"
	victory_when_enemies_defeated=no
    turns=-1
	
    {AFTERNOON}	
	
    {SCENARIO_MUSIC underground.ogg}   

	
    [event]
        name=prestart
        [objectives]
            side=1
            [objective]
                description= _ "Proceed towards the clearing"
                condition=win
            [/objective]
            [objective]
                description= _ "Death of Addraryn"
                condition=lose
            [/objective]

            note={NO_GOLD_CARRYOVER_NOTE}
			
		
        [/objectives]
    [/event]
	
	{THE_HAND_THAT_CUTS_THE_OTHER_STORY}
 
	
    [side]
        {ADDRARYN}
        recruit=Spearman,Bowman,Heavy Infantryman,Cavalryman
		shroud=yes
        gold=0
		income=0
        team_name=wesnothians
        user_team_name=_"North-Western Wesnoth"
	
        {CUSTOM_DG_FLAG}
		
    [/side]


    [side]
        no_leader=yes
        side=2
        recruit=
        team_name=weldyn
		persistent=no
        user_team_name= _ "Weldyn"
        gold=0
		income=0
        {FLAG_VARIANT loyalist}
		
    [ai]
        {ATTACK_DEPTH 3 4 5}
		aggression=0.85
		caution=0.15

    [/ai]		
		
		
    [/side]
	
    [side]
        no_leader=yes
        side=3
        recruit=
        team_name=wesnothians
		persistent=no
        user_team_name= _ "Weldyn"
        gold=0
		income=0
        {FLAG_VARIANT loyalist}
	
    [/side]

	{WHITE_WOOD}
	
    [event]
        name=prestart
		

       {FORCE_CHANCE_TO_HIT side=2 id=Addraryn 10 ()}		
		
    [unit]
            type=Lieutenant
            x=2
            y=9
            id=Gwayn
            name= _ "Gwayn"
            ai_special=guardian
            side=3
    [/unit]

	
    [/event]	




    [event]
        name=start
		
        [message]
            speaker=Gwayn
            message= _ "Halt! Who goes there?"
        [/message]
        [message]
            speaker=Addraryn
            message= _ "I am Addraryn of Allwyn, and I come as an ambassador of the Houses of Eldric and Decthor to the council summoned by Lord Addroran Elfred."
        [/message]
        [message]
            speaker=Gwayn
            message= _ "Addraryn, the Wyvern of Wesnoth...? Y-you may pass, sir..."
        [/message]
        [message]
            speaker=Addraryn
            message= _ "I'm no sir, soldier, I'm just another Wesnothian serving his country, just like you."
        [/message]
	[/event]	
		
		
	[event]	
	
        name=moveto
        [filter]
            side=1
            [filter_location]
                x=9-14
                y=7-15
            [/filter_location]
        [/filter]	
	
	
		
        [message]
            speaker=Addraryn
            message= _ "*The White Woods, formerly known as the Royal Gardens, where Wesnoth’s first kings and queens are buried... It's a gloomy and quiet place indeed, but I don't think this uneasy feeling afflicting me has anything to do with these trees...*"
        [/message]
        [message]
            speaker=Addraryn
            message= _ "*...Calm down, Addraryn, it's too unlikely that he is plotting anything against you, he knows that the uproar would be so great that he wouldn't remain on the throne for a single more week...*"
        [/message]
	[/event]	
		
		
	[event]	
	
        name=moveto
        [filter]
            side=1
            [filter_location]
                x=16
                y=10
            [/filter_location]
        [/filter]	
	
        [message]
            speaker=narrator
			image="scenery/mausoleum01.png"
            message= _ "<i>Here the bodies of King Haldric I and Queen Jessene rest until the day the stars will fall from the Heavens and engulf the world in flames.</i>"
        [/message]
	[/event]

	[event]	
	
        name=moveto
        [filter]
            side=1
            [filter_location]
                x=17
                y=8
            [/filter_location]
        [/filter]	
	
        [message]
            speaker=narrator
			image="scenery/mausoleum01.png"
            message= _ "<i>Here the bodies of King Haldric II and Queen Elga rests until the day the stars will fall from the Heavens and engulf the world in flames.</i>"
        [/message]
	[/event]	
		
	[event]	
	
        name=moveto
        [filter]
            side=1
            [filter_location]
                x=20
                y=12
            [/filter_location]
        [/filter]	
	
        [message]
            speaker=narrator
			image="scenery/mausoleum01.png"
            message= _ "<i>Here the body of King Glyn rests until the day the stars will fall from the Heavens and engulf the world in flames.</i>"
        [/message]
	[/event]	
		
	[event]	
	
        name=moveto
        [filter]
            side=1
            [filter_location]
                x=24
                y=10
            [/filter_location]
        [/filter]	
	
        [message]
            speaker=narrator
			image="scenery/mausoleum01.png"
            message= _ "<i>Here the bodies of King Haldus and Queen Erida rest until the day the stars will fall from the Heavens and engulf the world in flames.</i>"
        [/message]
	[/event]			
		
		
	[event]	
	
        name=moveto
        [filter]
            side=1
            [filter_location]
                x=23
                y=8
            [/filter_location]
        [/filter]	
	
        [message]
            speaker=narrator
			image="scenery/mausoleum01.png"
            message= _ "<i>Here the bodies of King Haldric III and Queen Ethelyann rest until the day the stars will fall from the Heavens and engulf the world in flames.</i>"
        [/message]
	[/event]		
		
		
		
		
		
		
		
		
		
	[event]	
	
        name=moveto
        [filter]
            side=1
            [filter_location]
                x=21
                y=9
				radius=3
            [/filter_location]
        [/filter]	
			
		
        [remove_shroud]
            side=1
            x=14-28
            y=3-13
        [/remove_shroud]		
		
		
        [message]
            speaker=Addraryn
            message= _ "I knew it, there was no Council, after all... SO, ADDRORAN, WILL YOU GIVE ME THE SAME FATE OF LORD MORAN?"
        [/message]

        [delay]
		  time=800
		[/delay]		
		
        [unit]
            {ADDRORAN}
            x=18
            y=1
            side=2
			ai_special=guardian
        [/unit]	

        [unit]
            {ALPHINOR}
            x=17
            y=1
            side=2
			ai_special=guardian
			facing=se
        [/unit]

        {MOVE_UNIT id=Addroran 20 4}	
        {MOVE_UNIT id=Alphinor 18 3}	
		
        [delay]
		  time=800
		[/delay]

        [message]
            speaker=Addroran
            message= _ "Ah, young Addraryn, you have caught me again! Verily, not having you as one of my generals is certainly one of my greatest regrets..."
        [/message]
        [message]
            speaker=Addraryn
            message= _ "Please, spare me the shame of being praised by one such as you."
        [/message]
        [message]
            speaker=Alphinor
            message= _ "Impudent farmer, how dare you hurl such insults at he who has the blood of the Kings of the Distant West with this low-blooded tongue of yours? Dragoons, smite the traitor where he stands!"
        [/message]
		
		
        [move_unit_fake]
            type=Dragoon
            side=2
            x=13,17
            y=2,7
        [/move_unit_fake]
        {GENERIC_UNIT 2 (Dragoon) 17 7}		

        [move_unit_fake]
            type=Dragoon
            side=2
            x=10,17
            y=4,10
        [/move_unit_fake]
        {GENERIC_UNIT 2 (Dragoon) 17 10}	

        [move_unit_fake]
            type=Dragoon
            side=2
            x=14,19
            y=20,12
        [/move_unit_fake]
        {GENERIC_UNIT 2 (Dragoon) 19 12}	

        [move_unit_fake]
            type=Dragoon
            side=2
            x=26,23
            y=20,11
        [/move_unit_fake]
        {GENERIC_UNIT 2 (Dragoon) 23 11}	

        [move_unit_fake]
            type=Dragoon
            side=2
            x=34,25
            y=9,8
        [/move_unit_fake]
        {GENERIC_UNIT 2 (Dragoon) 25 8}		

        [move_unit_fake]
            type=Dragoon
            side=2
            x=26,22
            y=1,5
        [/move_unit_fake]
        {GENERIC_UNIT 2 (Dragoon) 22 5}				
		
		
		
        [message]
            speaker=Addroran
            message= _ "Wait, Alphinor, not yet..."
        [/message]
        [message]
            speaker=Addraryn
            message= _ "Why not yet? Enough with your hypocrisy, Addroran Elfred, just send your henchmen forth and let's get over with it!"
        [/message]
        [message]
            speaker=Addroran
            message= _ "(smiling) You call yourself an equal to Moran, young Addraryn, but you're mistaken, you're much above him; for you have had the heart to raise your fist against me in the first chance, while he bowed to me for years before finally facing me - and this leads me to wonder whether his rebellion was really motivated by just indignation, or merely by that anger which is typical of cornered, leashed animals..."
        [/message]
        [message]
            speaker=Addraryn
            message= _ "I see through your plans, Addroran; you want to unbalance me, so that I may lose my head and hurl myself against your henchmen, but I'm sorry to inform you that I won't fall here... KORRA!"
        [/message]
		
			
        [delay]
		  time=800
		[/delay]		
		
        [unit]
            {AETHUN}
            x=29
            y=4
            side=2
        [/unit]	

        {MOVE_UNIT id=Aethun 23 7}	
		
        [delay]
		  time=800
		[/delay]			
			
        [message]
            speaker=Aethun
            message= _ "Um, if by 'Korra' you mean this gryphon... (throws a decapitated head on the ground)"
        [/message]
		
        [delay]
		  time=600
		[/delay]		
		
        [message]
            speaker=Addraryn
            message= _ "No..."
        [/message]
        [message]
            speaker=Aethun
            message= _ "You who brag that you were taught strategy by Moran shouldn't have committed such a basic mistake as underestimating me, peasant. I foresaw that you would try the same escape you executed in my wedding, and I was proved right when my men found this gryphon hiding nearby..."
        [/message]
        [message]
            speaker=Addraryn
            message= _ "Korra, I'm sorry, I'm..."
        [/message]
        [message]
            speaker=Addroran
            message= _ "And now, Addraryn, should be the moment when I offered you one last chance to surrender and pledge your allegiance to me... But unfortunately it will not work with you, am I right?"
        [/message]
		
       [delay]
		  time=1000
		[/delay]			
		
        [message]
            speaker=Addraryn
            message=_ "(unsheathing his sword) You can bet on that."
        [/message]
        [message]
            speaker=Alphinor
            message=_ "Men, CHARGE!"
        [/message]
		
        [objectives]
            side=1
            [objective]
                description= _ "Find a way to reach Addroran Elfred"
                condition=win
            [/objective]
            [objective]
                description= _ "Kill Earl Aethun"
                condition=win
            [/objective]
            [objective]
                description= _ "Death of Addraryn"
                condition=lose
            [/objective]

            note={NO_GOLD_CARRYOVER_NOTE}
			
		
        [/objectives]		

    [/event]

   [event]
        name=attack
        [filter]
            id=Aethun
        [/filter]		
		
        [message]
            speaker=Aethun
            message= _ "DIE, PEASANT!"
        [/message]
    [/event]

   [event]
        name=last breath
        [filter]
            id=Aethun
        [/filter]		
		
        [message]
            speaker=Aethun
            message= _ "I have... been defeated... by a peasant...?"
        [/message]
    [/event]


	[event]
	        name=die
            first_time_only=no
            [filter]
                side=2
            [/filter]
			
			
    [if]
	    [not]
            [have_unit]
                type=Dragoon
            [/have_unit]
        [/not]			
	    [not]
            [have_unit]
                id=Aethun
            [/have_unit]
        [/not]		
		
		[then]

        [message]
            speaker=Alphinor
            message=_ "How can it be?! How could he have defeated them all?!"
        [/message]
        [message]
            speaker=Addroran
            message=_ "I... I..."
        [/message]
        [/then]
		[/if]
		[/event]	
	

   [event]
        name=attack
        [filter]
            id=Addraryn
        [/filter]	
        [filter_second]
            id=Addroran
        [/filter_second]	

        [message]
            speaker=Addraryn
            message= _ "Now... Prepare to meet your fate, you..."
        [/message]
		
		
        [object]
            id=sceptre
            duration=forever
            silent=yes
            [filter]
                id=Addroran
            [/filter]
            [effect]
                apply_to=type
                name=Human King Sceptre
            [/effect]
        [/object]		
		
        [harm_unit]
            [filter]
                id=Addraryn
            [/filter]

            [filter_second]
                id=Addroran
            [/filter_second]

            [primary_attack]
                name=scepter of fire
            [/primary_attack]
            animate=yes
			kill=no
            amount=80
            alignment=lawful
            damage_type=fire
        [/harm_unit]		
		
        {REPLACE_SCENARIO_MUSIC silence.ogg}			
		
    [delay]
	  time=1000
	[/delay]
		
		
        [message]
            speaker=Addraryn
            message= _ "You... the Sceptre...?"
        [/message]
        [message]
            speaker=Addroran
            message= _ "Exactly, young Addraryn. See, the Sceptre of Fire was left at Weldyn, but the law determined that only the ruler of a unified Wesnoth could wield it. Still, all I had to do was to commission the dwarves to forge an identical replica, whilst I disguised the original as a common royal sceptre."
        [/message]
        [message]
            speaker=Addroran
            message= _ "You may have been my enemy, but I recognize your valour; I hope you will feel honoured to be sent to the Land of the Dead by this kingdom's oldest and noblest symbol."
        [/message]
        [message]
            speaker=Addraryn
            message= _ "Elyniver..."
        [/message]
        [message]
            speaker=Addroran
            message= _ "Farewell, soldier of Wesnoth."
        [/message]
		
		
        [harm_unit]
            [filter]
                id=Addraryn
            [/filter]

            [filter_second]
                id=Addroran
            [/filter_second]

            [primary_attack]
                name=scepter of fire
            [/primary_attack]
            animate=yes
            amount=80
			kill=yes
            alignment=lawful
            damage_type=fire
        [/harm_unit]		
		
    [delay]
	  time=1000
	[/delay]		
		
		
        [message]
            speaker=Alphinor
            message= _ "You have managed to leave absolutely no trace of him, Majesty; now our enemies will be unable to prove that we had any part in Addraryn's disappearance."
        [/message]
        [message]
            speaker=Addroran
            message= _ "I see... But Alphinor, I have to admit that I have the same feeling I had when I heard of Moran's demise: the feeling that, by killing one of Wesnoth's best generals, I have just cut my right hand with the left one..."
        [/message]
        [message]
            speaker=Alphinor
            message= _ "We lost these right hands in the moment they decided to clutch at our throats, Majesty, not when we cut the off."
        [/message]
        [message]
            speaker=Addroran
            message= _ "Fair enough..."
        [/message]
        [message]
            speaker=Addroran
            message= _ "But what is that staff-like artefact in the snow...?"
        [/message]
        [message]
            speaker=Alphinor
            message= _ "Addraryn wielded it until being reduced to ashes; it must be a formidable artefact indeed, to have withheld the Sceptre's full power."
        [/message]
        [message]
            speaker=Addroran
            message= _ "Take it, but beware; it may be imbued with magic against undesired wielders."
        [/message]
		
        {MOVE_UNIT id=Alphinor 19 5}	
				
        [message]
            speaker=narrator
            message= _ "However, as the corrupted Mage of Light seized the staff with his hands covered in his arcane tunic, it simply broke like a putrid branch, and then it became ashes; still, as the artefact disintegrated, both men could hear a strange sound from it, like a faraway lament... The ancient Rod of Justice was no more, its power destroyed by the treacherous killing of its last wielder."
        [/message]
		

        [message]
            speaker=Addroran
            message= _ "Ah, it has been reduced to dust... Maybe it wasn't such a powerful artefact, after all. Now Alphinor, come with me, we have plans to design; now that the peasant is dead, there is nothing uniting Decthor and Eldric, and so we must enjoy this advantage well."
        [/message]
        [message]
            speaker=Alphinor
            message= _ "Yes, Majesty."
        [/message]
		
        {MOVE_UNIT id=Addroran 18 1}
        {MOVE_UNIT id=Alphinor 17 1}
		
		[kill]
		  side=2
		[/kill]
		
		[delay]
		  time=2000
		[/delay]		
		
        {MOVE_UNIT id=Gwayn 17 9}	
		
        [message]
            speaker=Gwayn
            message= _ "*Why... Why has Lord Elfred done that to the man who saved our country...? Can it be that it's just as the wayfarers have been saying, that he is a corrupted ruler who cares nothing for our kingdom...?*"
        [/message]
        [message]
            speaker=Gwayn
            message= _ "*I'm not quite sure of what to believe, but one thing I know: the Wyvern of Wesnoth death must not go unnoticed. I must find a way to reach Dan'Tonk without Lord Elfred's notice...*"
        [/message]		
				
        [endlevel]
            result=victory
            bonus=no
			carryover_report=no
            linger_mode=no
        [/endlevel]	

    [/event]
		
		
		
    [event]
        name=last breath
        [filter]
            id=Addraryn
        [/filter]
        [message]
            speaker=Addraryn
            message= _ "I'm... dying...?"
        [/message]
        [endlevel]
            result=defeat
        [/endlevel]
    [/event]
	
[/scenario]
Author of the Dragon Trilogy.

If you enjoyed A Song of Fire, War of the Jewel, Aria of the Dragon-Slayer and Soldier of Wesnoth, you may like my new project: Star of Chaos, a science-fiction mystery/adventure intended to be a trilogy
;-)
User avatar
Adamant14
Posts: 962
Joined: April 24th, 2010, 1:14 pm

Re: Invalid side problem

Post by Adamant14 »

What BfW version do you use?

If you use 1.11.0 or 1.11.1 then it may be this problem: http://forums.wesnoth.org/viewtopic.php?f=21&t=38043
Author of Antar, Son of Rheor ( SP Campaign) | Development Thread + Feedback Thread + Replays of ASoR
User avatar
revansurik
Posts: 604
Joined: October 17th, 2012, 11:40 pm
Location: Brazil
Contact:

Re: Invalid side problem

Post by revansurik »

I'm using 1.11.4...
Author of the Dragon Trilogy.

If you enjoyed A Song of Fire, War of the Jewel, Aria of the Dragon-Slayer and Soldier of Wesnoth, you may like my new project: Star of Chaos, a science-fiction mystery/adventure intended to be a trilogy
;-)
User avatar
Adamant14
Posts: 962
Joined: April 24th, 2010, 1:14 pm

Re: Invalid side problem

Post by Adamant14 »

I never tested it on later versions, maybe the bug is still there in 1.11.4 ...
I can only tell you how I solved the problem for me.
I removed 'persistent=yes', then the error message was gone and the next scenario started without any problem.
Author of Antar, Son of Rheor ( SP Campaign) | Development Thread + Feedback Thread + Replays of ASoR
User avatar
revansurik
Posts: 604
Joined: October 17th, 2012, 11:40 pm
Location: Brazil
Contact:

Re: Invalid side problem

Post by revansurik »

Followed your hint, Adamant, and it worked :D Thanks very much!
Author of the Dragon Trilogy.

If you enjoyed A Song of Fire, War of the Jewel, Aria of the Dragon-Slayer and Soldier of Wesnoth, you may like my new project: Star of Chaos, a science-fiction mystery/adventure intended to be a trilogy
;-)
User avatar
Adamant14
Posts: 962
Joined: April 24th, 2010, 1:14 pm

Re: Invalid side problem

Post by Adamant14 »

You are welcome.

For the case you haven't already deleted all your saves, then please add them here: https://gna.org/bugs/index.php?20846
Maybe they can help the developers to solve the bug.
Author of Antar, Son of Rheor ( SP Campaign) | Development Thread + Feedback Thread + Replays of ASoR
User avatar
revansurik
Posts: 604
Joined: October 17th, 2012, 11:40 pm
Location: Brazil
Contact:

Re: Invalid side problem

Post by revansurik »

Um, too bad I've deleted them... :-/
Author of the Dragon Trilogy.

If you enjoyed A Song of Fire, War of the Jewel, Aria of the Dragon-Slayer and Soldier of Wesnoth, you may like my new project: Star of Chaos, a science-fiction mystery/adventure intended to be a trilogy
;-)
gfgtdf
Developer
Posts: 1432
Joined: February 10th, 2013, 2:25 pm

Re: Invalid side problem

Post by gfgtdf »

i investigated this problem (on 11.4), and i found out (it took me more than a half hour) this problem appers when a unit is created in:
void store_carryover(game_state& gamestate, playsingle_controller& playcontroller, display& disp, const end_level_data& end_level)
=> carryover_info sides(gamestate.carryover_sides);
=> this->carryover_sides_.push_back(carryover(side));
=> carryover::carryover(const config& side) (explicit operator)
=> recall_list_.push_back(unit(u));

after the scenario is won, because the side= is stored in the carryover data it tried to create a unit with an invalid side.

i think removing the side= attrubute when the unit is stroed for carryover data, or in some of the lines i posted should solve the problem.
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
User avatar
iceiceice
Posts: 1056
Joined: August 23rd, 2013, 2:10 am

Re: Invalid side problem

Post by iceiceice »

I have only skimmed this thread but in case someone is browsing for help to debug their persistence error:

In scenarios in an MP campaign which contain "props" or "stautes" assigned to an AI side, I have often had issues like this, or related "error: creating unit from empty type", which are solved by adding "persistent = no" and "no_leader = yes" to the AI sides.
Post Reply