Graziani 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.
Post Reply
User avatar
Graziani
Posts: 179
Joined: December 20th, 2010, 1:04 am
Location: France

Re: Graziani WML Questions

Post by Graziani »

Sorry to re-up the topic, but i really can't find what is the problem in this event:
In the game, when the player is supposed to make his choice, nothing happens. No dialogs, nothing.

Code: Select all



[event]

name=last breath

[filter]
id=ghost
[/filter]


       [store_unit]
         [filter]
            id=$second_unit.id
         [/filter]
         variable=second_unit
         kill=no
      [/store_unit]

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


[kill]
id=ghost
animate=yes
[/kill]

        [message]
            speaker=second_unit
            message= _ "bla"
        [/message]

[remove_shroud]
side=1
x=8-16
y=18-23
[/remove_shroud]


[unit]
x,y=11,22
side=4
id=elve
type=Elvish Shaman

[/unit]



        [message]
            type=Elvish Shaman

            message= _ "bla"
        [/message]

        [message]
            speaker=second_unit
            message= _ "bla"
        [/message]

        [message]
            speaker=Kark
            message= _ "bla"
        [/message]

        [message]
            type=Elvish Shaman

            message= _ "bla"
        [/message]

        [message]
            speaker=second_unit
            message= _ "bla!"
        [/message]

        [message]
            speaker=Forx
            message= _ "bla"
        [/message]

        [message]
            speaker=second_unit
            message= _ "bla"
        [/message]

        [message]
            type=Elvish Shaman

            message= _ "bla"
        [/message]

        [message]
            speaker=second_unit
            message= _ "bla"
        [/message]

        [message]
            type=Elvish Shaman

            message= _ "bla"
        [/message]

        [message]
            speaker=second_unit
            message= _ "bla"
        [/message]

{MOVE_UNIT id=$second_unit.id 12 21}

       [message]
            speaker=Kark
            message= _ "bla"
        [/message]

        [message]
            type=Elvish Shaman

            message= _ "bla"
        [/message]

        [message]
            id=$second_unit.id
            message= _ "bla"
        [/message]



        [message]
            speaker=second_unit
            message= _ "bla"

            [option]
                message= _ "bla"

                [command]

                    [message]
                        type=Elvish Shaman

                        message= _ "bla"
                    [/message]

[kill]
id=elve
animate=yes
[/kill]

        [message]
            speaker=second_unit
            message= _ "bla"
        [/message]


        [sound]
            name=gold.ogg
        [/sound]


        [message]
            speaker=second_unit
            message= _ "bla!"
        [/message]

       [message]
            speaker=Kark
            message= _ "bla"
        [/message]

[gold]
side=1
amount=100
[/gold]



                [/command]

            [/option]

            [option]
                message= _ "bla"

                [command]



        [message]
            type=Elvish Shaman

            message= _ "bla!"
        [/message]


        [message]
            speaker=second_unit
            message= _ "bla!"
        [/message]


{PLACE_IMAGE "items/potion-red.png" 11 22}


{MOVE_UNIT id=elve 1 1}

[kill]
id=elve
animate=no
[/kill]

        [message]
            speaker=second_unit
            message= _ "bla"
        [/message]


        [message]
            speaker=second_unit
            message= _ "bla!"
        [/message]


[remove_item]
x=11
y=22
[/remove_item]


       [message]
            speaker=Kark
            message= _ "bla!"
        [/message]




      [set_variable]
         name=second_unit.hitpoints
         add=30
      [/set_variable]





        [message]
            speaker=second_unit
            message= _ "bla!"
        [/message]

       [message]
            speaker=Kark
            message= _ "bla"
        [/message]



        [sound]
            name=gold.ogg
        [/sound]


[gold]
side=1
amount=40
[/gold]


        [message]
            speaker=second_unit
            message= _ "bla!"
        [/message]


      [unstore_unit]
         variable=second_unit
      [/unstore_unit]




                [/command]
            [/option]
        [/message]
    [/event]



Creator and maintainer of "A goblin adventure" (available) and "From Rocks and Blood"(available) --- Working on a new campaign "Facing Death"
User avatar
Elvish_Hunter
Posts: 1575
Joined: September 4th, 2009, 2:39 pm
Location: Lintanir Forest...

Re: Graziani WML Questions

Post by Elvish_Hunter »

One thing that I see is that you're using a last breath event, but the ghost unit doesn't speak in it; not only this, but you kill it shortly after the event is fired. Just rename the event as die and delete the [kill] tag.
That said, for now I have no idea why the event isn't fired. Are you sure that there is a unit with id=ghost on the field? I'm asking, because typos (like writing Ghost instead of ghost) happen. :)
Current maintainer of these add-ons, all on 1.16:
The Sojournings of Grog, Children of Dragons, A Rough Life, Wesnoth Lua Pack, The White Troll (co-author)
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: Graziani WML Questions

Post by zookeeper »

I'm sorry, but people get help really fast once they put any effort at all into making it easy for others to help them, and/or seem like they actually tried to solve it themselves. You just dump hundreds of lines of code here and say "it doesn't do anything".
User avatar
SkyOne
Posts: 1310
Joined: January 3rd, 2009, 7:23 pm

Re: Graziani WML Questions

Post by SkyOne »

zookeeper wrote:I'm sorry, but people get help really fast once they put any effort at all into making it easy for others to help them, and/or seem like they actually tried to solve it themselves. You just dump hundreds of lines of code here and say "it doesn't do anything".
^_^
Graziani wrote:In the game, when the player is supposed to make his choice, nothing happens. No dialogs, nothing.
I guess what you are missing is ID in the [option] tag. So try something like:

Code: Select all

            [option]
                id=first_choice
                message= _ "bla"

                [command]

Code: Select all

            [option]
                id=second_choice
                message= _ "bla"

                [command]
Fate of a Princess/feedback thread: "What is in own heart that is the most important, not who you are."
Drake Campaign: Brave Wings/feedback thread, Naga Campaign: Return of the Monster, Saurian Campaign: Across the Ocean
Northern Forces - now on 1.12 server
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: Graziani WML Questions

Post by zookeeper »

An id= in an [option] has no meaning.
User avatar
SkyOne
Posts: 1310
Joined: January 3rd, 2009, 7:23 pm

Re: Graziani WML Questions

Post by SkyOne »

zookeeper wrote:An id= in an [option] has no meaning.
Aaa... You are right. Missing the ID at a different place. It should be here:

Code: Select all

        [message]
            id=option_choice
            speaker=second_unit
            message= _ "bla"

            [option]
                message= _ "bla"

                [command]
Fate of a Princess/feedback thread: "What is in own heart that is the most important, not who you are."
Drake Campaign: Brave Wings/feedback thread, Naga Campaign: Return of the Monster, Saurian Campaign: Across the Ocean
Northern Forces - now on 1.12 server
User avatar
James_The_Invisible
Posts: 533
Joined: October 28th, 2012, 1:58 pm
Location: Somewhere in the Northlands, fighting dark forces
Contact:

Re: Graziani WML Questions

Post by James_The_Invisible »

@Elvish_Hunter The ghost is speaking in his last breath event:

Code: Select all

[message]
  speaker=unit
  message= _ "bla"
[/message]
It is after [store_unit] tag.
@SkyOne id used in [message] selects the speaker (as a part StandartUnitFiler)
@Graziani I can see nothing wrong with your code but the [store_unit] is useless because exactly this is done automatically by Wesnoth.
User avatar
SkyOne
Posts: 1310
Joined: January 3rd, 2009, 7:23 pm

Re: Graziani WML Questions

Post by SkyOne »

James_The_Invisible wrote:@SkyOne id used in [message] selects the speaker (as a part StandartUnitFiler)
Hmmm... You are probably right. Now I am not sure how I solved this one before: - http://forums.wesnoth.org/viewtopic.php ... 28#p517628
At the time, it did not work without the ID under my testing. I probably tested incorrectly.
James_The_Invisible wrote:but the [store_unit] is useless because exactly this is done automatically by Wesnoth.
Just to make sure, we don't need the [store_unit] anymore to do this?

Code: Select all

      [set_variable]
         name=second_unit.hitpoints
         add=30
      [/set_variable]
My basic WML are from 1.4, so some have been outdated.
Fate of a Princess/feedback thread: "What is in own heart that is the most important, not who you are."
Drake Campaign: Brave Wings/feedback thread, Naga Campaign: Return of the Monster, Saurian Campaign: Across the Ocean
Northern Forces - now on 1.12 server
User avatar
James_The_Invisible
Posts: 533
Joined: October 28th, 2012, 1:58 pm
Location: Somewhere in the Northlands, fighting dark forces
Contact:

Re: Graziani WML Questions

Post by James_The_Invisible »

Just to make sure, we don't need the [store_unit] anymore to do this?
As far as I know, no but just in this situation. If the unit is not involved in the event (as primary or secondary unit) you need to store it.
User avatar
Graziani
Posts: 179
Joined: December 20th, 2010, 1:04 am
Location: France

Re: Graziani WML Questions

Post by Graziani »

Hi! It's been a long time that i didn't work on my campaigns.

I'm still on two projects, troll campaign and goblin campaign.

I've finaly done my troll campaign (yeaaahhhhh!!), units, 23 scenarios, everything is fine.

There are two difficulties mode in this campaign, NORMAL and HARD.
I just have a problem about my main file i think.
When i launch my camapign in HARD, it's not working, i've got the "UNKNOW SCENARIO ERROR".
But in NORMAL, everything is fine.

Do you think there is a problem in this main_file ?
It's such a problem for me because even if the scenarios are done, i can't test them in HARD. I search in every scenario but i can't figure it out, i don't think the problem is there...

Thank you for your precious help everytime, it's very nice.

Code: Select all


#textdomain wesnoth-frab

[textdomain]
    name="wesnoth-frab"
[/textdomain]

# wmlscope: set export=no

[campaign]
    id=From_rocks_and_blood
    icon="data/add-ons/From_rocks_and_blood/images/units/trolls/godug.png~RC(magenta>red)"
    image="data/add-ons/From_rocks_and_blood/images/campaign_image.png"
    name= _ "From Rocks And Blood"
    abbrev= _ "FRAB"
    rank=15
    first_scenario="01_Un_nouveau_chef"
    difficulties="NORMAL,HARD"
    difficulty_descriptions={MENU_IMG_TXT2 "units/trolls/grunt.png~RC(magenta>red)" _"Warrior" _"(Normal)"} + ";" +
    {MENU_IMG_TXT2 "units/trolls/warrior.png~RC(magenta>red)" _"Leader" _"(Challenging)"}
    define="CAMPAIGN_FROM_ROCKS_AND_BLOOD"
    description=_ "Il est temps d'unifier les trolls et de faire taire les querelles incessantes avec les voisins! Que ce soit pacifiquement ou dans le sang n'a plus d'importance!

" + _"(Advanced level, 23 scenarios.)"

[/campaign]

#ifdef CAMPAIGN_FROM_ROCKS_AND_BLOOD
[binary_path]
    path=data/add-ons/From_rocks_and_blood
[/binary_path]
[+units]
	{~add-ons/From_rocks_and_blood/units/}
[/units]
{~add-ons/From_rocks_and_blood/utils}
{~add-ons/From_rocks_and_blood/scenarios}
{~add-ons/From_rocks_and_blood/maps}
#endif

Creator and maintainer of "A goblin adventure" (available) and "From Rocks and Blood"(available) --- Working on a new campaign "Facing Death"
User avatar
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: Graziani WML Questions

Post by Dugi »

I think that your problem does not lie in that file. Tell us the full error report. I think that you have a syntax error between an #ifdef HARD and #endif somewhere.

It's pretty cool that you get a new chef at the beginning of the campaign, all units will enjoy their meals and the player will be happy seeing them.
User avatar
Graziani
Posts: 179
Joined: December 20th, 2010, 1:04 am
Location: France

Re: Graziani WML Questions

Post by Graziani »

Okay, thanks for reply. It was strange, but after a long research in my senario files, i realized that i type a wrong code, like this.

[side]

Blablabla

[/side]

[/side]

I really don't know why it was disturbing the Hard difficulty and not the normal, really strange.
Thanks again!
Creator and maintainer of "A goblin adventure" (available) and "From Rocks and Blood"(available) --- Working on a new campaign "Facing Death"
User avatar
Graziani
Posts: 179
Joined: December 20th, 2010, 1:04 am
Location: France

Re: Graziani WML Questions

Post by Graziani »

Code: Select all

 # while Spectral Ixthala is alive, replace any defeated ghosts

    [event]
        name=new turn
        first_time_only=no

        [if]
            [have_unit]
                id=demon2
            [/have_unit]

            [then]
                [set_variable]
                    name=ghost1
                    value=1
                [/set_variable]

                [set_variable]
                    name=ghost2
                    value=1
                [/set_variable]

                [set_variable]
                    name=ghost3
                    value=1
                [/set_variable]

                [set_variable]
                    name=ghost4
                    value=1
                [/set_variable]

                [set_variable]
                    name=ghost5
                    value=1
                [/set_variable]

                [set_variable]
                    name=ghost6
                    value=1
                [/set_variable]

                [if]
                    [have_unit]
                        id=ghost1
                    [/have_unit]

                    [then]
                        [set_variable]
                            name=ghost1_dead
                            value=0
                        [/set_variable]
                    [/then]
                [/if]

                [if]
                    [have_unit]
                        id=ghost2
                    [/have_unit]

                    [then]
                        [set_variable]
                            name=ghost2_dead
                            value=0
                        [/set_variable]
                    [/then]
                [/if]

                [if]
                    [have_unit]
                        id=ghost3
                    [/have_unit]

                    [then]
                        [set_variable]
                            name=ghost3_dead
                            value=0
                        [/set_variable]
                    [/then]
                [/if]

                [if]
                    [have_unit]
                        id=ghost4
                    [/have_unit]

                    [then]
                        [set_variable]
                            name=ghost4_dead
                            value=0
                        [/set_variable]
                    [/then]
                [/if]

                [if]
                    [have_unit]
                        id=ghost5
                    [/have_unit]

                    [then]
                        [set_variable]
                            name=ghost5_dead
                            value=0
                        [/set_variable]
                    [/then]
                [/if]

                [if]
                    [have_unit]
                        id=ghost6
                    [/have_unit]

                    [then]
                        [set_variable]
                            name=ghost6_dead
                            value=0
                        [/set_variable]
                    [/then]
                [/if]



                [if]
                    [variable]
                        name=ghost1_dead
                        numerical_equals=1
                    [/variable]

                    [or]
                        [variable]
                            name=ghost2_dead
                            numerical_equals=1
                        [/variable]
                    [/or]

                    [or]
                        [variable]
                            name=ghost3_dead
                            numerical_equals=1
                        [/variable]
                    [/or]

                    [variable]
                        name=ghost4_dead
                        numerical_equals=1
                    [/variable]

                    [or]
                        [variable]
                            name=ghost5_dead
                            numerical_equals=1
                        [/variable]
                    [/or]

                    [or]
                        [variable]
                            name=ghost6_dead
                            numerical_equals=1
                        [/variable]
                    [/or]


                    [then]
                        [message]
                            speaker=demon2
                            message= _ "blabla"
                        [/message]
                    [/then]
                [/if]

                [if]
                    [variable]
                        name=ghost1_dead
                        numerical_equals=1
                    [/variable]

                    [then]
    [unit]
        type=Ghost
        side=3
        id=ghost1
        x=10
        y=44
    [/unit]
                    [/then]
                [/if]

                [if]
                    [variable]
                        name=ghost2_dead
                        numerical_equals=1
                    [/variable]

                    [then]

    [unit]
        type=Ghost
        side=3
        id=ghost2
        x=10
        y=45
    [/unit]
                    [/then]
                [/if]

                [if]
                    [variable]
                        name=ghost3_dead
                        numerical_equals=1
                    [/variable]

                    [then]
    [unit]
        type=Ghost
        side=3
        id=ghost3
        x=10
        y=46
    [/unit]

                    [/then]
[/if]

                [if]
                    [variable]
                        name=ghost4_dead
                        numerical_equals=1
                    [/variable]

                    [then]

    [unit]
        type=Ghost
        side=3
        id=ghost4
        x=13
        y=44
    [/unit]
                    [/then]
                [/if]

                [if]
                    [variable]
                        name=ghost5_dead
                        numerical_equals=1
                    [/variable]

                    [then]
    [unit]
        type=Ghost
        side=3
        id=ghost5
        x=13
        y=45
    [/unit]

                    [/then]
                [/if]

                [if]
                    [variable]
                        name=ghost6_dead
                        numerical_equals=1
                    [/variable]

                    [then]

    [unit]
        type=Ghost
        side=3
        id=ghost6
        x=13
        y=46
    [/unit]

                    [/then]
                [/if]
            [/then]
        [/if]

    [/event]

Hi guys!
In this event, any defeated ghost is replace by another one.
i'm trying to fire this event but nothing happens. I tried many issues without success. The dead ghost... stay dead :?
Maybe the quote [have_unit] at the beginning is not good for this kind of event.
Any ideas?
Creator and maintainer of "A goblin adventure" (available) and "From Rocks and Blood"(available) --- Working on a new campaign "Facing Death"
User avatar
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: Graziani WML Questions

Post by Dugi »

You're initially setting the variable ghost1 to 1, if ghost1 is dead you set ghost1_dead to 0 and then you check for ghost1_dead. That means that ghost1_dead is never equal to 1, because you have mistaken the variable name.

The whole thing could be done in a much shorter way:

Code: Select all

[event]
 name=new turn
 first_time_only=no
 [if]
  [have_unit]
   id=demon2
  [/have_unit]
 [then]
#define GHOST_CHECK NUM X Y
  [if]
    [have_unit]
      id=ghost{NUM}
    [/have_unit]
    [else]
       [message]
         speaker=demon2
         message= _ "Rise, fallen soul, return from thy undeserved rest. Thy eternal rest hast not cometh yet. Return and haunt thy comrades again."
       [/message]
       [unit]
         type=Ghost
         side=3
         id=ghost{NUM}
         x={X}
         y={Y}
       [/unit]
     [/else]
  [/if]
#enddef
{GHOST_CHECK 1 10 44}
{GHOST_CHECK 2 10 45}
{GHOST_CHECK 3 10 46}
{GHOST_CHECK 4 13 44}
{GHOST_CHECK 5 13 45}
{GHOST_CHECK 6 13 46}
#undef GHOST_CHECK
 [/then]
[/if]
[/event]
User avatar
Graziani
Posts: 179
Joined: December 20th, 2010, 1:04 am
Location: France

Re: Graziani WML Questions

Post by Graziani »

Code: Select all


[event]
 name=new turn
 first_time_only=no
 [if]
  [have_unit]
   id=demon2
  [/have_unit]
 [then]
#define GHOST_CHECK NUM X Y
  [if]
    [have_unit]
      id=ghost1
    [/have_unit]
    [else]
       [message]
         speaker=demon2
         message= _ "Rise, fallen soul, return from thy undeserved rest. Thy eternal rest hast not cometh yet. Return and haunt thy comrades again."
       [/message]
       [unit]
         type=Ghost
         side=3
         id=ghost1
         x={X}
         y={Y}
       [/unit]
     [/else]
  [/if]
  [if]
    [have_unit]
      id=ghost2
    [/have_unit]
    [else]
       [message]
         speaker=demon2
         message= _ "Rise, fallen soul, return from thy undeserved rest. Thy eternal rest hast not cometh yet. Return and haunt thy comrades again."
       [/message]
       [unit]
         type=Ghost
         side=3
         id=ghost2
         x={X}
         y={Y}
       [/unit]
     [/else]
  [/if]
  [if]
    [have_unit]
      id=ghost3
    [/have_unit]
    [else]
       [message]
         speaker=demon2
         message= _ "Rise, fallen soul, return from thy undeserved rest. Thy eternal rest hast not cometh yet. Return and haunt thy comrades again."
       [/message]
       [unit]
         type=Ghost
         side=3
         id=ghost3
         x={X}
         y={Y}
       [/unit]
     [/else]
  [/if]
  [if]
    [have_unit]
      id=ghost4
    [/have_unit]
    [else]
       [message]
         speaker=demon2
         message= _ "Rise, fallen soul, return from thy undeserved rest. Thy eternal rest hast not cometh yet. Return and haunt thy comrades again."
       [/message]
       [unit]
         type=Ghost
         side=3
         id=ghost4
         x={X}
         y={Y}
       [/unit]
     [/else]
  [/if]
  [if]
    [have_unit]
      id=ghost5
    [/have_unit]
    [else]
       [message]
         speaker=demon2
         message= _ "Rise, fallen soul, return from thy undeserved rest. Thy eternal rest hast not cometh yet. Return and haunt thy comrades again."
       [/message]
       [unit]
         type=Ghost
         side=3
         id=ghost5
         x={X}
         y={Y}
       [/unit]
     [/else]
  [/if]
  [if]
    [have_unit]
      id=ghost6
    [/have_unit]
    [else]
       [message]
         speaker=demon2
         message= _ "Rise, fallen soul, return from thy undeserved rest. Thy eternal rest hast not cometh yet. Return and haunt thy comrades again."
       [/message]
       [unit]
         type=Ghost
         side=3
         id=ghost6
         x={X}
         y={Y}
       [/unit]
     [/else]

  [/if]
#enddef
{GHOST_CHECK 1 10 44}
{GHOST_CHECK 2 10 45}
{GHOST_CHECK 3 10 46}
{GHOST_CHECK 4 13 44}
{GHOST_CHECK 5 13 45}
{GHOST_CHECK 6 13 46}
#undef GHOST_CHECK
 [/then]
[/if]
[/event]


Something like this ?
Creator and maintainer of "A goblin adventure" (available) and "From Rocks and Blood"(available) --- Working on a new campaign "Facing Death"
Post Reply