how do i change the sides around?

The place to post your WML questions and answers.

Moderators: Forum Moderators, Developers

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.
Lord_Aether
Posts: 127
Joined: November 11th, 2005, 9:06 am
Location: California

Re: cannot find scenario

Post by Lord_Aether » April 20th, 2009, 4:25 am

I believe that passive_leader goes inside a [ai] tag... along with recruitment pattern:

Code: Select all

   [side]
      side=2
      controller=ai
      team_name=2
      user_team_name= _ "Prisoners"
      type=Rogue
      id=Burak
      name=Burak
      unit_description=Burak
      gender=male
      canrecruit=yes
      unrenamable=true


      [ai]
          passive_leader=yes

          #ifdef EASY
          recruitment_pattern=fighter
          #endif
      
          #ifdef MEDIUM
          recruitment_pattern=fighter,fighter,fighter,scout,scout
          #endif
      
          #ifdef HARD
          recruitment_pattern=fighter,fighter,archer,fighter,archer,scout,scout
          #endif
      [/ai]


      x=5
      y=5
      
      {GOLD 100 125 150}
      {INCOME -1 1 3}
      shroud=yes
   [/side]
Mac OS X 10.5.7
Wesnoth 1.6.2

User avatar
CountPenguin
Posts: 132
Joined: May 25th, 2007, 1:13 am
Location: USA

Re: cannot find scenario

Post by CountPenguin » April 20th, 2009, 2:54 pm

Oh... Ok thanks. I probably should have figured that out.
CountPenguin

Currently working on Siege of Soradoc. Except not anymore, but you can take over if you want!

User avatar
CountPenguin
Posts: 132
Joined: May 25th, 2007, 1:13 am
Location: USA

Re: cannot find scenario

Post by CountPenguin » April 21st, 2009, 1:57 am

How do I make a unit on a stored location, instead of an x,y value.

Code: Select all

	[event]
		name=last breath
		[filter]
			id=Ulgor
		[/filter]
		[message]
			speaker=Ulgor
			message= _ "You may have killed me, but you'll never get out of this accursed cave!"
		[/message]
		[store_locations]
			variable=zombieland
			[filter]
				id=Ulgor
			[/filter]
		[/store_locations]
		[kill]
			id=Ulgor
			animate=yes
		[/kill]
		[if]
			[variable]
				name=burak_dead
				boolean_equals=no
			[/variable]
			[then]
				[message]
					speaker=Burak
					message= _ "Rise, fool!"
				[/message]
				[unit]
					type=Walking Corpse
					side=2
					x,y=19,22
					name=Ulgor
					animate=yes
				[/unit]
			[/then]
		[/if]
	[/event]
Here's the last breath event for one enemy leader. You can see that when he dies, a walking corpse is made, but right now, I have it appearing in his keep, not where he died. I put the [store_locations] tag in to get the location of his death, but how do I use that to determine where the zombie is made?
CountPenguin

Currently working on Siege of Soradoc. Except not anymore, but you can take over if you want!

Lord_Aether
Posts: 127
Joined: November 11th, 2005, 9:06 am
Location: California

Re: cannot find scenario

Post by Lord_Aether » April 21st, 2009, 5:18 am

Last breath automatically stores both the unit who died (in the variable "unit") and the unit that killed him (in the variable "second_unit"). You can access the variables like so:

Code: Select all

	[event]
		name=last breath
		[filter]
			id=Ulgor
		[/filter]
		[message]
			speaker=Ulgor
			message= _ "You may have killed me, but you'll never get out of this accursed cave!"
		[/message]

#  Totally unnecessary.
		[store_locations]
			variable=zombieland
			[filter]
				id=Ulgor
			[/filter]
		[/store_locations]
#
		[kill]
			id=Ulgor
			animate=yes
		[/kill]
		[if]
			[variable]
				name=burak_dead
				boolean_equals=no
			[/variable]
			[then]
				[message]
					speaker=Burak
					message= _ "Rise, fool!"
				[/message]
				[unit]
					type=Walking Corpse
					side=2
					x,y=$unit.x,$unit.y   #  This uses the location of the dying unit
					name=Ulgor
					animate=yes
				[/unit]
			[/then]
		[/if]
	[/event]
Mac OS X 10.5.7
Wesnoth 1.6.2

User avatar
zookeeper
WML Wizard
Posts: 9740
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: cannot find scenario

Post by zookeeper » April 21st, 2009, 6:25 am

$unit is stored when it's first used. So if you kill the primary unit first, then try to access $unit, it might not work.

User avatar
CountPenguin
Posts: 132
Joined: May 25th, 2007, 1:13 am
Location: USA

Re: question about [message]

Post by CountPenguin » May 2nd, 2009, 4:14 am

New question: How can I make the speaker of a message be the unit closest to a location/set of locations?
CountPenguin

Currently working on Siege of Soradoc. Except not anymore, but you can take over if you want!

User avatar
Mist
Inactive Developer
Posts: 753
Joined: February 15th, 2007, 8:44 am
Location: Milton Keynes, UK

Re: question about [message]

Post by Mist » May 2nd, 2009, 4:32 am

Code: Select all

<my_variable "">
<my_radius 1>
<while my_variable is empty>
<do>
<store units within my_radius from my_location to variable my_variable>
<increase my_radius>
</do>
</while>
<message with id=$my_variable[0].id says something>
Somewhere, between the sacred silence and sleep.
Disorder.

User avatar
CountPenguin
Posts: 132
Joined: May 25th, 2007, 1:13 am
Location: USA

Re: question about [message]

Post by CountPenguin » May 2nd, 2009, 5:15 am

Ok, I think I sort of understand, here's what I tried (though you can see it's not finished or even playable). I put my questions inside the code:

Code: Select all

	[event]
		name=turn 6
		[set_variable]
			name=flood_radius
			value=0
		[/set_variable]
		[store_locations]
			variable=flood
			terrain=Ww,Wwf,Chw,Ww^Vm
		[/store_locations]
		[store_unit]
			variable=flood_speaker
			[filter_location]
				find_in=flood
			[/filter_location]
		[/store_unit]
		[while]
			##how do i say flood is empty?
			[do]
				[store_unit]
					variable=flood_speaker
					[filter_location]
						find_in=flood
						radius=flood_radius + 1   ##(I know this won't work, what can I do so it does?)
					[/filter_location]
				[/store_unit]
			[/do]
		[/while]
		[message]
			speaker=flood_speaker[0]   ##will this work, or do I need a different tag?
			message= _ "Uh oh, I think the water is rising. We'd better get away from the river before it washes us away..."
		[/message]
	[/event]
Does this look at all right? (beside my ?'s)
CountPenguin

Currently working on Siege of Soradoc. Except not anymore, but you can take over if you want!

User avatar
Sapient
Inactive Developer
Posts: 4453
Joined: November 26th, 2005, 7:41 am
Contact:

Re: question about [message]

Post by Sapient » May 2nd, 2009, 6:12 am

Code: Select all

	[event]
		name=turn 6
		[set_variable]
			name=flood_radius
			value=0
		[/set_variable]
		[store_locations]
			variable=flood
			terrain=Ww,Wwf,Chw,Ww^Vm
		[/store_locations]
		[store_unit]
			variable=flood_speaker
			[filter]
			    [filter_location]
				find_in=flood
			    [/filter_location]
			[/filter]
		[/store_unit]
		[while]
			[variable]
				name=flood_speaker.length
				numerical_equals=0
			[/variable]
			[do]
				[set_variable]
					name=flood_radius
					add=1
				[/set_variable]
				[store_unit]
					variable=flood_speaker
					[filter]
					    [filter_location]
						find_in=flood
						radius=$flood_radius
					    [/filter_location]
					[/filter]
				[/store_unit]
			[/do]
		[/while]
		[message]
			id=$flood_speaker.id
			message= _ "Uh oh, I think the water is rising. We'd better get away from the river before it washes us away..."
		[/message]
	[/event]
try the above
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."

User avatar
zookeeper
WML Wizard
Posts: 9740
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: question about [message]

Post by zookeeper » May 2nd, 2009, 8:00 am

[store_unit] doesn't take a [filter_location].

User avatar
Sapient
Inactive Developer
Posts: 4453
Joined: November 26th, 2005, 7:41 am
Contact:

Re: question about [message]

Post by Sapient » May 2nd, 2009, 8:17 am

zookeeper wrote:[store_unit] doesn't take a [filter_location].
true, didn't spot that one... I have edited my post above
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."

User avatar
CountPenguin
Posts: 132
Joined: May 25th, 2007, 1:13 am
Location: USA

Re: question about [message]

Post by CountPenguin » May 2nd, 2009, 6:50 pm

ok thank you so much. it works perfectly!

and now i need to add something so that the ai will go away from the river too, otherwise they'll die. so can i make something like this?:
[ai]
[avoid]
x,y=$flood.x,$flood.y
[/avoid]
[/ai]

and is there a way to only put this in effect starting on the 6th turn?

thanks!
CountPenguin

Currently working on Siege of Soradoc. Except not anymore, but you can take over if you want!

User avatar
CountPenguin
Posts: 132
Joined: May 25th, 2007, 1:13 am
Location: USA

Re: question about [message]

Post by CountPenguin » May 3rd, 2009, 3:31 pm

How do I fire an event after player one takes their 7th turn? Do I use something with side turn or new turn?
CountPenguin

Currently working on Siege of Soradoc. Except not anymore, but you can take over if you want!

User avatar
Sapient
Inactive Developer
Posts: 4453
Joined: November 26th, 2005, 7:41 am
Contact:

Re: question about [message]

Post by Sapient » May 3rd, 2009, 7:34 pm

Use a side turn event and check [if] side_number equals 2 and turn_number equals 7.
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."

User avatar
CountPenguin
Posts: 132
Joined: May 25th, 2007, 1:13 am
Location: USA

Re: question about [message]

Post by CountPenguin » May 4th, 2009, 12:13 am

Ok thanks. Now I want a new side to come into the scenario on turn eleven. I tried just putting the [side] tag inside an event, but it didn't work (I didn't think it would, but it's worth a try):
Spoiler:
I'm assuming I just have to put the side tag in with the rest of the scenario, but how do I hide their units until turn 11?
CountPenguin

Currently working on Siege of Soradoc. Except not anymore, but you can take over if you want!

Post Reply