Help with WML for a particular scenario

The place to post your WML questions and answers.

Moderators: Forum Moderators, Developers

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
chak_abhi
Posts: 335
Joined: June 24th, 2010, 3:37 pm

Re: Help with WML for a particular scenario

Post by chak_abhi »

In a particular scenario I want to store only the units in the recall list at a point of time and not the units which are on the map. How can it be done? Thanks in advance.

User avatar
trewe
Translator
Posts: 122
Joined: December 24th, 2012, 5:37 pm
Location: Portugal
Contact:

Re: Help with WML for a particular scenario

Post by trewe »

chak_abhi wrote:In a particular scenario I want to store only the units in the recall list at a point of time and not the units which are on the map. How can it be done? Thanks in advance.
filter for x=recall.


chak_abhi
Posts: 335
Joined: June 24th, 2010, 3:37 pm

Re: Help with WML for a particular scenario

Post by chak_abhi »

I am facing a problem.
In a particular scenario (map attached) I want some enemy ships to land their troops on the southern coast (as in "black flag" of SotBE). I have copied the necessary code and introduced modifications only in the locations of the destination & the invader types.

Code: Select all

[event]
        name=turn refresh
        first_time_only=no

        [if]
            [variable]
                name=side_number
                equals=5
            [/variable]

            [then]
                [store_unit]
                    [filter]
                        type=Transport Galleon
                        [not]
                            [filter_wml]
                                [variables]
                                    destination_set=yes
                                [/variables]
                            [/filter_wml]
                        [/not]
                    [/filter]

                    kill=yes
                    variable=stored_transports
                [/store_unit]

                {FOREACH stored_transports i}
                    [store_locations]
                        x=1-31
                        y=10-14
                        terrain=Ww

                        [filter_adjacent_location]
                            terrain=Ds,*^Bw*
                        [/filter_adjacent_location]

                        [not]
                            find_in=already_picked_transport_destination_surroundings
                        [/not]

                        variable=possible_transport_destinations
                    [/store_locations]

                    {VARIABLE_OP transport_destination_index rand 

"1..$possible_transport_destinations.length"}
                    {VARIABLE_OP transport_destination_index sub 1}

                    {VARIABLE stored_transports[$i].variables.destination_x 

$possible_transport_destinations[$transport_destination_index].x}
                    {VARIABLE stored_transports[$i].variables.destination_y 

$possible_transport_destinations[$transport_destination_index].y}
                    {VARIABLE stored_transports[$i].variables.destination_set yes}

                    [store_locations]
                        x=$stored_transports[$i].variables.destination_x
                        y=$stored_transports[$i].variables.destination_y
                        radius=2

                        [filter_radius]
                            terrain=Ww,Ds,*^Bw*
                        [/filter_radius]

                        [or]
                            find_in=already_picked_transport_destination_surroundings
                        [/or]

                        variable=already_picked_transport_destination_surroundings
                    [/store_locations]

                    [unstore_unit]
                        variable=stored_transports[$i]
                    [/unstore_unit]
                {NEXT i}

                [store_unit]
                    [filter]
                        type=Transport Galleon
                        
                        [not]
                            [filter_wml]
                                [variables]
                                    landed=yes
                                [/variables]
                            [/filter_wml]
                        [/not]
                    [/filter]

                    kill=yes
                    variable=stored_transports
                [/store_unit]

                {FOREACH stored_transports i}
                    {VARIABLE stored_transports[$i].goto_x 

$stored_transports[$i].variables.destination_x}
                    {VARIABLE stored_transports[$i].goto_y 

$stored_transports[$i].variables.destination_y}

                    [unstore_unit]
                        variable=stored_transports[$i]
                    [/unstore_unit]
                {NEXT i}

                [store_unit]
                    [filter]
                        type=Transport Galleon
                        
                        [filter_wml]
                            [variables]
                                landed=yes
                            [/variables]
                        [/filter_wml]
                    [/filter]

                    kill=yes
                    variable=stored_transports
                [/store_unit]

                {FOREACH stored_transports i}
                    {VARIABLE stored_transports[$i].moves 0}

                    [unstore_unit]
                        variable=stored_transports[$i]
                    [/unstore_unit]
                {NEXT i}

                {CLEAR_VARIABLE stored_transports}
                [/then]
        [/if]
    [/event]

    [event]
        name=moveto
        first_time_only=no

        [filter]
            type=Transport Galleon

            [not]
                [filter_wml]
                    [variables]
                        landed=yes
                    [/variables]
                [/filter_wml]
            [/not]

            [filter_wml]
                [variables]
                    destination_x=$x1
                    destination_y=$y1
                [/variables]
            [/filter_wml]
        [/filter]

        {VARIABLE unit.variables.landed yes}

        [unstore_unit]
            variable=unit
            find_vacant=no
        [/unstore_unit]

        {RANDOM 0..2}

#define INVADER TYPE X Y
    [unit]
        side=5
        type={TYPE}
        x,y={X},{Y}
        random_traits=yes
        generate_name=yes
        moves=0
    [/unit]
#enddef

        [switch]
            variable=random

            [case]
                value=0

                {INVADER "Swordsman" $x1 $y1}
                {INVADER "Longbowman" $x1 $y1}
                {INVADER "Dragoon" $x1 $y1}
            [/case]

            [case]
                value=1

                {INVADER "Pikeman" $x1 $y1}
                {INVADER "Swordsman" $x1 $y1}
                {INVADER "Red Mage" $x1 $y1}
            [/case]

            [case]
                value=2

                {INVADER "Javelineer" $x1 $y1}
                {INVADER "Longbowman" $x1 $y1}
                {INVADER "Dragoon" $x1 $y1}
            [/case]
        [/switch]

        [message]
            side=5
            [filter_adjacent]
                x,y=$x1,$y1
            [/filter_adjacent]
            message= _ "Invade the castle! Reduce it to bits!"
        [/message]
    [/event]
(Here side 5 is the side of the invaders)
This code does not work, and the following errors appear on refreshing the turn:
error scripting/lua: E:/Battle for Wesnoth/data/lua/wml-tags.lua:458: attempt to index a nil value
stack traceback:
E:/Battle for Wesnoth/data/lua/wml-tags.lua:458: in function 'cmd'
E:/Battle for Wesnoth/data/lua/wml-tags.lua:297: in function 'handle_event_commands'
E:/Battle for Wesnoth/data/lua/wml-tags.lua:312: in function 'if_while_handler'
E:/Battle for Wesnoth/data/lua/wml-tags.lua:322: in function 'cmd'
E:/Battle for Wesnoth/data/lua/wml-tags.lua:297: in function 'handle_event_commands'
E:/Battle for Wesnoth/data/lua/wml-tags.lua:312: in function 'if_while_handler'
E:/Battle for Wesnoth/data/lua/wml-tags.lua:318: in function 'cmd'
E:/Battle for Wesnoth/data/lua/wml-tags.lua:297: in function <E:/Battle for Wesnoth/data/lua/wml-tags.lua:261>

Please help me to find out a solution. Thanks in advance.
Attachments
40_Defending_Pigreinos.map
(3.54 KiB) Downloaded 80 times

User avatar
Elvish_Hunter
Forum Moderator
Posts: 1430
Joined: September 4th, 2009, 2:39 pm
Location: Lintanir Forest...

Re: Help with WML for a particular scenario

Post by Elvish_Hunter »

chak_abhi wrote:This code does not work, and the following errors appear on refreshing the turn:
error scripting/lua: E:/Battle for Wesnoth/data/lua/wml-tags.lua:458: attempt to index a nil value
Line 458 corresponds to the [store_unit] tag. Since you have three of these in your code, you should try to comment out two of them and see if the problem appears again, to see which tag is wrong. It's also possible that the problem may be somewhere else, which is why we need to restrict our target.
A thing that may improve your code: instead of this

Code: Select all

[event]
        name=turn refresh
        first_time_only=no

        [if]
            [variable]
                name=side_number
                equals=5
            [/variable]

            [then]
just use this

Code: Select all

[event]
        name=side 5 turn refresh
        first_time_only=no
Current maintainer of these add-ons:
1.14: The Sojournings of Grog, A Rough Life, The White Troll (co-author), Wesnoth Lua Pack
1.12: Children of Dragons

chak_abhi
Posts: 335
Joined: June 24th, 2010, 3:37 pm

Re: Help with WML for a particular scenario

Post by chak_abhi »

Thanks. I made some changes in the map and suddenly everything became normal :o . Anyway, thanks for your help.

chak_abhi
Posts: 335
Joined: June 24th, 2010, 3:37 pm

Re: Help with WML for a particular scenario

Post by chak_abhi »

I need help regarding another matter. Can the time of day schedule be changed in the middle of a scenario? What is to be done to execute this change? Please help. Thanks in advance.

User avatar
8680
Moderator Emeritus
Posts: 742
Joined: March 20th, 2011, 11:45 pm
Location: The past

Re: Help with WML for a particular scenario

Post by 8680 »

chak_abhi wrote:Can the time of day schedule be changed in the middle of a scenario? What is to be done to execute this change?
[replace_schedule]


chak_abhi
Posts: 335
Joined: June 24th, 2010, 3:37 pm

Re: Help with WML for a particular scenario

Post by chak_abhi »

I am facing a problem yet again. The following scenario of a campaign written by me fails to load.

Code: Select all

#textdomain wesnoth-Doreldos_Fight_to_Liberty
[scenario]
    id=43_Daring_Attempt
    name=_ "Daring Attempt-Part 1"
    map="{~add-ons/Doreldos_Fight_to_Liberty/maps/43_Daring_Attempt1.map}"
    next_scenario=43_Daring_Attempt2
    victory_when_enemies_defeated=no
    turns=28
    
    {DEFAULT_MUSIC_PLAYLIST} 
    
    {INDOORS}

    [time_area]
        x =1-30,2-30,4,8,12-30,14-22,24-28,26
        y =22,21,20,20,20,19,19,18
        {MORNING}
    [/time_area]

    [story]
    [part]
    story= _ ""
    background=portraits/narrator.png
    scale_background=no
    [/part]
    [part]
    story= _ ""
    background=portraits/narrator.png
    scale_background=no
    [/part]
    [part]
    story= _ ""
    background=portraits/narrator.png
    scale_background=no
    [/part]
    [part]
    story= _ ""
    background=portraits/narrator.png
    scale_background=no
    [/part]

    [part]
    show_title=yes
    background=splash.png
    scale_background=no
    [/part]
    [/story]



    [side]
    no_leader=yes
    side=1
    controller=human
    canrecruit=yes
    gold=0
    team_name=Player
    user_team_name=_"Doreldosians"
    fog="no"
    share_view="no"
    shroud="yes"
    share_maps="no"
    income="1"
    
    [/side]

    [side]
    no_leader=yes
    side=2
    controller=ai
    canrecruit=yes
    gold=500
    team_name=Player
    user_team_name=_"Gloenish"
    fog="no"
    share_view="no"
    shroud="no"
    share_maps="no"
    income="0"
    
    [/side]

    {STARTING_VILLAGES_ALL 2}

    {FORCE_CHANCE_TO_HIT side=1 id="Creptin" 0 (
        [variable]
        name=mospins_killed
        not_equals=1
        [/variable]
    )}

    {FORCE_CHANCE_TO_HIT side=1 id="Mrau" 0 (
        [variable]
        name=creptin_killed
        not_equals=1
        [/variable]
    )}

    {FORCE_CHANCE_TO_HIT side=1 id="Deshnwot" 0 (
        [variable]
        name=mrau_killed
        not_equals=1
        [/variable]
    )}

    [event]
    name=prestart

    [store_gold]
    side=1
    variable=rest_gold
    [/store_gold]

    [item]
    image=items/table.png
    x=2,7,25,26
    y=4,14,13,2
    [/item]
    [item]
    image=items/chairS.png
    x=2,7,25,26
    y=3,13,12,1
    [/item]
    [item]
    image=items/chairSW.png
    x=4,8
    y=3,13
    [/item]
    [item]
    image=items/chairNW.png
    x=4,8,27
    y=5,14,3
    [/item]
    [item]
    image=items/bookcase-and-stuff.png
    x,y=2,2
    [/item]
    [item]
    image=items/bookcase.png
    x=3,4,6,7,24,25,22,23
    y=2,1,7,7,11,11,1,1
    [/item]
    [item]
    image=items/bookcase-and-stuff-sw.png
    x,y=4,7
    [/item]
    [item]
    image=items/bookcase-sw.png
    x=6,7,2,3,30
    y=1,2,6,7,1
    [/item]
    [item]
    image=items/chairSE.png
    x,y=6,13
    [/item]
    [item]
    image=items/chairNE.png
    x=6,25
    y=14,3
    [/item]
    [item]
    image=items/chairN.png
    x=7,25,26
    y=15,14,3
    [/item]

    {PLACE_IMAGE items/brazier-lit1.png 1 3}
    {PLACE_IMAGE items/brazier-lit2.png 5 1}
    {PLACE_IMAGE items/brazier-lit3.png 1 6}
    {PLACE_IMAGE items/brazier-lit4.png 5 8}
    {PLACE_IMAGE items/brazier-lit1.png 10 16}
    {PLACE_IMAGE items/brazier-lit2.png 6 16}
    {PLACE_IMAGE items/brazier-lit3.png 11 10}
    {PLACE_IMAGE items/brazier-lit2.png 23 15}
    {PLACE_IMAGE items/brazier-lit3.png 25 15}
    {PLACE_IMAGE items/brazier-lit4.png 27 15}
    {PLACE_IMAGE items/brazier-lit1.png 24 5}
    {PLACE_IMAGE items/brazier-lit2.png 29 5}

    {PLACE_IMAGE items/box.png 2 17}
    {PLACE_IMAGE items/box.png 1 18}
    {PLACE_IMAGE items/box.png 2 19}
    {PLACE_IMAGE items/box.png 3 17}

    {PLACE_IMAGE items/chest.png 1 13}
    {PLACE_IMAGE items/chest.png 1 14}
    {PLACE_IMAGE items/chest.png 2 13}
    {PLACE_IMAGE items/chest.png 2 14}

    {PLACE_IMAGE "items/dragonstatue.png" 4 14}
    {PLACE_IMAGE "items/dragonstatue.png~FL(horiz)" 12 10}
    {PLACE_IMAGE "items/dragonstatue.png~FL(horiz)" 12 14}    
    
    [unit]
    type=Great Mage
    id=Mospins
    name=_"Mospins"
    side=2
    x,y=2,3
    [modifications]
    {TRAIT_INTELLIGENT}
    {TRAIT_STRONG}
    [/modifications]
    [/unit]

    [unit]
    type=Arch Mage
    id=Creptin
    name=_"Creptin"
    side=2
    x,y=9,14
    [/unit]

    [unit]
    type=Mage of Light
    id=Mrau
    name=_"Mrau"
    side=2
    x,y=25,12
    [/unit]

    [unit]
    type=Silver Mage
    id=Deshnwot
    name=_"Deshnwot"
    side=2
    x,y=24,1
    [/unit]

    {GENERIC_UNIT 2 (Red Mage) 10 13} {GUARDIAN}
    {GENERIC_UNIT 2 (Mage) 9 13} {GUARDIAN}
    {GENERIC_UNIT 2 (Mage) 9 15} {GUARDIAN}

    {GENERIC_UNIT 2 (Swordsman) 8 2} {GUARDIAN}
    {GENERIC_UNIT 2 (Pikeman) 8 4} {GUARDIAN}
    {GENERIC_UNIT 2 (Swordsman) 17 2} {GUARDIAN}
    {GENERIC_UNIT 2 (Pikeman) 17 4} {GUARDIAN}
    {GENERIC_UNIT 2 (Swordsman) 14 8} {GUARDIAN}
    {GENERIC_UNIT 2 (Pikeman) 18 8} {GUARDIAN}
    {GENERIC_UNIT 2 (Longbowman) 16 7} {GUARDIAN}
    {GENERIC_UNIT 2 (Swordsman) 12 13} {GUARDIAN}
    {GENERIC_UNIT 2 (Pikeman) 12 11} {GUARDIAN}
    {GENERIC_UNIT 2 (Swordsman) 26 6} {GUARDIAN}
    {GENERIC_UNIT 2 (Pikeman) 30 6} {GUARDIAN}
    {GENERIC_UNIT 2 (Longbowman) 22 8} {GUARDIAN}
    {GENERIC_UNIT 2 (Swordsman) 28 9} {GUARDIAN}
    {GENERIC_UNIT 2 (Pikeman) 26 8} {GUARDIAN}
    {GENERIC_UNIT 2 (Swordsman) 28 16} {GUARDIAN}
    {GENERIC_UNIT 2 (Pikeman) 30 18} {GUARDIAN}

    {GENERIC_UNIT 2 (Halberdier) 10 18} {GUARDIAN}
    {GENERIC_UNIT 2 (Royal Guard) 8 18} {GUARDIAN}
    {GENERIC_UNIT 2 (Halberdier) 6 19} {GUARDIAN}
    {GENERIC_UNIT 2 (Master Bowman) 5 18} {GUARDIAN}
    {GENERIC_UNIT 2 (Halberdier) 3 11} {GUARDIAN}
    {GENERIC_UNIT 2 (Royal Guard) 4 11} {GUARDIAN}
    {GENERIC_UNIT 2 (Halberdier) 9 9} {GUARDIAN}
    {GENERIC_UNIT 2 (Royal Guard) 8 8} {GUARDIAN}
    {GENERIC_UNIT 2 (Halberdier) 19 19} {GUARDIAN}
    {GENERIC_UNIT 2 (Royal Guard) 15 19} {GUARDIAN}

    


    [objectives]
            side=1
            [objective]
                description= _ "Enter the building"
                condition=win
            [/objective]
            [objective]
                description= _ "Death of any of your units"
                condition=lose
            [/objective]
            [objective]
                description= _ "End of turns"
                condition=lose
            [/objective]
                        
            note={NO_GOLD_CARRYOVER_NOTE}
    [/objectives]

    [/event]

    [event]
    name=start

    [message]
    speaker=narrator
    image=portraits/narrator.png
    message= _ ""
    [/message]
    [message]
    speaker=narrator
    image=portraits/narrator.png
    message= _ ""
    [/message]
    [message]
    speaker=narrator
    image=portraits/narrator.png
    message= _ ""
    [/message]
    [message]
    speaker=narrator
    image=portraits/narrator.png
    message= _ ""
    [/message]

    [remove_shroud]
    side=1 
    x=1-30,2-30,4,8,12-30,14-22,24-28,26
    y=22,21,20,20,20,19,19,18
    [/remove_shroud]

    [unit]
    type=White Mage
    gender=female
    id=Okiya-disguise
    name=_"Okiya in disguise"
    side=1
    canrecruit=yes
    x,y=17,22
    [/unit]

    [unit]
    type=Pikeman
    id=Kavaras-disguise
    name=_"Kavaras in disguise"
    side=1
    x,y=18,22
    [modifications]
    {TRAIT_LOYAL}
    [/modifications]
    [/unit]

    [role]
    role=comrade
    type=Royal Guard, Halberdier, Master Bowman, Swordsman, Pikeman, Javelineer, 

Longbowman
    [/role]

    [recall]
    role=comrade
    x,y=16,22
    [/recall]
    
    [if]
    [not]
    [have_unit]
    role=comrade
    [/have_unit]
    [/not]
  
    [then]
    {GENERIC_UNIT 1 (Swordsman) 16 22}
    [/then]
    [/if]

    

    [/event]

    [event]
    name=moveto
    first_time_only=yes
    [filter]
    side=1
    [not]
    x=1-30,2-30,4,8,12-30,14-22,24-28,26
    y=22,21,20,20,20,19,19,18
    [/not]
    [/filter]

    [message]
    speaker=Okiya-disguise
    message= _ ""
    [/message]
    [message]
    speaker=Kavaras-disguise
    message= _ ""
    [/message]

    [remove_shroud]
    side=1
    x=9-11,10
    y=3-4,2
    [/remove_shroud]

    {HIGHLIGHT_IMAGE 10 3 items/gohere.png ()}

    [objectives]
            side=1
            [objective]
                description= _ "Go the Mospins' chamber and kill him"
                condition=win
            [/objective]
            [objective]
                description= _ "Death of any of your units"
                condition=lose
            [/objective]
            [objective]
                description= _ "End of turns"
                condition=lose
            [/objective]
                        
            note={NO_GOLD_CARRYOVER_NOTE}
    [/objectives]

    [/event]

    [event]
    name=moveto
    first_time_only=yes
    [filter]
    side=1
    x=1,2,3,4,5,6,7,8
    y=3-6,2-6,2-7,1-7,1-8,1-7,2-7,2-6
    [/filter]

    [remove_shroud]
    side=1
    x=1,2,3,4,5,6,7,8
    y=3-6,2-6,2-7,1-7,1-8,1-7,2-7,2-6
    [/remove_shroud]

    [remove_item]
    x,y=10,3
    [/remove_item]

    [message]
    speaker=Mospins
    message= _ ""
    [/message]
    [message]
    speaker=Okiya-disguise
    message= _ ""
    [/message]

    [store_unit]
    [filter]
    id=Okiya-disguise
    [/filter]
    kill=yes
    variable=od
    [/store_unit]

    [recall]
    id=Okiya
    x,y=$od.x,$od.y
    [/recall]

    {CLEAR_VARIABLE od}

    [store_unit]
    [filter]
    id=Kavaras-disguise
    [/filter]
    kill=yes
    variable=kd
    [/store_unit]

    [recall]
    id=Kavaras
    x,y=$kd.x,$kd.y
    [/recall]

    {CLEAR_VARIABLE kd}

    [modify_side]
    side=2
    team_name=Enemies
    [/modify_side]

    [message]
    speaker=Kavaras
    message= _ ""
    [/message]
    [message]
    speaker=Mospins
    message= _ ""
    [/message]
    [message]
    side=1
    type=Royal Guard, Halberdier, Master Bowman, Swordsman, Pikeman, Javelineer, 

Longbowman
    message= _ ""
    [/message]

    [store_unit]
    [filter]
    side=1
    x,y=recall,recall
    [/filter]
    kill=yes
    variable=rest_army
    [/store_unit]

    {MODIFY_UNIT (id=Okiya) canrecruit yes}

    [/event]

    [event]
    name=die
    [filter]
    id=Mospins
    [/filter]

    [message]
    speaker=Kavaras
    message= _ ""
    [/message]
    [message]
    speaker=Okiya
    message= _ ""
    [/message]

    {VARIABLE mospins_killed 1}

    [remove_shroud]
    side=1
    x=14-16,15
    y=11-12,13
    [/remove_shroud]

    {HIGHLIGHT_IMAGE 15 12 items/gohere.png ()}

    [objectives]
            side=1
            [objective]
                description= _ "Go the Creptin's chamber and kill him"
                condition=win
            [/objective]
            [objective]
                description= _ "Death of any of your units"
                condition=lose
            [/objective]
            [objective]
                description= _ "End of turns"
                condition=lose
            [/objective]
                        
            note={NO_GOLD_CARRYOVER_NOTE}
    [/objectives] 

    [/event]

    [event]
    name=moveto
    [filter]
    side=1
    x=4,5,6-7,8,9,10-11,12,13,14
    y=13-14,13-15,12-16,11-15,11-16,10-16,10-15,12-13,11-12
    [/filter]

    [remove_shroud]
    side=1
    x=4,5,6-7,8,9,10-11,12,13,14
    y=13-14,13-15,12-16,11-15,11-16,10-16,10-15,12-13,11-12
    [/remove_shroud]

    [message]
    speaker=Creptin
    message= _ ""
    [/message]
    [message]
    speaker=Kavaras
    message= _ ""
    [/message]
    [message]
    type=Mage, Red Mage
    message= _ ""
    [/message]

    [modify_unit]
    [filter]
    side=2
    [not]
    id=Creptin
    [/not] 
    [filter_location]
    x,y=9,14
    radius=2
    [/filter_location]
    [/filter]
    goto_x=5
    goto_y=14
    [/modify_unit]

    [message]
    side=1
    type=Royal Guard, Halberdier, Master Bowman, Swordsman, Pikeman, Javelineer, 

Longbowman
    message= _ ""
    [/message]

    [/event]

    [event]
    name=die
    [filter]
    id=Creptin
    [/filter]

    [message]
    speaker=Kavaras
    message= _ ""
    [/message]
    [message]
    speaker=Okiya
    message= _ ""
    [/message]

    {VARIABLE creptin_killed 1}

    [remove_shroud]
    side=1
    x=26-28,27,28-30,29
    y=7-8,9,15-16,17
    [/remove_shroud]

    {HIGHLIGHT_IMAGE 27 8 items/gohere.png ()}
    {HIGHLIGHT_IMAGE 29 16 items/gohere.png ()}

    [objectives]
            side=1
            [objective]
                description= _ "Go the Mrau's chamber and kill him"
                condition=win
            [/objective]
            [objective]
                description= _ "Death of any of your units"
                condition=lose
            [/objective]
            [objective]
                description= _ "End of turns"
                condition=lose
            [/objective]
                        
            note={NO_GOLD_CARRYOVER_NOTE}
    [/objectives] 

    [/event]

    [event]
    name=moveto
    [filter]
    side=1
    x=23-25,26-29
    y=11-15,10-15
    [/filter]

    [remove_shroud]
    side=1
    x=23-25,26-29
    y=11-15,10-15
    [/remove_shroud]

    [message]
    speaker=Mrau
    message= _ ""
    [/message]
    [message]
    speaker=Okiya
    message= _ ""
    [/message]

    [remove_item]
    x,y=29,16
    [/remove_item]

    [/event]

    [event]
    name=die
    [filter]
    id=Mrau
    [/filter]

    [message]
    speaker=Kavaras
    message= _ ""
    [/message]
    [message]
    speaker=Okiya
    message= _ ""
    [/message]

    {VARIABLE mrau_killed 1}

    {HIGHLIGHT_IMAGE 27 8 items/gohere.png ()}
    
    [objectives]
            side=1
            [objective]
                description= _ "Go the Deshnwot's chamber and kill him"
                condition=win
            [/objective]
            [objective]
                description= _ "Death of any of your units"
                condition=lose
            [/objective]
            [objective]
                description= _ "End of turns"
                condition=lose
            [/objective]
                        
            note={NO_GOLD_CARRYOVER_NOTE}
    [/objectives] 

    [/event]

    
    
    [event]
    name=die
    [filter]
    id=Deshnwot
    [/filter]

    [message]
    speaker=Kavaras
    message= _ ""
    [/message]
    [message]
    speaker=Okiya
    message= _ ""
    [/message]

    {VARIABLE accomplished 1}

    {HIGHLIGHT_IMAGE 30 7 items/gohere.png ()}
    
    [objectives]
            side=1
            [objective]
                description= _ "Go to the highlighted hex"
                condition=win
            [/objective]
            [objective]
                description= _ "Death of any of your units"
                condition=lose
            [/objective]
            [objective]
                description= _ "End of turns"
                condition=lose
            [/objective]
                        
            note={NO_GOLD_CARRYOVER_NOTE}
    [/objectives] 

    [/event]

    [event]
    name=moveto
    first_time_only=no
    [filter]
    side=1
    x,y=30,7
    [/filter]

    [message]
    speaker=unit
    message= _ ""
    [/message]
    [message]
    speaker=Okiya
    message= _ ""
    [/message]

    [store_unit]
    [filter]
    id=Okiya
    [/filter]
    variable=okiya_store
    kill=yes
    [/store_unit]
    
    [store_unit]
    [filter]
    id=Kavaras
    [/filter]
    variable=kavaras_store
    kill=yes
    [/store_unit]

    [store_unit]
    [filter]
    side=1
    type=Royal Guard, Halberdier, Master Bowman, Swordsman, Pikeman, Javelineer, 

Longbowman
    [/filter]
    variable=comrade_store
    kill=yes
    [/store_unit]

    {CLEAR_VARIABLE mospins_killed}
    {CLEAR_VARIABLE creptin_killed}
    {CLEAR_VARIABLE mrau_killed}

    [endlevel]
    result=victory
    bonus=no
    {NEW_GOLD_CARRYOVER 100}
    [/endlevel]

    [/event]

    



    [event]
    name=die
    [filter]
    side=1
    [/filter]

    [message]
    side=1
    [not]
    x,y=$x1,$y1
    [/not]
    message= _ ""
    [/message]

    {DEFEAT}
    
    [/event]

    [event]
    name=time over
 
    [message]
    speaker=Okiya
    message= _ ""
    [/message]

    {DEFEAT}
    
    [/event]

    

    

[/scenario]

    
The error shows:" The game could not be loaded:load_game_failed: Map not found."
But the map is present in the maps folder. I am uploading that too. I cannot find any error on my part. Please help. Thanks in advance.
Attachments
43_Daring_Attempt1.map
(3.79 KiB) Downloaded 71 times

User avatar
Adamant14
Posts: 905
Joined: April 24th, 2010, 1:14 pm

Re: Help with WML for a particular scenario

Post by Adamant14 »

In your scenario .cfg

Code: Select all

    map="{~add-ons/Doreldos_Fight_to_Liberty/maps/43_Daring_Attempt1.map}"
should be

Code: Select all

    map_data="{~add-ons/Doreldos_Fight_to_Liberty/maps/43_Daring_Attempt1.map}"
Also you should disable word wrap in your editor.
Otherwise you will get trouble with it. (line 340, line 485 ...)
Author of Antar, Son of Rheor ( SP Campaign) | Development Thread + Feedback Thread + Replays of ASoR

chak_abhi
Posts: 335
Joined: June 24th, 2010, 3:37 pm

Re: Help with WML for a particular scenario

Post by chak_abhi »

What a stupid mistake :augh: ! I should have kicked myself for it! :oops: :cry: Thanks for your help.
By the way, what is word wrap?

User avatar
Adamant14
Posts: 905
Joined: April 24th, 2010, 1:14 pm

Re: Help with WML for a particular scenario

Post by Adamant14 »

chak_abhi wrote:By the way, what is word wrap?
'automatic word wrapping' or 'line break'

Example from your code:

Code: Select all

    [role]
    role=comrade
    type=Royal Guard, Halberdier, Master Bowman, Swordsman, Pikeman, Javelineer,

Longbowman
    [/role]
Seems that 'wrap' is enabled, because the Longbowman is in a new line.
And that should give you an error message.
Author of Antar, Son of Rheor ( SP Campaign) | Development Thread + Feedback Thread + Replays of ASoR

chak_abhi
Posts: 335
Joined: June 24th, 2010, 3:37 pm

Re: Help with WML for a particular scenario

Post by chak_abhi »

Thanks for pointing it out. I will keep it in mind.

chak_abhi
Posts: 335
Joined: June 24th, 2010, 3:37 pm

Re: Help with WML for a particular scenario

Post by chak_abhi »

I need help once more. If I want an AI controlled side to capture a particular hex with any available unit what should be the required code? Thanks in advance.

Post Reply