Campaign won't start

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.
User avatar
matsjoyce
Posts: 233
Joined: May 8th, 2011, 2:10 pm
Location: UK

Re: Campaign won't start

Post by matsjoyce »

I did that but the ai does not go back to its starting position.
User avatar
matsjoyce
Posts: 233
Joined: May 8th, 2011, 2:10 pm
Location: UK

Re: Campaign won't start

Post by matsjoyce »

Could you do a move unit like code but the ai only does that like when it has enough moves to do that?
User avatar
matsjoyce
Posts: 233
Joined: May 8th, 2011, 2:10 pm
Location: UK

Re: Campaign won't start

Post by matsjoyce »

Is the leader of a side the one that can recruit?
User avatar
Crendgrim
Moderator Emeritus
Posts: 1328
Joined: October 15th, 2010, 10:39 am
Location: Germany

Re: Campaign won't start

Post by Crendgrim »

Yes.
Actually, it is even possible to have multiple leaders; but you're right that each leader (and only the leader(s)) is able to recruit units (if you allow him to do so, of course).


Crend
UMC Story Images — Story images for your campaign!
User avatar
SkyOne
Posts: 1310
Joined: January 3rd, 2009, 7:23 pm

Re: Campaign won't start

Post by SkyOne »

Crendgrim wrote:it is even possible to have multiple leaders
He is on 1.8 though.:wink:
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: 1600
Joined: September 4th, 2009, 2:39 pm
Location: Lintanir Forest...

Re: Campaign won't start

Post by Elvish_Hunter »

SkyOne wrote:He is on 1.8 though.:wink:
Actually, on 1.8 I had one scenario of TSoG with two leaders. Support for multiple leaders was enabled during the 1.7 development cycle. :eng:
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)
User avatar
matsjoyce
Posts: 233
Joined: May 8th, 2011, 2:10 pm
Location: UK

Re: Campaign won't start

Post by matsjoyce »

So if I had Sir Boris (who can't recruit because otherwise he won't attack) would not obey leader goals? If so, how could I get the ai to move him to get a new lance?
And just to be inquisitive, if there is more than one leader, will the ai move all the leaders the the leader goal or just one?
User avatar
SkyOne
Posts: 1310
Joined: January 3rd, 2009, 7:23 pm

Re: Campaign won't start

Post by SkyOne »

Elvish_Hunter wrote:
SkyOne wrote:He is on 1.8 though.:wink:
Actually, on 1.8 I had one scenario of TSoG with two leaders. Support for multiple leaders was enabled during the 1.7 development cycle. :eng:
Uh-oh, you are right.
My memory was that having two leaders in the same side got a defeated condition. It was probably on before 1.7.15... (I just tested it on 1.7.15.)
Excuse me, Crendgrim.
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
matsjoyce
Posts: 233
Joined: May 8th, 2011, 2:10 pm
Location: UK

Re: Campaign won't start

Post by matsjoyce »

I tried

Code: Select all

 [event]
           name=attacker hits
            first_time_only=no
            [filter]
                id=Sir_Boris
            [/filter]
	    [filter_attack]
	      name=lance
	    [/filter_attack]
		[set_variable]
		    name=lanceb
		    rand="0..2"
		[/set_variable]
		[if]
		    [variable]
			name=lanceb
			greater_than=0
		    [/variable]
		    [then]
		      [object]
		      silent=yes
			[effect]
			  apply_to=remove_attacks
			  type=pierce
			[/effect]
		      [/object]
		      [message]
			id=Sir_Boris
			message=_"Aw, my lance has snapped."
		      [/message]
		      [store_unit] #to stop the unit attack
			  [filter]
			    id=Sir_Boris
			  [/filter]
			  variable=stored_sir_boris
			  kill=yes
		      [/store_unit]
		      [unstore_unit]
			  variable=stored_sir_boris
		      [/unstore_unit]
		      [modify_side]
			  side=2
{TARGET_LOCATION_J 2 18 5 -100.0}
		      [/modify_side]
		    [/then]
		    [else]
		    [/else]
		[/if]
        [/event]
and the macro is

Code: Select all

#define TARGET_LOCATION_J X Y VALUE VALUE_AGGESSION
[goal]
  name=target_location
  [criteria]
    x={X}
    y={Y}
  [/criteria]
  value={VALUE}
[/goal]
[aspect]
        id=aggression
        [facet]
            id="always"
            value={VALUE}
        [/facet]
    [/aspect]
#enddef
but Sir Boris still doesn't go to the starting position. :cry:
User avatar
Crendgrim
Moderator Emeritus
Posts: 1328
Joined: October 15th, 2010, 10:39 am
Location: Germany

Re: Campaign won't start

Post by Crendgrim »

Can [url=http://wiki.wesnoth.org/DirectActionsWML#.5Bmodify_side.5D][modify_side][/url] have the subtags goal or aspect? No. So, look again at the wiki how it should be done.


Crend
UMC Story Images — Story images for your campaign!
User avatar
matsjoyce
Posts: 233
Joined: May 8th, 2011, 2:10 pm
Location: UK

Re: Campaign won't start

Post by matsjoyce »

How can you have a non-leader (one for all units) than? All that is there is leader goal and Sir Boris isn't a leader.
User avatar
Crendgrim
Moderator Emeritus
Posts: 1328
Joined: October 15th, 2010, 10:39 am
Location: Germany

Re: Campaign won't start

Post by Crendgrim »

I have no idea whether this works, but I would try to use [modify_unit] and set goto_x= and goto_y= to the location where Sir Boris should return to.


Crend
UMC Story Images — Story images for your campaign!
User avatar
matsjoyce
Posts: 233
Joined: May 8th, 2011, 2:10 pm
Location: UK

Re: Campaign won't start

Post by matsjoyce »

Would

Code: Select all

[event]
name=side 2 turn $turnattack 
actuly start the event or can't you use vars in event names?
User avatar
Pentarctagon
Project Manager
Posts: 5730
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Campaign won't start

Post by Pentarctagon »

Test it out yourself. You should post for help if you can't figure something out, not for every question you have.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
User avatar
matsjoyce
Posts: 233
Joined: May 8th, 2011, 2:10 pm
Location: UK

Re: Campaign won't start

Post by matsjoyce »

I did try it out and it doesn't work. I came up with this but it doesn't work either. What it's supposed to do is at the start of side 2 turn check if the lanceb var is greater than 0 (which if it is, it means that Sir Boris's lance has snapped) and if it is, then move him to 2,18 and set his moves to 0.

Code: Select all

 [event]
           name=attacker hits
            first_time_only=no
            [filter]
                id=Sir_Boris
            [/filter]
	    [filter_attack]
	      name=lance
	    [/filter_attack]
		[set_variable]
		    name=lanceb
		    rand="0..2"
		[/set_variable]
		[if]
		    [variable]
			name=lanceb
			greater_than=0
		    [/variable]
		    [then]
		      [object]
		      silent=yes
			[effect]
			  apply_to=remove_attacks
			  type=pierce
			[/effect]
		      [/object]
		      [message]
			id=Sir_Boris
			message=_"Aw, my lance has snapped."
		      [/message]
		      [store_unit] #to stop the unit attack
			  [filter]
			    id=Sir_Boris
			  [/filter]
			  variable=stored_sir_boris
			  kill=yes
		      [/store_unit]
		      [unstore_unit]
			  variable=stored_sir_boris
		      [/unstore_unit]
		[clear_variable]
			name=stored_sir_boris
		[/clear_variable]
		    [/then]
		    [else]
		    [/else]
		[/if]
        [/event]
[event]
name=side 2 turn refresh
first_time_only=no
[if]
		    [variable]
			name=lanceb
			greater_than=0
		    [/variable]
[than]
{MOVE_UNIT (id=Sir_Boris) 2 18}
		[store_unit]
			[filter]
				id=Sir_Boris
			[/filter]
			variable=stored_sir_boris
		[/store_unit]
		[set_variable]
			name=stored_sir_boris.moves
			value=0
		[/set_variable]
		[unstore_unit]
			variable=stored_sir_boris
		[/unstore_unit]
		[clear_variable]
			name=stored_sir_boris
		[/clear_variable]
[/than]
[/if]
[/event]
Post Reply