Tarcils WML Questions

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
Helmet
Posts: 641
Joined: December 19th, 2006, 5:28 pm
Location: Florida, USA

Re: First scenario created

Post by Helmet »

Ravana wrote: January 31st, 2023, 10:34 pm You could set new [objectives] instead of [show_objectives]...
Agree.

The easier way is to copy/paste the first objectives into a new event, and then change the lines you want changed.
Ravana wrote: January 31st, 2023, 10:34 pmOr you could learn how delayed_variable_substitution works.
Yikes. I have two rules regarding delayed_variable_substitution.

1) Try not to use it.
2) Try harder.
Author of:
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
User avatar
beetlenaut
Developer
Posts: 2812
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: First scenario created

Post by beetlenaut »

The wiki wrote:The [objectives] tag overwrites any previously set objectives
You have two [objectives] tags, but you can never get the first because the second one overwrites it immediately.

You could put the two [objectives] tags inside an [if] (rather than the ifs inside the objectives like you have it), or put the [objectives] code down where you have [show_objectives] like Ravana said.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
User avatar
Tarcil
Posts: 97
Joined: October 31st, 2014, 11:46 am

Re: First scenario created

Post by Tarcil »

Ravana wrote: January 31st, 2023, 10:34 pm You could set new [objectives] instead of [show_objectives]. Or you could learn how delayed_variable_substitution works.
Thank you all. Handling all those funny codes had clouded the obvious and easy way. :whistle:
I got it now, but the enemy recruits custom units, instead of the EoMa ones I had assigned to him.

Code: Select all

[side]
	side=3
	controller=ai
	team_name=3
	user_team_name= _ "Kharosian deserters"
	
	type=EoMa_Brown_Warrior
    id=Veollyc
    name= _ "Veollyc"
    gender=male
    canrecruit=yes
    unrenamable=yes
	leader=yes
	recruit= EoMa_White_Warrior,EoMa_Cavalry_Archer
	enemy=1
	gold= -100
	passive_leader=yes
	shroud=no
	{INCOME 1 1 1}
[/side]
Is there anything wrong with my code?? I also got jno error message and it worked fine the sceanrios before..?
Creator of "In Defense of Kharos" viewtopic.php?t=56628
User avatar
Helmet
Posts: 641
Joined: December 19th, 2006, 5:28 pm
Location: Florida, USA

Re: First scenario created

Post by Helmet »

Tarcil wrote: February 1st, 2023, 9:13 am Is there anything wrong with my code?? I also got jno error message and it worked fine the sceanrios before..?
I often introduce bugs when tinkering with recruit lists, so I feel your pain. Oftentimes (in my case, at least) the problem with recruit lists arises from a misunderstanding of what the WML actually does and does not do. Celtic_Minstrel made a great post not long ago that helped clarify the WML. I suggest that you read his clarification and then make sure you had used WML correctly.
Celtic_Minstrel wrote: December 30th, 2022, 3:35 pm Every side has a recruit list. An individual leader also has an optional recruit list. Each leader can recruit anything on either the side recruit list or their personal recruit list.

Modifying a leader's extra_recruit has no effect on the side recruit list. Modifying the side recruit list has no effect on any leader's extra_recruit list. They are two completely independent lists that are combined to get the final recruit list for a given leader.
Also, check to see if you didn't use the wrong id or side somewhere in the body of the code, where the events are happening. That's a simple mistake that can throw a wrench into the works.
Author of:
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
User avatar
Tarcil
Posts: 97
Joined: October 31st, 2014, 11:46 am

Re: First scenario created

Post by Tarcil »

Helmet wrote: February 1st, 2023, 3:01 pm
Also, check to see if you didn't use the wrong id or side somewhere in the body of the code, where the events are happening. That's a simple mistake that can throw a wrench into the works.
It mysteriously worked after restarting a few times without changing anything... :hmm: WIth this bug solved, the next and fifth scenario is up!
Creator of "In Defense of Kharos" viewtopic.php?t=56628
User avatar
beetlenaut
Developer
Posts: 2812
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: First scenario created

Post by beetlenaut »

Tarcil wrote: February 1st, 2023, 3:05 pm It mysteriously worked after restarting a few times without changing anything...
It sounds like you either forgot to reload the cache or loaded the wrong save--only the start of scenario save will reload the WML. I have also forgotten to save the code in the editor before, which has the same effect. (Sorry if this is all too obvious, but I don't really know your experience level.)
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
User avatar
Tarcil
Posts: 97
Joined: October 31st, 2014, 11:46 am

Re: First scenario created

Post by Tarcil »

beetlenaut wrote: February 1st, 2023, 3:23 pm
Tarcil wrote: February 1st, 2023, 3:05 pm It mysteriously worked after restarting a few times without changing anything...
It sounds like you either forgot to reload the cache or loaded the wrong save--only the start of scenario save will reload the WML. I have also forgotten to save the code in the editor before, which has the same effect. (Sorry if this is all too obvious, but I don't really know your experience level.)
I started with WML a week ago, so all of this could very well be possible xDD
Creator of "In Defense of Kharos" viewtopic.php?t=56628
User avatar
Tarcil
Posts: 97
Joined: October 31st, 2014, 11:46 am

Re: First scenario created

Post by Tarcil »

beetlenaut wrote: February 1st, 2023, 3:23 pm
Tarcil wrote: February 1st, 2023, 3:05 pm It mysteriously worked after restarting a few times without changing anything...
It sounds like you either forgot to reload the cache or loaded the wrong save--only the start of scenario save will reload the WML. I have also forgotten to save the code in the editor before, which has the same effect. (Sorry if this is all too obvious, but I don't really know your experience level.)
Ok. I got the same problem again. I restarted the whole campaign, BfW and the computer and even switched the starting scenarios in the .main.cfg but in the last scenario the ai simply recruits whatever it wants.
What do I need to do?
Attachments
Wrong forces.png
Wrong forces.png
Creator of "In Defense of Kharos" viewtopic.php?t=56628
User avatar
Skayland
Posts: 20
Joined: March 27th, 2020, 2:59 am
Location: Somewhere only we know.
Contact:

Re: First scenario created

Post by Skayland »

Tarcil wrote: February 1st, 2023, 9:13 am
Ravana wrote: January 31st, 2023, 10:34 pm You could set new [objectives] instead of [show_objectives]. Or you could learn how delayed_variable_substitution works.
Thank you all. Handling all those funny codes had clouded the obvious and easy way. :whistle:
I got it now, but the enemy recruits custom units, instead of the EoMa ones I had assigned to him.
Hello!
Try

Code: Select all

faction=Custom
inside the side tag ;)

The reason sometimes it works is probably because since the faction is random sometimes it will select the correct one (or one with similar recruits, making it look like it worked)
Practice makes perfect, why don't we practice helping others?
User avatar
Tarcil
Posts: 97
Joined: October 31st, 2014, 11:46 am

Re: First scenario created

Post by Tarcil »

Skayland wrote: February 2nd, 2023, 7:23 pm
Tarcil wrote: February 1st, 2023, 9:13 am
Ravana wrote: January 31st, 2023, 10:34 pm You could set new [objectives] instead of [show_objectives]. Or you could learn how delayed_variable_substitution works.
Thank you all. Handling all those funny codes had clouded the obvious and easy way. :whistle:
I got it now, but the enemy recruits custom units, instead of the EoMa ones I had assigned to him.
Hello!
Try

Code: Select all

faction=Custom
inside the side tag ;)

The reason sometimes it works is probably because since the faction is random sometimes it will select the correct one (or one with similar recruits, making it look like it worked)
Thank you, very much!
Creator of "In Defense of Kharos" viewtopic.php?t=56628
User avatar
Tarcil
Posts: 97
Joined: October 31st, 2014, 11:46 am

Re: First scenario created

Post by Tarcil »

I tried to switch the map with a blackscreen, but my hero don´t reapear after the blackscreen. WHat do I missing there?

Code: Select all

[event]
		name=start
		##story and dialogues to do
		{MOVE_UNIT id=Soroc 19 3}
		[message]
		speaker=Guard_12
		message=Halt! This is the entrance to the holy temple of the sun! What do you want here, soldier?
		[/message]
		##story and dialogues to do
		{FADE_TO_BLACK}
        [hide_unit]
        [/hide_unit]

        [replace_map]
            map="{~add-ons/In_Defense_of_Kharos/maps/Kharos_2.map}"
			expand=yes
			shrink=yes
        [/replace_map]
		[teleport]
            [filter]
                id=Soroc
            [/filter]
            x,y=5,10
            animate=no
        [/teleport]
		
		[unhide_unit]
		id=Soroc
        [/unhide_unit]

        {FADE_IN}

        [remove_shroud]
            side=1
        [/remove_shroud]
		[message]
		speaker=Soroc
		message= _ "Test for now"
		[/message]
	##story continues
	[/event]
Creator of "In Defense of Kharos" viewtopic.php?t=56628
User avatar
Skayland
Posts: 20
Joined: March 27th, 2020, 2:59 am
Location: Somewhere only we know.
Contact:

Re: First scenario created

Post by Skayland »

Hello!
I think your issue is here

Code: Select all

[unhide_unit]
		id=Soroc
[/unhide_unit]
try

Code: Select all

[unhide_unit]
		[filter]
			id=Soroc
		[/filter]
[/unhide_unit]
I might be mistaken though.

Also in your example

Code: Select all

[hide_unit]
[/hide_unit]
you are missing filter id=soroc too. (If he is disappearing maybe you already fixed that though)
Practice makes perfect, why don't we practice helping others?
User avatar
Tarcil
Posts: 97
Joined: October 31st, 2014, 11:46 am

Re: First scenario created

Post by Tarcil »

Hmm...didn´t work.
Creator of "In Defense of Kharos" viewtopic.php?t=56628
User avatar
Celtic_Minstrel
Developer
Posts: 2158
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: First scenario created

Post by Celtic_Minstrel »

Skayland wrote: February 5th, 2023, 8:24 pm (If he is disappearing maybe you already fixed that though)
Actually, an empty [hide_unit] would mean "hide all units on the map".
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
User avatar
Skayland
Posts: 20
Joined: March 27th, 2020, 2:59 am
Location: Somewhere only we know.
Contact:

Re: First scenario created

Post by Skayland »

Celtic_Minstrel wrote: February 5th, 2023, 8:33 pm Actually, an empty [hide_unit] would mean "hide all units on the map".
Oh I see.
Tarcil wrote: February 5th, 2023, 8:01 pm

Code: Select all

[replace_map]
            map="{~add-ons/In_Defense_of_Kharos/maps/Kharos_2.map}"
			expand=yes
			shrink=yes
        [/replace_map]
Maybe the issue is here then
From https://wiki.wesnoth.org/DirectActionsW ... ace_map.5D
shrink: if 'yes', allows the map size to decrease. If the map size is reduced, any units that would no longer be on the map due to its coordinates no longer existing will be put into the recall list.
How big is Kharos_2.map?
Try [teleport] before [replace_map] ??
Practice makes perfect, why don't we practice helping others?
Post Reply