No Leader

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.
michaelan
Posts: 30
Joined: April 21st, 2013, 6:42 pm

No Leader

Post by michaelan »

Hi,
I've been working on a campaign recently, but when I try to test it, the scenario ends in my defeat after I end my turn. To figure out if it was a problem of having a leader, I allowed side 1 to recruit units. When I attempt to recruit a unit, I'm told I have no leader to recruit with, so that probably is the problem.
Anyways, I don't know what I did wrong, but I apparently didn't give side 1 a leader. I would very much appreciate it if someone could please help me with this, thanks.
The sourcecode of side one:

Code: Select all

	[side]
	 type=Cadet
	 id=Armin
	 name= _ "Armin"
	 side=1
	 x=6
	 y=33

	 controller=human
	 team_name=good
	 user_team_name= _ "Armin"

	 role=Leader

	 {IS_HERO}

	 [modifications]
	  {TRAIT_INTELLIGENT}
	  {TRAIT_STRONG}
	 [/modifications]

	 facing=n

	 canrecruit=yes
	 recruit=Cadet

	 gold=100
	 {NO_INCOME}
	[/side]
User avatar
SkyOne
Posts: 1310
Joined: January 3rd, 2009, 7:23 pm

Re: No Leader

Post by SkyOne »

As you mentioned, the side=1 leader (canrecruit=yes) always has to be on the map(s). (if you don't want the leader to recruit, you can leave recruit="" # blank.

Solving your problem, it seems that you just need to reload the save-file from the beginning of the scenario.
These are not necessary, though:

Code: Select all

    role=Leader

    {IS_HERO}
Fate of a Princess/feedback thread: "What is in own heart that is the most important, not who you are."
Drake Campaign: Brave Wings/feedback thread, Naga Campaign: Return of the Monster, Saurian Campaign: Across the Ocean
Northern Forces - now on 1.12 server
michaelan
Posts: 30
Joined: April 21st, 2013, 6:42 pm

Re: No Leader

Post by michaelan »

Yes, I know how to stop him from recruiting. I only allowed the leader to recruit a unit, so I could make sure what the problem is. The game currently doesn't recognize "Armin" as the leader of side 1, and I don't know why.
User avatar
Chief_Chasso
Posts: 132
Joined: December 15th, 2012, 2:36 am

Re: No Leader

Post by Chief_Chasso »

Hi michaelan,
Did you try removing "role=Leader" and {IS_HERO} as SkyOne suggested? That might be the cause.
SP Campaign: Rally For Roanic
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: No Leader

Post by zookeeper »

michaelan wrote:I'm told I have no leader to recruit with, so that probably is the problem.
Can't say I recall ever seeing such a thing. You sure you got your leader on a keep?
michaelan
Posts: 30
Joined: April 21st, 2013, 6:42 pm

Re: No Leader

Post by michaelan »

Yes, I have tried it without the "Role=Leader" and {IS_HERO}. Those originally weren't there, but I added them just in case that would fix it.
Also, this scenario is intended to not have any recruits, but I did add a keep, and I got the same result.
Thank you all for the help. I'm completely stumped.
User avatar
SkyOne
Posts: 1310
Joined: January 3rd, 2009, 7:23 pm

Re: No Leader

Post by SkyOne »

As you started creating it without the leader first, and you put the hex (x,y) in the side tag (that is not necessary, actually), I guess that: - you are missing "Player 1" on the map, aren't you? That is only a possibility I can imagine now.
Fate of a Princess/feedback thread: "What is in own heart that is the most important, not who you are."
Drake Campaign: Brave Wings/feedback thread, Naga Campaign: Return of the Monster, Saurian Campaign: Across the Ocean
Northern Forces - now on 1.12 server
User avatar
Elvish_Hunter
Posts: 1575
Joined: September 4th, 2009, 2:39 pm
Location: Lintanir Forest...

Re: No Leader

Post by Elvish_Hunter »

michaelan wrote:The sourcecode of side one:
I don't see anything wrong in this particular chunk of code. So, I'm starting to suspect that the error lies elsewhere. Please post the code of the whole scenario, and also the code of any custom macro that you're using there.
Current maintainer of these add-ons, all on 1.16:
The Sojournings of Grog, Children of Dragons, A Rough Life, Wesnoth Lua Pack, The White Troll (co-author)
michaelan
Posts: 30
Joined: April 21st, 2013, 6:42 pm

Re: No Leader

Post by michaelan »

Alright, I was reluctant to post the entire scenario, as it's fairly long and unfinished, but I guess I have no other choice. I haven't yet made any custom macros.

Code: Select all

#textdomain wesnoth-The_Peasants'_Crusade
[scenario]
	id="02_The_Exam"
	name= _ "The Exam"
	map_data="{~add-ons/The_Peasants'_Crusade/maps/02_The_Exam.map}"
	next_scenario=03_Homecoming
	turns=20
	victory_when_enemies_defeated=yes
	
	{UNDERGROUND}
	[story]
	 [part]
	  story= _ "As the years went by, Armin studied at the military academy, learning battle tactics and procedure. Eventually, his diligence paid off."
	 [/part]
	 [part]
	  story= _ "Armin had qualified for his final exam. If completed, he would be a licensed sergeant and given his own command. It was time to determine his fate."
	 [/part]
	[/story]
	[side]
	 side=1
	 x=6
	 y=33
	 controller=human
	 team_name=good
	 user_team_name= _ "Armin"
	 type=Cadet
	 id=Armin
	 name= _ "Armin"
	 {IS_HERO}
	 [modifications]
	  {TRAIT_INTELLIGENT}
	  {TRAIT_STRONG}
	 [/modifications]
	 facing=n
	 canrecruit=no
	 gold=100
	 {NO_INCOME}
	[/side]
	[side]
	 side=2
	 x=6
	 y=2
	 controller=null
	 team_name=good
	 user_team_name= _ "Teachers"
	 type=Grand Marshal
	 id=Henry
	 name= _ "Henry"
	 {IS_HERO}
	 canrecruit=no
	 gold=0
	 {NO_INCOME}
	 [unit]
	  type=Silver Mage
	  id=Iris
	  name= _ "Iris"
	  side=2
	  x=4
	  y=3
	  {IS_HERO}
	  role=sexy
	 [/unit]
	 [unit]
	  type=Iron Mauler
	  id=Gruk
	  name= _ "Gruk"
	  side=2
	  x=8
	  y=3
	  {IS_HERO}
	  role=sexy
	 [/unit]
	[/side]
	[side]
	 side=3
	 controller=ai
	 team_name=bad
	 user_team_name= _ "Monsters"
	 no_leader=yes
	 
	 [unit]
	  type=Drake Clasher
	  id=Drake Clasher
	  name= _ "Enemy"
	  side=3
	  x=6
	  y=17
	  role=sexy
	 [/unit]
	 [unit]
	  type=Dark Adept
	  id=Dark Adept
	  name= _ "Enemy"
	  side=3
	  x=5
	  y=17
	  role=sexy
	 [/unit]
	 [unit]
	  type=Dwarvish Ulfserker
	  id=Dwarvish Ulfserker
	  name= _ "Enemy"
	  side=3
	  x=7
	  y=17
	  role=sexy
	 [/unit]
	[/side]
	[event]
	 name=start
	 [music]
    	  name=heroes_rite.ogg
 	 [/music]
	 [message]
	  id=Armin
	  message= _ "Alright, this is it. I need to do this."
	 [/message]
	[/event]
	[event]
	 name=moveto
	 [filter]
	  x=6
	  y=26
	 [/filter]
	 [message]
	  speaker=narrator
	  message= _ "LEADERS MUST BE KNOWLEDGEABLE!"
	 [/message]
	 
	 [message]
	  speaker=narrator
	  message= _ "What terrain do dwarves fight best on?"
	  
	  [option]
	   message= _ "Forest"
	   [command]
	    [message]
	     id=Armin
	     message= _ "Forest?"
	    [/message]
	    [message]
	     speaker=narrator
	     message=_ "Incorrect. You have failed."
	    [/message]
	    [endlevel]
	     result=defeat
	     carryover_report=no
	     linger_mode=no
	    [/endlevel]
	   [/command]
	  [/option]
	     
	  [option]
	   message= _ "Mountains"
	   [command]
	    [message]
	     id=Armin
	     message= _ "The answer is mountains, of course! The forest is for elves."
	    [/message]
	    [message]
	     speaker=narrator
	     message=_ "Correct. Next question..."
	    [/message]
	    [message]
	     speaker=narrator
	     message= _ "What does the weapon special slow do to a target?"
	     [option]
	      message= _ "Halve the chance of dodging"
	      [command]
	       [message]
	        id=Armin
	        message= _ "Halve dodging chance?"
	       [/message]
	       [message]
	        speaker=narrator
	        message= _ "Incorrect. You have failed."
	       [/message]
	       [endlevel]
	        result=defeat
	        carryover_report=no
	        linger_mode=no
	       [/endlevel]
	      [/command]
	     [/option]
	     [option]
	      message= _ "Halve movement speed and attack damage"
	      [command]
	       [message]
	        id=Armin
	        message= _ "The slow status halves movement speed and attack damage. It's a very useful defensive skill."
	       [/message]
	       [message]
	        speaker=narrator
	        message=_ "Correct. Next question..."
	       [/message]
	       [message]
	        speaker=narrator
	        message=_ "What attack type are drakes weakest against?"
	        [option]
	         message= _ "Pierce"
	         [command]
	          [message]
	           id=Armin
	           message=_ "Pierce?"
	          [/message]
	          [message]
	           speaker=narrator
	           message= _ "Incorrect. You have failed."
	          [/message]
	          [endlevel]
	           result=defeat
	           carryover_report=no
	           linger_mode=no
	          [/endlevel]
	         [/command]
	        [/option]
	        [option]
	         message=_ "Cold"
	         [command]
	          [message]
	           id=Armin
	           message=_ "Coldness is the greatest weaknest of the drakes."
	          [/message]
	          [message]
	           speaker=narrator
	           message=_ "Correct. You may proceed."
	          [/message]
	          [message]
	           id=Armin
	           message=_ "I've made it this far. I can do this."
	          [/message]
	         [/command]
	        [/option]
	      [/command]
	   [/command]	
	  [/option]
	 [/message]
	
	[/event]
	 [terrain]
	  x=6
	  y=23
	  terrain="Ur"
	 [/terrain]
	[/event]
[/scenario]
Thank you for the help.
User avatar
SkyOne
Posts: 1310
Joined: January 3rd, 2009, 7:23 pm

Re: No Leader

Post by SkyOne »

Ah, I see...
It looks like you are running BfW 1.11.15 that is not a suitable version to create new campaigns. It doesn't indicate error messages correctly.
If so, updating BfW version to 1.11.16 or 1.11.17 to run the campaign, and removing an extra closing tag in your moveto [event] will probably carry you a better result.
Spoiler:
This is a very rare case...
Fate of a Princess/feedback thread: "What is in own heart that is the most important, not who you are."
Drake Campaign: Brave Wings/feedback thread, Naga Campaign: Return of the Monster, Saurian Campaign: Across the Ocean
Northern Forces - now on 1.12 server
michaelan
Posts: 30
Joined: April 21st, 2013, 6:42 pm

Re: No Leader

Post by michaelan »

Sorry for the late response; I was at a competition.
Anyways, I upgraded to a later version of Wesnoth and fixed the incorrect tags, but I still got the same error.
This is my new scenario code:

Code: Select all

#textdomain wesnoth-The_Peasants'_Crusade
[scenario]

	id="02_The_Exam"
	name= _ "The Exam"
	map_data="{~add-ons/The_Peasants'_Crusade/maps/02_The_Exam.map}"

	next_scenario=03_Homecoming

	turns=20
	victory_when_enemies_defeated=no
	
	{UNDERGROUND}

	[story]
	 [part]
	  story= _ "As the years went by, Armin studied at the military academy, learning battle tactics and procedure. Eventually, his diligence paid off."
	 [/part]

	 [part]
	  story= _ "Armin had qualified for his final exam. If completed, he would be a licensed sergeant and given his own command. It was time to determine his fate."
	 [/part]
	[/story]

	[side]
	 type=Cadet
	 id=Armin
	 name= _ "Armin"
	 side=1
	 x=6
	 y=33

	 controller=human
	 team_name=good
	 user_team_name= _ "Armin"

	 [modifications]
	  {TRAIT_INTELLIGENT}
	  {TRAIT_STRONG}
	 [/modifications]

	 facing=n

	 canrecruit=yes
	 recruit=Cadet

	 gold=100
	 {NO_INCOME}
	[/side]

	[side]
	 side=2
	 x=6
	 y=2
	 controller=null
	 team_name=good
	 user_team_name= _ "Teachers"

	 type=Grand Marshal
	 id=Henry
	 name= _ "Henry"

	 {IS_HERO}

	 canrecruit=no

	 gold=0
	 {NO_INCOME}

	 [unit]
	  type=Silver Mage
	  id=Iris
	  name= _ "Iris"
	  side=2
	  x=4
	  y=3

	  {IS_HERO}

	  role=sexy
	 [/unit]

	 [unit]
	  type=Iron Mauler
	  id=Gruk
	  name= _ "Gruk"
	  side=2
	  x=8
	  y=3

	  {IS_HERO}

	  role=sexy
	 [/unit]

	 [unit]
	  type=Grand Marshal
	  id=Henry
	  name= _ "Henry"
	  side=2
	  x=6
	  y=2

	  {IS_HERO}

	  role=sexy
	 [/unit]
	[/side]

	[side]
	 side=3
	 controller=ai
	 team_name=bad
	 user_team_name= _ "Monsters"

	 no_leader=yes
	 
	 [unit]
	  type=Drake Clasher
	  id=Drake Clasher
	  name= _ "Enemy"
	  side=3
	  x=6
	  y=17

	  role=sexy
	 [/unit]

	 [unit]
	  type=Dark Adept
	  id=Dark Adept
	  name= _ "Enemy"
	  side=3
	  x=5
	  y=17

	  role=sexy
	 [/unit]

	 [unit]
	  type=Dwarvish Ulfserker
	  id=Dwarvish Ulfserker
	  name= _ "Enemy"
	  side=3
	  x=7
	  y=17

	  role=sexy
	 [/unit]
	[/side]

	[event]

         name=prestart

         [objectives]

          side=1

           [objective]

            description= _ "Pass the exam"

            condition=win

           [/objective]

            [objective]

             description= _ "Fail or die during the exam"

             condition=lose

            [/objective]

           [/objectives]

	[/event]

	[event]
	 name=start

	 [music]
    	  name=heroes_rite.ogg
 	 [/music]

	 [message]
	  id=Armin
	  message= _ "Alright, this is it. I need to do this."
	 [/message]
	[/event]

	[event]
	 name=moveto

	 [filter]
	  x=6
	  y=26
	 [/filter]

	 [message]
	  speaker=narrator
	  message= _ "LEADERS MUST BE KNOWLEDGEABLE!"
	 [/message]
	 
	 [message]
	  speaker=narrator
	  message= _ "What terrain do dwarves fight best on?"
	  
	  [option]
	   message= _ "Forest"
	   [command]
	    [message]
	     id=Armin
	     message= _ "Forest?"
	    [/message]
	    [message]
	     speaker=narrator
	     message=_ "Incorrect. You have failed."
	    [/message]
	    [endlevel]
	     result=defeat
	     carryover_report=no
	     linger_mode=no
	    [/endlevel]
	   [/command]
	  [/option]
	     
	  [option]
	   message= _ "Mountains"
	   [command]
	    [message]
	     id=Armin
	     message= _ "The answer is mountains, of course! The forest is for elves."
	    [/message]
	    [message]
	     speaker=narrator
	     message=_ "Correct. Next question..."
	    [/message]
	    [message]
	     speaker=narrator
	     message= _ "What does the weapon special slow do to a target?"

	     [option]
	      message= _ "Halve the chance of dodging"
	      [command]
	       [message]
	        id=Armin
	        message= _ "Halve dodging chance?"
	       [/message]
	       [message]
	        speaker=narrator
	        message= _ "Incorrect. You have failed."
	       [/message]
	       [endlevel]
	        result=defeat
	        carryover_report=no
	        linger_mode=no
	       [/endlevel]
	      [/command]
	     [/option]

	     [option]
	      message= _ "Halve movement speed and attack damage"
	      [command]
	       [message]
	        id=Armin
	        message= _ "The slow status halves movement speed and attack damage. It's a very useful defensive skill."
	       [/message]
	       [message]
	        speaker=narrator
	        message=_ "Correct. Next question..."
	       [/message]
	       [message]
	        speaker=narrator
	        message=_ "What attack type are drakes weakest against?"

	        [option]
	         message= _ "Pierce"
	         [command]
	          [message]
	           id=Armin
	           message=_ "Pierce?"
	          [/message]
	          [message]
	           speaker=narrator
	           message= _ "Incorrect. You have failed."
	          [/message]
	          [endlevel]
	           result=defeat
	           carryover_report=no
	           linger_mode=no
	          [/endlevel]
	         [/command]
	        [/option]

	        [option]
	         message=_ "Cold"
	         [command]
	          [message]
	           id=Armin
	           message=_ "Coldness is the greatest weaknest of the drakes."
	          [/message]
	          [message]
	           speaker=narrator
	           message=_ "Correct. You may proceed."
	           sound=cave-in.ogg
	          [/message]
	          
	          [terrain]
	           x=6
	           y=23
	           terrain="Ur"
	          [/terrain]
	          
	          [message]
	           id=Armin
	           message=_ "I've made it this far. I can do this."
	          [/message]
	          
	          {MOVE_UNIT id=Armin 6 22} 
	          
	          [message]
	          speaker=narrator
	          message=_ "LEADERS MUST BE TACTICAL!"
	          [/message]
	          
	          [unit]
	           type=Drake Clasher
	           id=Clasher
	           name= _ "Ally"
	           side=1
	           x=6
	           y=19
	          [/unit]
	          
	          [unit]
	           type=Dark Adept
	           id=Adept
	           name= _ "Ally"
	           side=1
	           x=5
	           y=20
	          [/unit]
	          
	          [unit]
	           type=Dwarvish Ulfserker
	           id=Ulfserker
	           name= _ "Ally"
	           side=1
	           x=7
	           y=20
	          [/unit]
	         [/command]
	        [/option]
	       [/message]
	      [/command]
	     [/option]
	    [/message]
	   [/command]	
	  [/option]
	 [/message]
	
	[/event]

	[event]
	 name=enemies_defeated

	 [message]
	  id=Armin
	  message=_ "Almost there. Time to finish this!"
	  sound=cave-in.ogg
	 [/message]

	 [terrain]
	 x=6
	 y=13
	 terrain="Ur"
	 [/terrain]

	 {MOVE_UNIT id=Armin 6 12}

	 [message]
	  speaker=narrator
	  message=_ "LEADERS MUST BE COMBATIVE!"
	 [/message]

	 [unit]
	  type=Mudcrawler
	  id=Mudcrawler
	  name= _ "Monster"
	  side=3
	  x=6
	  y=10
	 [/unit] 

	[/event]

	[event]
	 name=attack
	 [filter]
	  id=Armin
	 [/filter]
	 [message]
	  id=Armin
	  message=_ "Advance towards me, Brethren!"
	 [/message]
	[/event]

	[event]
	 name=last_breath
	 [filter]
	  id=Mudcrawler
	 [/filter]
	 [message]
	  id=Mudcrawler
	  message=_ "Gurgle..."
	 [/message]
	[/event]

	[event]
	 name=die
	 [filter]
	  id=Mudcrawler
	 [/filter]
	 [message]
	  id=Armin
	  message=_ "I... I did it!"
	 [/message]
	[/event]

  	 

[/scenario]
Thank you so much for your help. This is a very irritating problem.
User avatar
SkyOne
Posts: 1310
Joined: January 3rd, 2009, 7:23 pm

Re: No Leader

Post by SkyOne »

The same error? :o
The scenario looks like the second one. If the first scenario ends without the leader, it occurs on the second scenario on recent BfW... But I don't think you did it, so could you zip up and attach the entire campaign? In the case, someone can definitely solve your problem.
Fate of a Princess/feedback thread: "What is in own heart that is the most important, not who you are."
Drake Campaign: Brave Wings/feedback thread, Naga Campaign: Return of the Monster, Saurian Campaign: Across the Ocean
Northern Forces - now on 1.12 server
michaelan
Posts: 30
Joined: April 21st, 2013, 6:42 pm

Re: No Leader

Post by michaelan »

The first scenario is dialogue only, so I don't actually know if I the same problem would occur.
Anyways, here's the zipped file:
The_Peasants'_Crusade.zip
(46.82 KiB) Downloaded 134 times
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: No Leader

Post by zookeeper »

So what is the problem?

Presumably you don't lose in the first scenario despite your leader having canrecruit=no because victory is triggered before that in the start event, but once the leader is carried over to the second scenario, he'll still have canrecruit=no regardless of what you put in the [side] tag there, so you'll have no leader and will lose.

EDIT: Also, where did you copy these from?

Code: Select all

{~add-ons/The_Peasants'_Crusade/maps}
{~add-ons/The_Peasants'_Crusade/images}
They will do absolutely nothing (unless you put .cfg files in those directories) so better remove them.
User avatar
SkyOne
Posts: 1310
Joined: January 3rd, 2009, 7:23 pm

Re: No Leader

Post by SkyOne »

Yes. Your leader is canrecruit=no on the first scenario.
Changing it to canrecruit=yes is necessary (after 1.11.12). The enemy leader on the second scenario also should be canrecruit=yes to avoid triggering the enemies defeated [event].

Additionally, if you don't quote here on the main file first_scenario=01_Prologue, it should be id=01_Prologue on the first scenario.
If you quote, first_scenario="01_Prologue", then id="01_Prologue". They should always be the same to avoid a bug on any operating systems (it did not run on Mac, actually).

Also there should not be any spaces on unit's file-names:
Grand MarshalS.cfg --> Grand_MarshalS.cfg
Royal GuardS.cfg --> Royal_GuardS.cfg
Fate of a Princess/feedback thread: "What is in own heart that is the most important, not who you are."
Drake Campaign: Brave Wings/feedback thread, Naga Campaign: Return of the Monster, Saurian Campaign: Across the Ocean
Northern Forces - now on 1.12 server
Post Reply