Help with scenario

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
TenshiNoYami
Posts: 7
Joined: July 31st, 2017, 8:29 am

Help with scenario

Post by TenshiNoYami »

Hi,

I'm trying to make a scenario. I've spent three days of it, I'm at the third scenario right now (1 escape, 1 intermission, 1 real battle), but I have two problems, what I can't solve on my own:
1. At the intermission, I renamed the main leader. During that dialog, it was perfect, the ID, etc went through smoothly, but when I declared her in the next scenario, it had 0 experience point. Also, my 'if' doesn't seem to work here (I tried to use it in a modify_unit also)

Code: Select all

[store_unit]
            variable=leader_store
			[filter]
				id=leader
			[/filter]
			kill=yes
        [/store_unit]
		[set_variable]
			name = leader_store.name
			value= _ "new name"
		[/set_variable]
		[set_variable]
			name = leader_store.id
			value=new_name
		[/set_variable]
       [unstore_unit]
            variable=leader_store
		[/unstore_unit]
		{CLEAR_VARIABLE leader_store}
and in the next scenario:

Code: Select all

[side]
        type=Lesser Frostmage
        id=new_name
        name=_ "new name"
        canrecruit=yes
        recruit=Mage,Peasant,Spearman,Bowman
		side=1
		[if]
			[variable]
				name=new_name.experience
				lower_than=30
			[/variable]
			[then]
			[set_variable]
				name=new_name.experience
				value=30
			[/set_variable]
			[/then]
		[/if]			
		color=teal
        controller=human
        team_name=mages
        user_team_name=_"Mages"
    [/side]
2. It's not really a problem, but can I face an unit to a direction without animate_unit? Because In the first few moment, I have a peasant and he is always lifting his hat...

Code: Select all

[animate_unit]
				[filter]
					id=unit
				[/filter]
				[facing]
					x,y=5,14
				[/facing]
[/animate_unit]
Thanks for the help!
User avatar
Ravana
Forum Moderator
Posts: 3002
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Help with scenario

Post by Ravana »

Changing unit id is usually bad idea, code often assumes it is constant.

ActionWML is not mentioned in https://wiki.wesnoth.org/SideWML, so there is no reason why [if] should work there.

Unit has key facing, so should be possible to change with normal unit change tags.
User avatar
skeptical_troll
Posts: 500
Joined: August 31st, 2015, 11:06 pm

Re: Help with scenario

Post by skeptical_troll »

Beside what Ravana said, the persistent side is looked for by the id of the leader, so if it is different from the previous scenario it will just start a new side with a fresh leader (you check the recall list to see if this is the case). Just modify the name and not the id and everything will be easier.
TenshiNoYami
Posts: 7
Joined: July 31st, 2017, 8:29 am

Re: Help with scenario

Post by TenshiNoYami »

Thanks for both of you. I could do what I wanted there.
TenshiNoYami
Posts: 7
Joined: July 31st, 2017, 8:29 am

Re: Help with scenario..again

Post by TenshiNoYami »

Hello,

I have an other question: can I set an area somehow in event:moveto to set a zone when side 1 enters, triggers it. I tried it with radius, but it doesn't seem to work.

Code: Select all

[event]
		name=moveto
        first_time_only=yes
		[filter]
			side=1
			[filter_location]
				x,y=24,4
				radius=4
			[or]
				x,y=28,9
				radius=4
			[/or]
			[or]
				x,y=34,9
				radius=4
			[/or]
			[/filter_location]
		[/filter]
		
		[message]
			side2 message here
		[/message]
		
		[gold]
			amount=100
			side=2
		[/gold]
	[/event]
Thanks again
Tad_Carlucci
Inactive Developer
Posts: 503
Joined: April 24th, 2016, 4:18 pm

Re: Help with scenario

Post by Tad_Carlucci »

I wasted a day, one time, fighting with radius. It works, but it's finicky. I swore "never again" and suggest just specifying each tile explicitly.

Somewhere I saw a comment that radius was slow, too. I never checked that but expect, when compared to an explicit list, it obviously would be.
I forked real life and now I'm getting merge conflicts.
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: Help with scenario

Post by zookeeper »

What your location filter asks for:

Any location that's (within 4 hexes of (24,4 or (any location within 4 hexes of 28,9 or (any location within 4 hexes of 34,9)))).

And that's because radius is applied last, after [or]/[and]/[not].
TenshiNoYami
Posts: 7
Joined: July 31st, 2017, 8:29 am

Re: Help with scenario

Post by TenshiNoYami »

zookeeper wrote:What your location filter asks for:

Any location that's (within 4 hexes of (24,4 or (any location within 4 hexes of 28,9 or (any location within 4 hexes of 34,9)))).

And that's because radius is applied last, after [or]/[and]/[not].
Thanks, I combined the two comments, and result is working:

Code: Select all

[filter]
			side=1
			[filter_location]
				x=24,28,34
				y=4,9,9
				radius=4
			[/filter_location]
		[/filter]
Post Reply