Modify canrecruit in a scenario [Solve]

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
Cluric
Posts: 16
Joined: October 6th, 2012, 7:57 pm

Modify canrecruit in a scenario [Solve]

Post by Cluric »

Hi,

I have a little problem with "canrecruit".
In my scenario, I've an AI player "passive", and next I've an event where I want to make this player "active" and allow him to recruit unit.

Here the definition of the side. "Trolloc" is a kind of unit I've create before. They appear/move/fight perfectly, and as you can see I define "canrecruit=no" and "ai_special = "guardian"" because it could be long before the side 2 be active, and I'll prefer he don't move or recruit units !

Code: Select all

 
[side]
	side=2
        type="Trolloc"
        id="ChefTrolloc2"
        name=_ "Chef Trolloc"
	ai_special = "guardian"
        canrecruit=no
	recruit="Trolloc"
        {GOLD 60 75 90}
        team_name="Engeances"
        user_team_name=_ "Engeances"
        controller=ai
	{INCOME  0 5 10}
 [/side]
Next, I creat an event to "activate" the player.

Code: Select all

    
[event]
     name=moveto
     # When player 1 come near to player 2
     [filter]
          side=1
          x=32-40
          y=19-23
     [/filter]
     [modify_side]
	       side=2
	       canrecruit = yes
     [/modify_side]
     [message]
          # A message which is correcly print to the screen (I check)
    [/message]
 [/event]
However, it didn't works ! I even tried to switch the side 2 to "human", and I found that I can't recruit.

I really don't understand where is the problem. Can somebody help me ?
Last edited by Cluric on October 14th, 2012, 5:39 pm, edited 1 time in total.
User avatar
Dunno
Posts: 773
Joined: January 17th, 2010, 4:06 pm
Location: Behind you

Re: Modify canrecruit in a scenario

Post by Dunno »

I think the problem is, that it's not the side that recruits. It's a unit. So you need to modify a unit in order to let a side recruit. It may be confusing, but when you define a side in [side] tags you also define a unit. Id, type, canrecruit, ai_special even recruit (iirc) all define a unit although they are in the [side] tag. Hope I helped :)
Oh, I'm sorry, did I break your concentration?
Cluric
Posts: 16
Joined: October 6th, 2012, 7:57 pm

Re: Modify canrecruit in a scenario

Post by Cluric »

I know the tag [side] define I also define a new unit. Here there is an unit named "Chef Trolloc" based on the type unit "Trolloc", and identified by the ID "chefTrolloc2. I know too than only this unit gave the ai_special "guardian" but it's not a problem because at the beginning this Chief can't recruit.

I don't think the kind of unit is a problem, because I've a side 3 defined exactly by the same code (except ID, "guardian" and canrecruit), and side 3 works without problem.
When I desactivate fog to see what the AI of side 2 do, I see that indeed it does not move and does not create new units (contrary to side 3).

My event to change that seems to work, because I can see the message, however the side 2 continue to do... nothing.

This is probably due to a stupid mistake on my part but ... I can't find it
User avatar
SkyOne
Posts: 1310
Joined: January 3rd, 2009, 7:23 pm

Re: Modify canrecruit in a scenario

Post by SkyOne »

Dunno probably means that Chef Trolloc doesn't really have to be the leader at the first time. So you can start side=2 with "no_leader=yes". Then modify him to "canrecruit=yes" in the event.

Another way is that put him "canrecruit=yes" + "passive_leader=no" in his [ai] tag, and recruit=blank at the start.
Then at the event, use [allow_recruit] tag to make him recruitable.

There may be another way to do, I think, but my brain doesn't work as well at this moment... because of own 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
Cluric
Posts: 16
Joined: October 6th, 2012, 7:57 pm

Re: Modify canrecruit in a scenario

Post by Cluric »

Skyone, thanks a lot for your answers. I just tried the second method you propose, and It works. My problem is solve but...

I still do not understand why my own method did not work. If someone can explain it to me, it would be helpful.

I'm afraid I have misunderstood something, and I have similar problems in the future.
User avatar
SkyOne
Posts: 1310
Joined: January 3rd, 2009, 7:23 pm

Re: Modify canrecruit in a scenario

Post by SkyOne »

I may be wrong, but "canrecruit=no" is a very unusual action. The game doesn't consider as he/she is the leader.
And this:

Code: Select all

     [modify_side]
          side=2
          canrecruit = yes
     [/modify_side]
needs "id=ChefTrolloc2" in the tag...
This is not an exact answer as I think, though... I am like a zombie currently...
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
JaMiT
Inactive Developer
Posts: 511
Joined: January 22nd, 2012, 12:38 am

Re: Modify canrecruit in a scenario

Post by JaMiT »

Cluric wrote:

Code: Select all

     [modify_side]
	       side=2
	       canrecruit = yes
     [/modify_side]
If you check the documentation for [modify_side], you might notice that canrecruit= is not listed, and (in bold) it is explicitly stated that the listed properties are the only ones that [modify_side] can affect.

Furthermore, canrecruit= is not an attribute of a side (see SideWML -- it's not there), so there is no reason [modify_side] should support that attribute. What it is is an attribute of SingleUnitWML, so what you want to do is modify a unit, not modify a side.
User avatar
Dunno
Posts: 773
Joined: January 17th, 2010, 4:06 pm
Location: Behind you

Re: Modify canrecruit in a scenario

Post by Dunno »

JaMiT wrote:Furthermore, canrecruit= is not an attribute of a side (see SideWML -- it's not there), so there is no reason [modify_side] should support that attribute. What it is is an attribute of SingleUnitWML, so what you want to do is modify a unit, not modify a side.
That is actually what I've been trying to say, but my brain isn't working too fast right now, either. Especially when tackling foreign language :wink:
Oh, I'm sorry, did I break your concentration?
Cluric
Posts: 16
Joined: October 6th, 2012, 7:57 pm

Re: Modify canrecruit in a scenario

Post by Cluric »

Well, another error due to my lack of attention to read the documentation.

Thank you for your explanations, actually there is no reason for "can_recruits" is applicable into the [modify_side].
Sorry, I didn't understand your explanation Dunno.

Problem solve :)
Post Reply