EarthCake's problems

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
User avatar
EarthCake
Posts: 377
Joined: March 29th, 2019, 1:57 pm
Location: The Wall

EarthCake's problems

Post by EarthCake »

Hello!

I have problem:

I made a 'moveto' event:

Code: Select all

[event]
	name=moveto
	[filter]
		    id=xxxxx
		    [filter_location]
				x={X}
				y={Y}
		    [/filter_location]
	[/filter]
	[endlevel]
		result=victory
		bonus=yes
		{NEW_GOLD_CARRYOVER 40}
        [/endlevel]
[/event]
and I need to prevent this event from happening before ie. turn 14. Otherwise, it ends scenario everytime I stand with "xxxxx" unit on that place. How can I do that?
Last edited by EarthCake on September 9th, 2019, 2:48 pm, edited 2 times in total.
User avatar
EarthCake
Posts: 377
Joined: March 29th, 2019, 1:57 pm
Location: The Wall

Re: EarthCake's problems

Post by EarthCake »

Another problem:

I put two leaders into scenario, and I want that first one I kill doesn't say anything, and second says something like "Argh!".

For now I needed to make one says "Argh", and another one nothing, even if I kill one who says "Argh" first.

How can I do that?
Last edited by EarthCake on June 1st, 2019, 3:25 pm, edited 1 time in total.
User avatar
Ravana
Forum Moderator
Posts: 3000
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: EarthCake's problems

Post by Ravana »

[filter_condition] and check current turn number.

You can check if there are other heroes left before showing message.
User avatar
octalot
General Code Maintainer
Posts: 786
Joined: July 17th, 2010, 7:40 pm
Location: Austria

Re: EarthCake's problems

Post by octalot »

There are many ways to do it. You can add an event during an event, for example a name="turn 14" event could add the moveto.

For the two bosses, I suggest a "last breath" with first_time_only=no and then count the units:

Code: Select all

    [event]
        name="last breath"
        first_time_only=no
        [filter]
            type="Spearman"
        [/filter]
        [if]
            [have_unit]
                type="Spearman"
                count=1
            [/have_unit]
            [then]
                [message]
                    speaker=$unit.id
                    message= _ "Argh, I was the last of us!"
                [/message]
            [/then]
            [else]
                [message]
                    speaker=$unit.id
                    message= _ "My friends will avenge me!"
                [/message]
            [/else]
        [/if]
    [/event]
User avatar
Ravana
Forum Moderator
Posts: 3000
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: EarthCake's problems

Post by Ravana »

Difference between [if] and [filter_condition] comes mainly from whether you want event or action executed multiple times.
User avatar
EarthCake
Posts: 377
Joined: March 29th, 2019, 1:57 pm
Location: The Wall

Re: EarthCake's problems

Post by EarthCake »

Can this work?

Code: Select all

	[event]
		name=moveto
		[filter]
		    	id=xxxxx
		    	[filter_location]
				x=6
				y=46
		    	[/filter_location]
		[/filter]
		[filter]
			greater_than_equal_to=turn 14
		[/filter]
	[/event]
User avatar
Ravana
Forum Moderator
Posts: 3000
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: EarthCake's problems

Post by Ravana »

Second [filter] will never match any unit.
User avatar
EarthCake
Posts: 377
Joined: March 29th, 2019, 1:57 pm
Location: The Wall

Re: EarthCake's problems

Post by EarthCake »

So I need to put it into one filter tag? Like this maybe:

Code: Select all

	[event]
		name=moveto
		[filter]
		    	id=xxxxx
		    	[filter_location]
				x=6
				y=46
		    	[/filter_location]
			greater_than_equal_to=turn 14
		[/filter]
	[/event]	
User avatar
Ravana
Forum Moderator
Posts: 3000
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: EarthCake's problems

Post by Ravana »

Still "greater_than_equal_to=turn 14" results in filter matching no units. greater_than_equal_to is not recognized unit attribute.

You might want [filter_condition][variable]name=turn_number greater_than_equal_to=14 [/variable][/filter_condition]
User avatar
EarthCake
Posts: 377
Joined: March 29th, 2019, 1:57 pm
Location: The Wall

Re: EarthCake's problems

Post by EarthCake »

So should it look like this:

Code: Select all

	[event]
		name=moveto
		[filter]
		    	id=xxxxx
		    	[filter_location]
				x=6
				y=46
		    	[/filter_location]
			[filter_condition]
				[variable]
					name=turn_number
					greater_than_equal_to=14
				[/variable]
			[/filter_condition]
		[/filter]
	[/event]	
I know you are probably annoyed due to my stupidity in WML coding, but I can't help it. (only if this isn't right code)
User avatar
Ravana
Forum Moderator
Posts: 3000
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: EarthCake's problems

Post by Ravana »

Almost.

Code: Select all

	[event]
		name=moveto
		[filter]
		    	id=xxxxx
		    	[filter_location]
				x=6
				y=46
		    	[/filter_location]
		[/filter]
			[filter_condition]
				[variable]
					name=turn_number
					greater_than_equal_to=14
				[/variable]
			[/filter_condition]
	[/event]	
User avatar
EarthCake
Posts: 377
Joined: March 29th, 2019, 1:57 pm
Location: The Wall

Re: EarthCake's problems

Post by EarthCake »

Thanks, it works.
User avatar
EarthCake
Posts: 377
Joined: March 29th, 2019, 1:57 pm
Location: The Wall

Re: EarthCake's problems

Post by EarthCake »

How should I instruct AI? I mean, how I should make player able to access that menu?
User avatar
octalot
General Code Maintainer
Posts: 786
Joined: July 17th, 2010, 7:40 pm
Location: Austria

Re: EarthCake's problems

Post by octalot »

Do you mean the "instruct ally" option on the right-click menu of some scenarios, and the "ask Grüü to move here" in SotBE S03? In 1.14 that's done with AI_CONTROLLER, but the actions don't work as players expect, and so it's been removed in 1.15. #3668, #3066.

The Wiki documents how to configure Micro AIs, so the way forward is probably to configure some tailored to your scenario, and then add a right-cilck menu with [set_menu_item].
User avatar
EarthCake
Posts: 377
Joined: March 29th, 2019, 1:57 pm
Location: The Wall

Re: EarthCake's problems

Post by EarthCake »

Is there any way to give player two choices, and if he chooses one, he dies, and if he chooses second one everything is okay?
Post Reply