Different WML questions for my campaign!

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
Turgon
Posts: 59
Joined: September 30th, 2011, 6:13 pm
Location: Germany

Different WML questions for my campaign!

Post by Turgon »

Hello guys,

for my campaign (see link in the description) I am in desperate need of some information concerning recall.
For the beginning it would be sufficient to know how I can delete a certain unit from the recall list but make the game store the unit. I want it to appear later on in the scenario.
Last edited by Turgon on June 7th, 2012, 12:09 pm, edited 1 time in total.
Looking for feedback for my dramatic campaign "A story of three villages", a late-age men vs. undead story going to include vampires and werewolves: http://forums.wesnoth.org/viewtopic.php?f=8&t=36193
User avatar
Crendgrim
Moderator Emeritus
Posts: 1328
Joined: October 15th, 2010, 10:39 am
Location: Germany

Re: I need help with recall-WMLs

Post by Crendgrim »

You should be able just to do something like this if I'm not mistaken:

Code: Select all

[store_unit]
  [filter]
    id=id-of-your-unit
  [/filter]
  kill=yes
  variable=stored_unit_from_recall_list
[/store_unit]
And later then just unstore the unit (but be sure to specify its coordinates then, so that it won't end up on the recall list again).
UMC Story Images — Story images for your campaign!
Turgon
Posts: 59
Joined: September 30th, 2011, 6:13 pm
Location: Germany

Re: I need help with recall-WMLs

Post by Turgon »

I tried this, but it didn't work properly.
Here's what I did to remove the unit: I used the [store_unit] order inside of my [side] tag.

Code: Select all

[side]
        type="Fencer"
        id="Tyrell"
        canrecruit=yes
        name=_ "Tyrell"

        side=1
        controller=human
        {GOLD 300 250 200}
        income=2
        team_name="good guys"
        user_team_name=_ "good guys"
        fog=no
        shroud=no
        recruit="Fencer, Footpad, Spearman, Bowman, Mage, Cavalryman"
		
		{NAMED_LOYAL_UNIT 1 "" 35 19 "Torell" (_ "Torell")} # wmllint: recognize Torell
		
		[store_unit]
  [filter]
    id=Gunther
  [/filter]
  kill=yes
  variable=stored_Gunther
[/store_unit]

    [/side]
Then I had the unstore-element in an [event]-Tag:

Code: Select all

[event]
        name=turn 16
		
		[message]
            race=human
            message=_ "Ain't there something?"
        [/message]
		[message]
            race=human
            message=_ "I can hear trumpets and warhorns."
        [/message]
		[message]
            race=human
            message=_ "And I can hear trampling horses to the north."
        [/message]
		
		[unstore_unit]
    variable= stored_Gunther
    find_vacant=yes 
	x=34
	y=1
[/unstore_unit]
...
...
...
[/event]
It didn't work out, though. Gunther was still in the recall list, but otherwisely acted normal regarding dialogue lines and so on, once I recruited him...
Looking for feedback for my dramatic campaign "A story of three villages", a late-age men vs. undead story going to include vampires and werewolves: http://forums.wesnoth.org/viewtopic.php?f=8&t=36193
User avatar
Crendgrim
Moderator Emeritus
Posts: 1328
Joined: October 15th, 2010, 10:39 am
Location: Germany

Re: I need help with recall-WMLs

Post by Crendgrim »

That won't work, of course. [wiki=SideWML][side][/wiki] does not allow ActionWML to be placed inside it.
You could place the [store_unit] in a prestart event, though, that should work.
UMC Story Images — Story images for your campaign!
Turgon
Posts: 59
Joined: September 30th, 2011, 6:13 pm
Location: Germany

Re: I need help with recall-WMLs

Post by Turgon »

Okay, now it works. Still I have some stupid problems. If you can help me with any of it, I'll be grateful.

1. I have some lines of text which are to be said by different soldiers, but one single soldier says all of them. What can I do to split them up?

Code: Select all

[message]
            side=1
            message=_ "Ain't there something?"
        [/message]
		[message]
            side=2
            message=_ "I can hear trumpets and warhorns."
        [/message]
		[message]
            side=1
            message=_ "And I can hear trampling horses to the north."
        [/message]
2. One of my events comes with new objectives. But instead of displaying the new objectives, the game only shows the old objectives from the beginning...

Code: Select all


[event]
        name=turn 16
		
...
...
...
...
		[objectives]
            side=1
            [objective]
                condition=win
                description=_ "Defeat the vengeful necromancer Philip"
            [/objective]
            [objective]
                condition=lose
                description=_ "Death of Tyrell"
            [/objective]
			[objective]
                condition=lose
                description=_ "Death of Torell, Roddy, Gunther or Lord Paramount Galdwin"
            [/objective]
			
			[objective]
                description=_ "Time runs out"
                condition=lose
            [/objective]
			
            [gold_carryover]
                bonus=no
                carryover_percentage=0
            [/gold_carryover]
        [/objectives]
    [/event]
3. Some of my attack-events don't fire at all:

Code: Select all


[event]
        name=attack     
        [filter]
            id=Lord Paramount Galdwin
        [/filter]
	
	[message]
            id=Lord Paramount Galdwin
            message=_ "Ah, that makes me feel young again. Like in the days when I was in my first fight against the undead. I was 16 then... All this time I haven't been feeling so well."
        [/message]
		[/event]

Code: Select all

[event]
        name=attack
        [filter]
            side=4
        [/filter]
        [filter_second]
            side=1
        [/filter_second]
	
	[message]
            speaker=unit
            message=_ "Soon the vampires will rule. You can't stop us."
        [/message]
	
	[message]
            speaker=second_unit
            message=_ "We will prevail. Retreat, nasty vampire!"
        [/message]
		
		[/event]

Code: Select all

	[event]
        name=attack
        [filter]
            side=1
        [/filter]
        [filter_second]
            side=4
        [/filter_second]
	
	[message]
            speaker=unit
            message=_ "Onwards! The gods are with us!"
        [/message]
	
	[message]
            speaker=second_unit
            message=_ "Stand and fight, comrades, the town will be sacked this very night!"
        [/message]
		
		[/event]
4. The next scenario won't start. After fulfilling the victory conditions, the campaign ends and is won. That's not what I want (at least at this place in the campaign ;) ).
That's the head of the sixth scenario:

Code: Select all

	id="6_Defence_of_Hangkaff"
    name=_ "Defence of Hangkaff"
    map_data="{~add-ons/the_story_of_three_villages/maps/Defence_of_Hangkaff.map}"
    turns=30
    next_scenario=7_Duel_of_Fates
and this is the head of the seventh scenario which doesn't want to start:

Code: Select all

id="7_Duel_of_Fates"
    name=_ "Duel of Fates"
    map_data="{~add-ons/the_story_of_three_villages/maps/Duel_of_Fates.map}"
    turns=15
    next_scenario=null
If anyone can help, please post!
Looking for feedback for my dramatic campaign "A story of three villages", a late-age men vs. undead story going to include vampires and werewolves: http://forums.wesnoth.org/viewtopic.php?f=8&t=36193
Turgon
Posts: 59
Joined: September 30th, 2011, 6:13 pm
Location: Germany

Re: I need help with recall-WMLs

Post by Turgon »

Interesting, all of these problems just disappeared and now everything works fine except for one thing. The force-chance-to-hit command just doesn't work. I put this here just beneath the [side]-tag:

Code: Select all

{FORCE_CHANCE_TO_HIT side=1 id="Philip" 0
	([variable]
            name=turn_number
            less_than=16
        [/variable] )}
Can anyone help, please?
Looking for feedback for my dramatic campaign "A story of three villages", a late-age men vs. undead story going to include vampires and werewolves: http://forums.wesnoth.org/viewtopic.php?f=8&t=36193
Kernigh
Posts: 107
Joined: February 13th, 2007, 10:21 pm
Location: United States
Contact:

Re: I need help with recall-WMLs

Post by Kernigh »

Turgon wrote:Interesting, all of these problems just disappeared and now everything works fine except for one thing.
I am guessing that your problems disappeared after you quit and restarted Wesnoth. If you edit .cfg files while Wesnoth is open, then Wesnoth will not reload your .cfg files until you quit and restart Wesnoth. (I have also heard that without quitting Wesnoth, you can just press F5 at the title screen.) Also, you must play your scenario from the beginning. If you load a save file from the middle of a scenario, then Wesnoth loads the scenario from the save file, not from your .cfg files.

About FORCE_CHANCE_TO_HIT, it expands to [event] tags, so you must put FORCE_CHANCE_TO_HIT in a place that allows [event] tags. You must not put [event] inside [side], as [event] is not a subtag of [side].
Turgon
Posts: 59
Joined: September 30th, 2011, 6:13 pm
Location: Germany

Re: Different WML questions for my campaign!

Post by Turgon »

Well, I used to have the FORCE_CHANCE_TO_HIT under the side-tag, but outside of it - basically in open space. Now it put it into the prestart-event and everything works fine, thanks ;) Now I will upload the new version! Try and comment...
Looking for feedback for my dramatic campaign "A story of three villages", a late-age men vs. undead story going to include vampires and werewolves: http://forums.wesnoth.org/viewtopic.php?f=8&t=36193
Post Reply