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

Tarcils WML Questions

Post by Tarcil »

I finally started to dwell into the WML stuff and successfully created a _main.cfg and a first scenario file which worked fine for some time until I tried to make an moveto event which killed my file. Now I can´t find where to locate the [event] is missing name or id field.
It worked before, but it seems I broke something and really don´t know where it has been gone wrong...I would be gladf if someone could help me.

Code: Select all

[scenario]
 .
 .
 .
 .
 .
 
  [event]
    name=prestart
    [objectives]
      side=1
      [objective]
        description= _ "Defeat the monstrous invaders"
        condition=win
      [/objective]
      [objective]
        description= _ "Death of Rakdan"
        condition=lose
      [/objective]
      [objective]
        description= _ "Turns run out"
        condition=lose
      [/objective]
    [/objectives]
  [/event]

	
  [side]
    side=1
    controller=human
    team_name=1
    user_team_name= _ "Forces of Kharos"

    type=EoMa_Protector
    id=Rakdan
    name= _ "Rakdan"
    gender=male
    canrecruit=yes
    unrenamable=yes

    recruit=EoMa_White_Warrior,EoMa_Cavalry_Archer,EoMa_Shielder,EoMa_Slicer
	#ifdef EASY
		gold= 130
	#endif
	
	#ifdef NORMAL
		gold=150
	#endif
	
	#ifdef HARD
		gold=180
	#endif
    {INCOME 8 5 1}
	[/side] 
	[side]
    side=2
    controller=ai
    team_name=2
    user_team_name= _ "Forces of Tharis"

    type=EoMa_Dark_Wizard
    id=Pylaera
    name= _ "Pylaera"
    canrecruit=yes	
   
		#ifdef EASY
	recruit=EoMa_Black_Orb,EoMa_Disciple,EoMa_Dark_Hunter,EoMa_Dark_Warrior
	recruitment_pattern=fighter,fighter,archer 
	gold=150
	#endif
	
		#ifdef NORMAL
	recruit=EoMa_Black_Orb,EoMa_Disciple,EoMa_Dark_Hunter,EoMa_Dark_Warrior,EoMa_Witch
	recruitment_pattern=fighter,fighter,archer,archer
	gold=220
	#endif
	
		#ifdef HARD
	recruit=EoMa_Black_Orb,EoMa_Disciple,EoMa_Dark_Hunter,EoMa_Dark_Warrior,EoMa_Witch,EoMa_Hydra
	recruitment_pattern=fighter,fighter,archer,archer
	gold=250
	#endif
	
        {INCOME 3 5 10}
		enemy=1
	[/side]
[event]
        name=start
		[unit]
			type=EoMa_Cavalry_Archer
			id=scout
			side=1
			x,y=18,12
			name= _ "Kharosian Scout"
		[/unit]
		[/event]
		[event]
    [message]
      speaker=scout
      message= _ "Monsters! Monsters approaching from the east!"
    [/message]
 
		[message]
		speaker=scout
		message= _ "They kill everything! I barely escaped the slaughter at the eastern outpost..." 
		[/message]
		[message]
		speaker=scout
		message= _ "What shall we do, Commander?"
			[/message]
			[message]
			speaker=Rakdan
			message="Gather the troops and every able bodied townsfolk. I fear this is not only a mere raiding party."
			[/message]
			[message]
			speaker=Rakdan
			message= "Someone also needs to inform the clerics on their island temple. We could really use their healing power and magic abilities."
			[/message]
			[message]
			speaker=Rakdan
			message=_ "Brothers and sisters of Kharos, we need to rise and hold. Darkness dwells from the east and we have to fight! Fight until the sun rise no more!"
			[/message]
		[message]
			speaker=Pylaera
			message= "You will make some fine sacrifices after we captured and tortured you until your screams are echoing over those blood stained fields to please the mighty Destroyers."
         [/message]
		 [message]
			speaker=Rakdan
			message= _ "We shall see, whose blood will be spilled on these fields today. To arms!!"
		[/message]
	
		[objectives]
            side=1
            summary=_"Objectives"
            [objective]
                description= _ "Defeat the enemy leader"
                condition=win
            [/objective]
            [objective]
                description= _ "Death of Commander Rakdan"
                condition=lose
            [/objective]
            {TURNS_RUN_OUT}
            [gold_carryover]
                bonus=yes
                carryover_percentage=40
            [/gold_carryover]
        [/objectives]
[/event]
[/scenario]
Last edited by Tarcil on February 24th, 2023, 2:37 pm, edited 1 time in total.
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: January 24th, 2023, 9:47 pm

Code: Select all

[event]
    [message]
      speaker=scout
      message= _ "Monsters! Monsters approaching from the east!"
    [/message]
. . .
Try adding name=prestart or name=new turn after [event].

Every [event] needs name= on the next line.
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 »

Thx. 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: First scenario created

Post by Tarcil »

I have worked on and now I want the hero only to die AFTER the messenger has escaped as a last stand. The objective change and everything works fine, but when the hero got killed it says [shows_if] is not supported. What do I need to do, that the death of the hero letts the player win the sceanrio AFTER the messenger escaped?

Code: Select all

[event]
	name=die
	[filter_second]
	id=Rakdan
	[/filter_second]
	[message]
	speaker=Rakdan
	message= _ "Urgh....Kharos..will...prevail....Ugh."
	[/message]
	[if]
	{VARIABLE_CONDITIONAL death boolean_equals yes}
	[fire_event]
	name=die2
	[/fire_event]
	[/if]
	[/event]
[event]
	name=die2
	[filter_second]
	id=Rakdan
	[/filter_second]
	[message]
		speaker=Rakdan
		message= I´ll...die for the...sun and for...Kharos...Urgh..
		[/message]
		
	{CLEAR_VARIABLE death}

        [endlevel]
            result=victory
            bonus=no
            {NEW_GOLD_CARRYOVER 0}
        [/endlevel]
[/event]
[/scenario]
Creator of "In Defense of Kharos" viewtopic.php?t=56628
User avatar
Pentarctagon
Project Manager
Posts: 5527
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: First scenario created

Post by Pentarctagon »

[shows_if] isn't a tag - it's [show_if].
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
User avatar
Tarcil
Posts: 97
Joined: October 31st, 2014, 11:46 am

Re: First scenario created

Post by Tarcil »

Ah, thank you. The moment you think you know the tags out of memory is the moment of your downfall...^^
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 »

So, I want the player to lose when the leader dies before the event and to win when the leader dies afterwards.

Code: Select all

[event]
name=moveto
	[filter]
		id=Soroc
		x=2
		y=1
	[/filter]
	[message]
	speaker=Soroc
	message= I will tell the High Council of your deeds and your sacrifice! The people of Kharos shall always remember your noble sacrifice!
	[/message]
	[kill]
		id=Soroc
		animate=no
	[/kill]
	[message]
	speaker=Rakdan
	message= *sad* So it will end here and there shan´t be another day to fight on for us. 
	[/message]
	[message]
	speaker= Rakdan 
	message=But as long as one Kharosian is capable of holding the holy symbol of the sun, its people shall live on. Soldiers of Sunfire and Solveig, CHARGE!!!
	[/message]
	[message]
	speaker= Rakdan
	message= FORWARD!! FORWARD MEN OF KHAROS!! FOR SUN AND LIGHT!!!
	[/message]
	[disallow_recruit]
	type=EoMa_Cavalry_Archer
	side=1
	[/disallow_recruit]
	
	{VARIABLE messenger no}
	{VARIABLE death yes}
	
	[show_objectives]
    [/show_objectives]
[/event]
I tried to do this with this [die] event:

Code: Select all

[event]
	name=die
	[filter_second]
	id=Rakdan
	[/filter_second]
	[message]
	speaker=Rakdan
	message= _ "Urgh....Kharos..will...prevail....Ugh."
	[/message]
	
[if]
   {VARIABLE messenger no}
	{VARIABLE death yes}
    [then]
    [message]
		speaker=Rakdan
		message= _ I´ll...die for the...sun and for...Kharos...Urgh..
		[/message]
		[endlevel]
            result=victory
            bonus=no
            {NEW_GOLD_CARRYOVER 0}
        [/endlevel]
    [/then]
[/if]
[endlevel]
            result=defeat
            bonus=no
            {NEW_GOLD_CARRYOVER 0}
[/endlevel]

[/event]
But It didn´t really worked. and now I don´t know further...
Creator of "In Defense of Kharos" viewtopic.php?t=56628
User avatar
lhybrideur
Posts: 357
Joined: July 9th, 2019, 1:46 pm

Re: First scenario created

Post by lhybrideur »

{VARIABLE ...} sets a variable to something. It does not test it.
To do so you need to use

Code: Select all

[variable]
    name=messenger
    equals=no
[/variable]
[variable]
    name=death
    equals=yes
[/variable]
instead

And I think you want to use a last breath event instead of a die event (but I might be wrong)
User avatar
Celtic_Minstrel
Developer
Posts: 2166
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: First scenario created

Post by Celtic_Minstrel »

If that's too verbose for you there is {VARIABLE_CONDITIONAL messenger boolean_equals no}.

Also, when comparing to yes and no, you should usually use boolean_equals rather than equals.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
User avatar
Tarcil
Posts: 97
Joined: October 31st, 2014, 11:46 am

Re: First scenario created

Post by Tarcil »

Celtic_Minstrel wrote: January 27th, 2023, 1:40 pm If that's too verbose for you there is {VARIABLE_CONDITIONAL messenger boolean_equals no}.

Also, when comparing to yes and no, you should usually use boolean_equals rather than equals.
It worked, thank you!
Creator of "In Defense of Kharos" viewtopic.php?t=56628
User avatar
Tarcil
Posts: 97
Joined: October 31st, 2014, 11:46 am

Tarcils WML Questions

Post by Tarcil »

I want the spawned enemy monster units to sit idly until the player comes in sight. How do I do this?
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: Tarcils WML Questions

Post by Helmet »

Tarcil wrote: January 30th, 2023, 9:18 pm I want the spawned enemy monster units to sit idly until the player comes in sight. How do I do this?
There are a few ways.

The way most people do it is via status, which is the easiest way. Do it when the unit is created:

Code: Select all

[unit]
	type=Giant Rat
	[status]
		guardian=yes
	[/status]
	...etc
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: Tarcils WML Questions

Post by Tarcil »

Helmet wrote: January 30th, 2023, 9:38 pm
Tarcil wrote: January 30th, 2023, 9:18 pm I want the spawned enemy monster units to sit idly until the player comes in sight. How do I do this?
There are a few ways.

The way most people do it is via status, which is the easiest way. Do it when the unit is created:

Code: Select all

[unit]
	type=Giant Rat
	[status]
		guardian=yes
	[/status]
	...etc
Thanks 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 »

Nearly everything for sceanrio 5 works now, but I don´t get the objectives updated after an event as I want them to be. They just stay the same, even as I use a variable:

Code: Select all

	[objectives]
            side=1
            summary=_"Objectives"
            [objective]
			description=Explore the cave and found the exit
			condition=win
			[/objective]
			[objective]
                description= _ "Death of Soroc"
                condition=lose
            [/objective]
			note=Soroc can recruit on 24,69
			[show_if]
			{VARIABLE_CONDITIONAL Tunnel boolean_equals yes}
			{VARIABLE_CONDITIONAL Onward boolean_equals no}
			[/show_if]
		[/objectives]
		[objectives]
			[objective]
			description=Defeat the leader of the deserters OR
			condition=win
			[/objective]
			[objective]
			description=Go to the signpost
			condition=win
			[/objective]
			note=The deserters are desperate and panicking and not necessarily fallen from the grace of the light and sun.
			[show_if]
			{VARIABLE_CONDITIONAL Tunnel boolean_equals no}
			{VARIABLE_CONDITIONAL Onward boolean_equals yes}
			[/show_if]
			
			[gold_carryover]
                bonus=no
                carryover_percentage=40
            [/gold_carryover]
	[/objectives]
[/event]
The evcent changing the objectives:

Code: Select all

[event]
	name=moveto
		{VARIABLE Tunnel no}
		{VARIABLE Onward yes}
	[filter]
	side=1
	[filter_location]
	x,y=14,13
	radius=4
	[/filter_location]
	[/filter]
	[message]
	speaker=Soroc
	message= We got out of those strange tunnels and the fresh air is breathable again!
	[/message]
	[remove_shroud]
	side=1
	x=0-33
	y=0-16
	[/remove_shroud]
	[lift_fog]
	side=1
	x=0-33
	y=0-16
	[/lift_fog]
	[message]
	....
	[/message]

		[gold]
		side=3
		amount=250
		[/gold]
			[show_objectives]
			[/show_objectives]
	[/event]
How do I get the objectives changed after the event??
ANd how do I let surviving units switch their sides (all of them) after their leader dies?
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: First scenario created

Post by Ravana »

You could set new [objectives] instead of [show_objectives]. Or you could learn how delayed_variable_substitution works.
Post Reply