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
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: Graziani WML Questions

Post by Dugi »

first_scenario="01_Un_nouveau_chef" should be first_scenario="01_A_New_Chieftain" (or something else if you translated it differently), you simply forgot to change the name of the first scenario in the [campaign] tag.
User avatar
Graziani
Posts: 179
Joined: December 20th, 2010, 1:04 am
Location: France

Re: Graziani WML Questions

Post by Graziani »

The ID Was wrong, my fault, thanks again.

Hmmm.. :hmm:


I have an event that i don't really know how to finish it properly.


In a last breath event, the second_unit can gain more hp imediatly.

But, how identify the second_unit in an event?

In the same problem, if i want that the second_unit move to somewhere, how can i do that?

Thx!
Creator and maintainer of "A goblin adventure" (available) and "From Rocks and Blood"(available) --- Working on a new campaign "Facing Death"
User avatar
Adamant14
Posts: 962
Joined: April 24th, 2010, 1:14 pm

Re: Graziani WML Questions

Post by Adamant14 »

Code: Select all

	### question 1:

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

		[set_variable]
			name=temp_second_unit.hitpoints
			add=  # add what you want here
		[/set_variable]

		[unstore_unit]
			variable=temp_second_unit
		[/unstore_unit]

		{CLEAR_VARIABLE temp_second_unit}




	### question 2:
	#   moves second unit to x,y=10,10


		{MOVE_UNIT $second_unit.id 10 10}

Author of Antar, Son of Rheor ( SP Campaign) | Development Thread + Feedback Thread + Replays of ASoR
JaMiT
Inactive Developer
Posts: 511
Joined: January 22nd, 2012, 12:38 am

Re: Graziani WML Questions

Post by JaMiT »

Why temp_second_unit?

Code: Select all

    ### question 1:
    [set_variable]
        name=second_unit.hitpoints
        add=  # add what you want here
    [/set_variable]

    [unstore_unit]
        variable=second_unit
    [/unstore_unit]
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=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= _ "Ouuuuuuuuuh! Je reviendrais!"
        [/message]

        [message]
            speaker=second_unit
            message= _ "Brrr... Sale fantome va!"
        [/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= _ "blabla"
        [/message]

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


{MOVE_UNIT $second_unit.id 12 21}



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

            [option]
                message= _ "bl"

                [command]

                    [message]
                        type=Elvish Shaman

                        message= _ "Nooooon!"
                    [/message]

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

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


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


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

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

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



                [/command]

            [/option]

            [option]
                message= _ "bla."

                [command]




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


{MOVE_UNIT id=elve 1 1}

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

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

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



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


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


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


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


      [unstore_unit]
         variable=second_unit
      [/unstore_unit]



      {CLEAR_VARIABLE second_unit}

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


I've got an error... Wesnoth told we that a "$" in uncorrect
Creator and maintainer of "A goblin adventure" (available) and "From Rocks and Blood"(available) --- Working on a new campaign "Facing Death"
User avatar
trewe
Translator
Posts: 122
Joined: December 24th, 2012, 5:37 pm
Location: Portugal
Contact:

Re: Graziani WML Questions

Post by trewe »

Graziani wrote:

Code: Select all


{MOVE_UNIT $second_unit.id 12 21}
I've got an error... Wesnoth told we that a "$" in uncorrect
It is id=$second_unit.id
JaMiT
Inactive Developer
Posts: 511
Joined: January 22nd, 2012, 12:38 am

Re: Graziani WML Questions

Post by JaMiT »

Graziani wrote:

Code: Select all

       [store_unit]
         [filter]
            id=$second_unit.id
         [/filter]
         variable=second_unit
         kill=no
      [/store_unit]
Think about what this snippet is doing. The [filter] part says to find the unit that had been stored in the variable called "second_unit". Then the rest of the [store_unit] causes that unit (that is still stored in "second_unit") to be stored in "second_unit". Which it already is. So this is just busy work for the game and accomplishes nothing. Get rid of it.
Graziani wrote:

Code: Select all

      {CLEAR_VARIABLE second_unit}
No. Do not clear automatically-stored variables. It's a recipe for disaster waiting to happen. Or at least bad style. :) Get rid of this line.
(In my previous post, I included a complete solution for part 1, not something to be merged into what was posted before it. That's why I included the label "### question 1:". I had both changed and removed lines. Omissions were intentional and in fact were kind of the point.)


PS In case you missed trewe's intent: {MOVE_UNIT id=$second_unit.id 12 21}
Or perhaps {MOVE_UNIT (id=$second_unit.id) 12 21}, to make it easier to see the extent of the first parameter.
User avatar
Adamant14
Posts: 962
Joined: April 24th, 2010, 1:14 pm

Re: Graziani WML Questions

Post by Adamant14 »

Sorry for the mess. :oops:
Author of Antar, Son of Rheor ( SP Campaign) | Development Thread + Feedback Thread + Replays of ASoR
User avatar
Graziani
Posts: 179
Joined: December 20th, 2010, 1:04 am
Location: France

Re: Graziani WML Questions

Post by Graziani »

I deleted the macro, but this event isn't working (command and hit points...)

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= _ "Ouuuuuuuuuh! Je reviendrais!"
        [/message]

        [message]
            speaker=second_unit
            message= _ "Brrr... Sale fantome va!"
        [/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= _ "blabla"
        [/message]

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


{MOVE_UNIT $second_unit.id 12 21}



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

            [option]
                message= _ "bl"

                [command]

                    [message]
                        type=Elvish Shaman

                        message= _ "Nooooon!"
                    [/message]

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

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


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


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

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

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



                [/command]

            [/option]

            [option]
                message= _ "bla."

                [command]




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


{MOVE_UNIT id=elve 1 1}

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

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

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



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


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


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


        [message]
            speaker=second_unit
            message= _ "blabla"
        [/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
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: Graziani WML Questions

Post by Dugi »

I think that {MOVE_UNIT $second_unit.id 12 21} should be {MOVE_UNIT id=$second_unit.id 12 21}.
Side note:
EDIT: Fixed the typo James_the_Invisible noticed. Thanks man.
Last edited by Dugi on January 21st, 2014, 12:39 pm, edited 1 time in total.
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 »

I believe that you meant

Code: Select all

{MOVE_UNIT id=$second_unit.id 12 21}
:)
User avatar
Graziani
Posts: 179
Joined: December 20th, 2010, 1:04 am
Location: France

Re: Graziani WML Questions

Post by Graziani »

Strangely the movement is working even with that {MOVE_UNIT $second_unit.id 12 21}!
But anyway, i correct it, thanks!



But the command function doesn't works at all, this event is a mystery to me...




Actually, almost all the scenario isn't working, the ennemies leaders don't recruit etc...

Ps: Thx Dugi ;)
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 »

I tried to fix the problems but i can't see what is wrong...
The ennemies leaders don't recruit (and don't have crown above their heads), ghosts don't stay on place even with ai guardian, and the event with [command] tag don't work, except the famous movement {MOVE_UNIT id=$second_unit.id 12 21}

Here is a version of my scenario with no dialogs, if you have time thanks in advance because i'm totally stuck

Code: Select all

#textdomain wesnoth-aga
[scenario]

id=03_Necromancien
next_scenario=04_Retour
 
name=La necromancienne de la foret
map_data="{~add-ons/A_goblin_adventure/maps/03_Necromancien.map}"
{TURNS 55 50 45}

victory_when_enemies_defeated=no

{INTRO_AND_SCENARIO_MUSIC "northerners.ogg" "revelation.ogg"}
{EXTRA_SCENARIO_MUSIC "northeners.ogg"}
{EXTRA_SCENARIO_MUSIC "legends_of_the_north.ogg"}
{EXTRA_SCENARIO_MUSIC "battle.ogg"}


{DEFAULT_SCHEDULE}

{STORY_NECROMANCIEN}
 



[side]
type=Goblin Rouser
id=Kark
x,y=4,39
name=Kark
facing=se
side=1
team_name=goblins
user_team_name=_"Goblins"
canrecruit=yes
controller=human
recruit=Goblin Impaler,Goblin Spearman,AGA Goblin Bladesman,AGA Goblin Swordsman,AGA Goblin Archer
gold=100
shroud=yes
[/side]

[side]
no_leader=yes
controller=ai
team_name=Humans
canrecruit=yes
user_team_name=_"Undead"
side=2
recruit=Walking Corpse,Ghoul,Blood Bat,Soulless,Ghost,Vampire Bat,AGA Rabid Hound
gold=0
[/side]

[side]
no_leader=yes
controller=ai
team_name=Humans
canrecruit=yes
user_team_name=_"Undead"
side=3
recruit=Walking Corpse,Ghoul,Vampire Bat
gold=0
[/side]

[side]
no_leader=yes
controller=ai
team_name=other
user_team_name=_"Other"
side=4
gold=0
[/side]

[event]

name=prestart

[recall]
id=Forx
x,y=5,39
{IS_HERO}
[/recall]

[recall]
id=Spid6
[/recall]


[unit]
x,y=2,40
side=1
type=Goblin Spearman
[/unit]

[unit]
x,y=1,40
side=1
id=Goblin Spearman2
type=Goblin Impaler
[/unit]

[unit]
x,y=4,40
side=1
type=Goblin Spearman
[/unit]

[unit]
x,y=5,40
side=1
id=Goblin Spearman1
type=Goblin Spearman
[/unit]

[unit]
x,y=3,38
side=1
type=Goblin Impaler
[/unit]

[unit]
x,y=7,40
side=1
type=Goblin Spearman
[/unit]



[/event]

[event]

name=start

#dialogue starts



[objectives]
side=1
[objective]
description= _ "Retrouver les loups"
condition=win
[/objective]

[objective]
description= _ "Mort de Kark ou Forx"
condition=lose
[/objective]

[objective]
description= _ "Fin du decompte des tours"
condition=lose
[/objective]
note={EARLY_FINISH_BONUS_NOTE}+{NEW_GOLD_CARRYOVER_NOTE_40}
[/objectives]


[/event]





[event]

name=moveto

first_time_only=yes

[filter]
side=1
x=20,21
y=36,36
[/filter]




{PLACE_IMAGE "items/wolf.png" 44 28}
{PLACE_IMAGE "items/wolf.png" 45 28}
{PLACE_IMAGE "items/wolf.png" 46 28}
{PLACE_IMAGE "items/wolf.png" 44 27}


[remove_shroud]
side=1
x=38-49
y=25-31
[/remove_shroud]





[objectives]
side=1
[objective]
description= _ "Tuer le serviteur de la necromante pour liberer les loups"
condition=win
[/objective]

[objective]
description= _ "Mort de Kark ou Forx"
condition=lose
[/objective]

[objective]
description= _ "Fin du decompte des tours"
condition=lose
[/objective]
note={EARLY_FINISH_BONUS_NOTE}+{NEW_GOLD_CARRYOVER_NOTE_40}
[/objectives]



[/event]




[event]

name=moveto

first_time_only=yes

[filter]
side=1
x=10-18
y=34-38
[/filter]



[unit]
x,y=18,37
side=2
type=Ghost
id=ghost2
ai_special=guardian
[/unit]


[unit]
x,y=12,34
side=2
id=ghost
type=Ghost
ai_special=guardian
[/unit]


[unit]
x,y=31,33
side=2
type=Ghost
ai_special=guardian
[/unit]


[remove_shroud]
side=1
x=9-20
y=34-40
[/remove_shroud]



{MOVE_UNIT id=ghost2 42 36}



{MOVE_UNIT id=ghost 14 22}




[unit]
x,y=42,27
side=3
id=zombie
type=Necrophage
can_recruit=yes
[/unit]



[modify_side]
side=2
{GOLD 60 85 110}
{INCOME 5 7 9}
[/modify_side]



[/event]













[event]

name=last breath

[filter]
id=zombie
[/filter]




[if]

[have_unit]
side=2
id=necromante
[/have_unit]

[then]






{MOVE_UNIT id=Forx 42 29}
{MOVE_UNIT id=Kark 42 28}







[unit]
x,y=44,28
side=1
type=Wolf Rider
[/unit]

[unit]
x,y=45,28
side=1
type=Wolf Rider
[/unit]

[unit]
x,y=46,28
side=1
type=Wolf Rider
[/unit]

[unit]
x,y=47,28
side=1
type=Wolf Rider
[/unit]



[modify_unit]
                            
[filter]
                                
id=Kark                           
[/filter]
                            
type=Goblin Knight                      
[/modify_unit]


[modify_unit]
                            
[filter]
                                
id=Forx                          
[/filter]
                            
type=Goblin Pillager                      
[/modify_unit]



[remove_item]
x=44,45,45,44
y=28,28,28,27
[/remove_item]

[allow_recruit]
type=Goblin Impaler,Goblin Spearman,AGA Goblin Bladesman,AGA Goblin Swordsman,AGA Goblin Archer,Wolf Rider
side=1
[/allow_recruit]







[/then]




[else]









{MOVE_UNIT id=Forx 42 29}
{MOVE_UNIT id=Kark 42 28}







[unit]
x,y=44,28
side=1
type=Wolf Rider
[/unit]

[unit]
x,y=45,28
side=1
type=Wolf Rider
[/unit]

[unit]
x,y=46,28
side=1
type=Wolf Rider
[/unit]

[unit]
x,y=47,28
side=1
type=Wolf Rider
[/unit]



[modify_unit]
                            
[filter]
                                
id=Kark                           
[/filter]
                            
type=Goblin Knight                      
[/modify_unit]


[modify_unit]
                            
[filter]
                                
id=Forx                          
[/filter]
                            
type=Goblin Pillager                      
[/modify_unit]







[remove_item]
x=44,45,45,44
y=28,28,28,27
[/remove_item]





[remove_shroud]
side=1
x=45-49
y=2-3
[/remove_shroud]



[unit]
x,y=46,3
side=2
id=necromante
type=Necromancer
gender=female
can_recruit=yes
[/unit]




[place_shroud]
side=1
x=45-49
y=2-3
[/place_shroud]






[allow_recruit]
type=Goblin Impaler,Goblin Spearman,AGA Goblin Bladesman,AGA Goblin Swordsman,AGA Goblin Archer,Wolf Rider
side=1
[/allow_recruit]

[objectives]
side=1
[objective]
description= _ "Tuer la Necromante"
condition=win
[/objective]

[objective]
description= _ "Mort de Kark ou Forx"
condition=lose
[/objective]

[objective]
description= _ "Fin du decompte des tours"
condition=lose
[/objective]
note={EARLY_FINISH_BONUS_NOTE}+{NEW_GOLD_CARRYOVER_NOTE_40}
[/objectives]





[/else]

[/if]


[/event]







[event]

name=last breath

[filter]
id=ghost
[/filter]


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




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



[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]




{MOVE_UNIT id=$second_unit.id 12 21}




        [message]
            speaker=second_unit
            message= _ "Je la massacre cette naze!"

            [option]
                message= _ "C'est fini pour toi!"

                [command]

                    [message]
                        type=Elvish Shaman

                        message= _ "Nooooon!"
                    [/message]

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

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



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



                [/command]

            [/option]

            [option]
                message= _ "Ok ok... Je te laisse la vie sauve petite elfe..."

                [command]





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


{MOVE_UNIT id=elve 1 1}

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


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




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









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


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



      [unstore_unit]
         variable=second_unit
      [/unstore_unit]




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












[event]

name=moveto

first_time_only=yes

[filter]
side=1
x=12-60
y=1-26
[/filter]




[if]

[have_unit]
side=2
id=necromante
[/have_unit]

[then]



[/then]


[else]




[remove_shroud]
side=1
x=45-49
y=2-3
[/remove_shroud]



[unit]
x,y=46,3
side=2
id=necromante
type=Necromancer
gender=female
can_recruit=yes
[/unit]




[place_shroud]
side=1
x=45-49
y=2-3
[/place_shroud]



[objectives]
side=1
[objective]
description= _ "Tuer la Necromante"
condition=win
[/objective]

[objective]
description= _ "Mort de Kark ou Forx"
condition=lose
[/objective]

[objective]
description= _ "Fin du decompte des tours"
condition=lose
[/objective]
note={EARLY_FINISH_BONUS_NOTE}+{NEW_GOLD_CARRYOVER_NOTE_40}
[/objectives]




[/else]


[/if]




[/event]












[event]

name=last breath

[filter]
id=ghost2
[/filter]




[/event]



[event]

name=victory



[endlevel]
result=victory
bonus=yes
{NEW_GOLD_CARRYOVER 40}
[/endlevel]

[/event]


[event]

name=time over


[/event]







[event]

name=last breath

[filter]
id=necromante
[/filter]



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

[kill]
side=2
animate=yes
[/kill]

[kill]
side=3
animate=yes
[/kill]






[endlevel]
result=victory
bonus=yes
{NEW_GOLD_CARRYOVER 40}
[/endlevel]

[/event]






[event]

name=last breath

[filter]
id=Kark
[/filter]



[endlevel]
result=defeat
[/endlevel]

[/event]



[event]

name=last breath

[filter]
id=Forx
[/filter]



[endlevel]
result=defeat
[/endlevel]

[/event]



[/scenario]
Creator and maintainer of "A goblin adventure" (available) and "From Rocks and Blood"(available) --- Working on a new campaign "Facing Death"
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: Graziani WML Questions

Post by zookeeper »

It's "canrecruit", not "can_recruit".
User avatar
Graziani
Posts: 179
Joined: December 20th, 2010, 1:04 am
Location: France

Re: Graziani WML Questions

Post by Graziani »

I correct it thanks,

for the [command] tag in the event, do i miss something? It's not working
Creator and maintainer of "A goblin adventure" (available) and "From Rocks and Blood"(available) --- Working on a new campaign "Facing Death"
Post Reply