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
Tarcil
Posts: 97
Joined: October 31st, 2014, 11:46 am

Re: First scenario created

Post by Tarcil »

Skayland wrote: February 5th, 2023, 8:38 pm
Try [teleport] before [replace_map]??
Thank you, this actually worked!
Creator of "In Defense of Kharos" viewtopic.php?t=56628
User avatar
beetlenaut
Developer
Posts: 2814
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: First scenario created

Post by beetlenaut »

Tarcil wrote: February 5th, 2023, 8:54 pm Thank you, this actually worked!
You seem surprised. Do you understand why? It's because your second map doesn't have any hex at 19,3, so your hero gets removed when you replace the map. However, if you [teleport] him first, his hex doesn't disappear. (You should use map_file= in [replace_map]. Using map= still works, but I think it is not supposed to. It could get removed at any time.)
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 6th, 2023, 8:56 am
Tarcil wrote: February 5th, 2023, 8:54 pm Thank you, this actually worked!
You seem surprised. Do you understand why? It's because your second map doesn't have any hex at 19,3, so your hero gets removed when you replace the map. However, if you [teleport] him first, his hex doesn't disappear. (You should use map_file= in [replace_map]. Using map= still works, but I think it is not supposed to. It could get removed at any time.)
Thank you for the explanation, I understand it now. Sounds logically. ^^
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 want the allied leader to appear only on turn 4 (with his keep). How do I get him spawned only then? I tried to hide and store him, but he still flew around. DO I need to use a Variable and if yes, how?
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!
There is probably many methods to do this but some are dependant on your knowledge of the unit
You can for example hide the unit hide_unit and then modify his moves and max_moves to 0 with modify_unit. But this is only good if you know the unit type. Otherwise you won't know how many moves to restore when the unit appears without extra unecessary logic.

If the unit comes from a previous scenario you should store it at the end of the level store_unit and then unstore_unit when you need it. This is probably the most elegant solution.

The simplest solution is to create him at turn X with unit, it doesn't need to be inside the side tag to work because unit has a side subtag you can use, side=3. If the side has no other leaders you might want no_leader=yes inside the side tag. There might be reasons for you to have him predefined, but if not: consider this solution.

Regardles of what you do you will need A turn X event.
Practice makes perfect, why don't we practice helping others?
User avatar
Tarcil
Posts: 97
Joined: October 31st, 2014, 11:46 am

Tarcils WML Questions

Post by Tarcil »

How do I get a picture being displayed behind the story parts?

Code: Select all

background 
dont seem to work...
Creator of "In Defense of Kharos" viewtopic.php?t=56628
User avatar
beetlenaut
Developer
Posts: 2814
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: Tarcils WML Questions

Post by beetlenaut »

It's not background that's the problem. Make sure that you put it inside a [part] and that your path and [binary_path] are correct. Those are just guesses. If you show us all the [story] code, we would probably be able to tell you the issue. (If you are using a custom image, you can verify that your code is mostly right by trying a mainline image instead.)
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: Tarcils WML Questions

Post by Tarcil »

Code: Select all

[scenario]

[story]
	[part]
	story= The people of Kharos were a peacful and pious folk who worshipped the sun and the light it gave to them ruled by a theocracy who resides in the main temple of the sun in the mighty city of Kharos.
	show_title=yes
	title= Darkness arrives
	background=~add-ons/To_Lands_Unknown_Resources_2/images/map/map-element-land-kharos.png
	[/part]
	[part]
	story= A time of peace had set in since a few decades after the last remnants of tribal quarries were overcome by the hard, but just fist of the Sun Guardians of Kharos. Since those times, Kharos enjoyed time of peace and tranquility.
	show_title=yes
	title= Darkness arrives
	[/part]
	[part]
	story= But alas, every time comes to an end and nothing lasts for eternity apart of the sun itself.  And so Kharos soon finds itself in a fight for their survival amidst blood and smoke.
	show_title=yes
	title= Darkness arrives
	[/part]
	[part]
	story= It all began on a sunny day at the eastern border town of Solveig, nestled on the banks of the sunflower river, which marks the border of 	the kharosian lands.  East of the river soon lays a barren wasteland, where only outlaws and monsters dwell. 
	show_title=yes
	title= Darkness arrives
	[/part]
	[part]
	story= _ "Or so the Kharosians believed..."
	show_title=yes
	title= Darkness arrives
	[/part]
	[/story]
Thats the story code of the first scenario.
Creator of "In Defense of Kharos" viewtopic.php?t=56628
User avatar
beetlenaut
Developer
Posts: 2814
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: Tarcils WML Questions

Post by beetlenaut »

When you use an image file in WML, you need to leave off the path up through the "images" folder because it is being automatically added. Your path should be only be the map/map-element-land-kharos.png part. However, since the ~add-ons/To_Lands_Unknown_Resources_2/images/ part is not from the BfW core data, you need to add a [binary_path] for that. The [binary_path] tells the game where to look besides its core images folder.
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: Tarcils WML Questions

Post by Tarcil »

beetlenaut wrote: February 24th, 2023, 5:22 pm When you use an image file in WML, you need to leave off the path up through the "images" folder because it is being automatically added. Your path should be only be the map/map-element-land-kharos.png part. However, since the ~add-ons/To_Lands_Unknown_Resources_2/images/ part is not from the BfW core data, you need to add a [binary_path] for that. The [binary_path] tells the game where to look besides its core images folder.

Where do I have to add the [binary_path]? Directly below or anywhere else?
Creator of "In Defense of Kharos" viewtopic.php?t=56628
User avatar
beetlenaut
Developer
Posts: 2814
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: Tarcils WML Questions

Post by beetlenaut »

Put it in _main.cfg inside the campaign's #ifdef. Look at any mainline campaign to see how it should look.
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: Tarcils WML Questions

Post by Tarcil »

Thank you, it worked!
Creator of "In Defense of Kharos" viewtopic.php?t=56628
User avatar
Tarcil
Posts: 97
Joined: October 31st, 2014, 11:46 am

Re: Tarcils WML Questions

Post by Tarcil »

I want the player to win after he killed all enemy units, but somehow the player immedieately wins after the start event:

Code: Select all

[event]
        name=die
        first_time_only=no
        [filter]
            side=3
      [/filter]
        [if]
           [have_unit]
                side=3
          [/have_unit]
           [then]
           [/then]
            [else]
			[message]
			speaker=Soroc
			message= _ "They are finally dead!"
			[/message]
			
			.............
			
			[sound]
            name=ambient/ship.ogg
			[/sound]

        [move_unit_fake]
            type=Galleon
            side=2
            x=39,50
            y=33, 55
        [/move_unit_fake]

		[message]
		speaker= Soroc
		message= _ "There he goes to search for a long forgotten tribe. May the sun have mercy upon him in this desert..."
		[/message]
				
               [endlevel]
                    result=victory
                    bonus=no
                    {NEW_GOLD_CARRYOVER 40}
                    carryover_report=yes
               [/endlevel]
            [/else]
         [/if]
     [/event]
Creator of "In Defense of Kharos" viewtopic.php?t=56628
User avatar
Ravana
Forum Moderator
Posts: 2949
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Tarcils WML Questions

Post by Ravana »

What you posted is not related to your question.
User avatar
Tarcil
Posts: 97
Joined: October 31st, 2014, 11:46 am

Re: Tarcils WML Questions

Post by Tarcil »

Ravana wrote: February 25th, 2023, 11:27 am What you posted is not related to your question.
Ok, I thought that this would work and trigger when the last unit of side 3 has died. Should I post the start [event]?
edit: Have found the issue: Had to set victory when enemies defeated to no
Creator of "In Defense of Kharos" viewtopic.php?t=56628
Post Reply