Graziani WML Questions

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.

Re: Graziani WML Questions

Postby Dugi » December 11th, 2015, 9:00 pm

Nooooo!
The code I posted (if I haven't made a minor mistake somewhere) should do the same as the whole event you posted.
Author of Legend of the Invincibles.
I am human, stronger than any god. -Joe Tiberi
User avatar
Dugi
 
Posts: 4759
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains

Re: Graziani WML Questions

Postby Graziani » December 11th, 2015, 9:05 pm

The second post code is based on yours, i just added code for each ghost id number (ghost1,ghost2...)
So if i understand, the #define GHOST_CHECK NUM X Y do this job, i don't have to do this
User avatar
Graziani
 
Posts: 70
Joined: December 20th, 2010, 1:04 am
Location: France

Re: Graziani WML Questions

Postby beetlenaut » December 11th, 2015, 9:09 pm

Computers are made to do the same thing over and over again. If you are copying and pasting the same code over and over with only small variations, that's usually an indication that you are doing something wrong. You used ghost1, ghost2,..., and Dugi is showing you that you can use ghost{NUM} to fill in for all of them, which is why his code is so much shorter.
Campaigns: Dead Water
The Founding of Borstep
Secrets of the Ancients
User avatar
beetlenaut
Developer
 
Posts: 2056
Joined: December 8th, 2007, 3:21 am
Location: Oaxaca, Mexico

Re: Graziani WML Questions

Postby Graziani » December 12th, 2015, 9:42 am

I get it, thank you! It's much better to read and easier to find errors on short codes.

But the event, even like Dugi one, is not fired... As always, i tried some issues, but i don't see the point.
User avatar
Graziani
 
Posts: 70
Joined: December 20th, 2010, 1:04 am
Location: France

Re: Graziani WML Questions

Postby Dugi » December 12th, 2015, 11:16 am

I suspect that you have a mistake somewhere elsewhere (like the summoner being named Demon_2 instead of demon2), try to add some [message] tags at the beginning of the event and inside every [then], [else] or [do] tag to see which conditions fire correctly and which ones don't.
Author of Legend of the Invincibles.
I am human, stronger than any god. -Joe Tiberi
User avatar
Dugi
 
Posts: 4759
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains

Re: Graziani WML Questions

Postby Graziani » January 31st, 2016, 7:37 pm

Dugi wrote:I suspect that you have a mistake somewhere elsewhere (like the summoner being named Demon_2 instead of demon2), try to add some [message] tags at the beginning of the event and inside every [then], [else] or [do] tag to see which conditions fire correctly and which ones don't.


The only time demon2 is mentionned in scenario wml is in this event, when the ghosts and demon2 are coming to map for first time.
Code: Select all
    [unit]
        type=Ixthala Spectral Demon
        side=2
        id=demon2
        x=11
        y=43
        ai_special=guardian
    [/unit]


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

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


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

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

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

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


Dugi wrote:The code I posted (if I haven't made a minor mistake somewhere) should do the same as the whole event you posted.



I put Dugi code instead of mine to replace dead ghost. There are no mistakes that i can see. But same problem. The dead ghost stay dead.

Code: Select all
[event]
 # while Spectral Ixthala is alive, replace any defeated ghosts
 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]
       [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]


Another different subject, the [command] bug (page 3 of this forum subject)
I'm sorry to insist, i feel myself realy stuck!

Elvish_Hunter wrote: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. :)


So, i replaced the last_breath event by die event. But, same that for demon2, ghostn3 appears only one time in the scenario wml, here:

Code: Select all
[event]
name=moveto
first_time_only=yes

[filter]
side=1
x=8-17
y=20-25
[/filter]

[unit]
x,y=14,15
side=4
type=Ghost
id=ghostn3
[/unit]

[/event]


Also, i tried what SkyOne proposed, about first and second choice instead of option_choice.

SkyOne wrote: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]





James_The_Invisible wrote:@Graziani I can see nothing wrong with your code but the [store_unit] is useless because exactly this is done automatically by Wesnoth.


I also deleted the [store_unit] tag. But, even with a good typo of ghostn3 (as it appears only one time in the wml scenario) and all theses corrections, the [command] function isn't fired at all.

Now, my event looks like this:


Code: Select all
[event]
name=die

[filter]
id=ghostn3
[/filter]

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

{MOVE_UNIT id=$second_unit.id 12 21}

        [message]
            id=first_choice
            speaker=second_unit
            message= _ "blabla"

            [option]
                message= _ "blablabla"

                [command]

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


                [/command]

            [/option]

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

                [command]

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


{MOVE_UNIT id=elve 1 1}

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

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


Thanks a lot for your help, as always. I can't wait to share with you my campaigns ^^ these two bugs are the last ones, i finaly finished my 2 campaigns!
User avatar
Graziani
 
Posts: 70
Joined: December 20th, 2010, 1:04 am
Location: France

Re: Graziani WML Questions

Postby Dugi » January 31st, 2016, 7:43 pm

I didn't notice that you named the ghosts ghostn1, ghostsn2 etc. I expected them to be named ghost1, ghost2 etc. Then replace my part id=ghost{NUM} to id=ghostn{NUM} (in both occurrences) and it should be okay. I think that you are not experimenting enough and insufficiently trying to understand the codes we post.
Author of Legend of the Invincibles.
I am human, stronger than any god. -Joe Tiberi
User avatar
Dugi
 
Posts: 4759
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains

Re: Graziani WML Questions

Postby Graziani » January 31st, 2016, 7:57 pm

No no Dugi, sorry my post is very long.

ghostn3 appears only in the other subject, he is the equivalent of demon2 for the problem you help me to solve.

It's 2 differents bugs i'm trying to solve, one with demon2 and its ghosts (ghost1, ghost2...) and one other with ghostn3, that when he dies, an option choice [command] isn't fired.

Actually, It's two different scenarios.

The ghosts are named ghost1, ghost2 etc... No problem in this situation
User avatar
Graziani
 
Posts: 70
Joined: December 20th, 2010, 1:04 am
Location: France

Re: Graziani WML Questions

Postby Dugi » January 31st, 2016, 8:02 pm

Then I am quite convinced that the problem is elsewhere in your code, not in my code. Maybe you could upload the whole scenario.
Author of Legend of the Invincibles.
I am human, stronger than any god. -Joe Tiberi
User avatar
Dugi
 
Posts: 4759
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains

Re: Graziani WML Questions

Postby Graziani » February 1st, 2016, 1:43 pm

Here i put the 3 events where demon2 involved. I deleted only the dialogs, because there is a lot ^^. If it's useful, i can post the whole scenario yes.

Code: Select all

[event]

name=moveto

[filter]
x=3-14
y=48-51
side=1
[/filter]

[remove_shroud]
x=10-13
y=43-48
side=1
[/remove_shroud]


[modify_side]
side=1
fog=no
[/modify_side]

    [unit]
        type=Scornful Watcher
        side=2
        id=demon
        x=11
        y=44
    [/unit]

    [unit]
        type=Ixthala Spectral Demon
        side=2
        id=demon2
        x=11
        y=43
        ai_special=guardian
    [/unit]


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

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


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

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

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

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





       [message]
            id=demon2
            message= _ "blabla"
        [/message]


       [message]
            id=demon
            message= _ "blabla"
        [/message]

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

[objectives]
side=1
[objective]
description= _ "Tuer le demon spectral"
condition=win
[/objective]
[objective]
description= _ "Mort de Godug, Firag, Crolog ou Darlasan"
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]
 # while Spectral Ixthala is alive, replace any defeated ghosts
 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]
       [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]

    [event]
name=last breath

        [filter]
            id=demon2
        [/filter]

        [message]
            id=demon2
            message= _ "blabla"
        [/message]

        [kill]
            id=demon2
            animate=yes
            fire_event=no
        [/kill]

        [kill]
            side=3
            animate=no
            fire_event=no
        [/kill]

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

[terrain]
x=13,14,9,10
y=41,41,39,38
terrain=Uu
[/terrain]

[redraw]
[/redraw]

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

[modify_side]
side=1
fog=yes
[/modify_side]

[objectives]
side=1
[objective]
description= _ "Nettoyer les galeries"
condition=win
[/objective]
[objective]
description= _ "Mort de Godug, Firag, Crolog ou Darlasan"
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]
User avatar
Graziani
 
Posts: 70
Joined: December 20th, 2010, 1:04 am
Location: France

Re: Graziani WML Questions

Postby Graziani » September 6th, 2017, 11:49 pm

Code: Select all


   [event]
        name=moveto

first_time_only=yes

[filter]
side=1
x=8-17
y=20-25
[/filter]

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

              # change music playing

        [music]
            name=traveling_minstrels.ogg
            immediate=yes
        [/music]


        {CHECK_EXPLORER}
        [message]

            speaker=$explorer.id
            message= _ ".."
        [/message]

        [scroll_to_unit]
            x,y=11,22
        [/scroll_to_unit]

        [delay]
            time=400
        [/delay]
      
{MOVE_UNIT id=$explorer.id 12 21}

        [message]
            speaker=$explorer.id
            message= _ "..."

            [option]
                message= _ "!"

                [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= _ " elfe..."

                [command]
            
            



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


{MOVE_UNIT id=elve 1 1}

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


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


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


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




        {CLEAR_VARIABLE explorer}


    [/event]
   
   




Finally I get it with a [move_to] event instead of a die or last_breath event. I used also $explorer.id . I don't know if it changed something important but now the [command] works perfectly.

I have a last question about this event. A potion spawn if the second choice is selected. When the character drink it, his hitpoints maximum increase for an amount of 30. I have doubt about the good code to select. I know the code for heal an unit, but i really don't get how to change the basic characteristics.

I tried this :

Code: Select all
      [set_variable]
         name=$explorer.id.hitpoints
         add=30
      [/set_variable]


But just no. It doesnt work.
I tried also with [modify_unit] with no success. I made some research on the forum and the website, and also on mainline campaings but i couldn't find something similar to what i want. Any idea ?
User avatar
Graziani
 
Posts: 70
Joined: December 20th, 2010, 1:04 am
Location: France

Re: Graziani WML Questions

Postby gfgtdf » September 7th, 2017, 12:08 am

A potion spawn if the second choice is selected. When the character drink it, his hitpoints maximum increase for an amount of 30. I have doubt about the good code to select


While this coudl in theory also be done via direct unit manipulation, it's usually beteer to use use [object] with [effect] apply_to=hitpoints
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
gfgtdf
Developer
 
Posts: 899
Joined: February 10th, 2013, 2:25 pm

Re: Graziani WML Questions

Postby Pentarctagon » September 7th, 2017, 12:38 am

Graziani wrote:I tried this :

Code: Select all
      [set_variable]
         name=$explorer.id.hitpoints
         add=30
      [/set_variable]


But just no. It doesnt work.
I tried also with [modify_unit] with no success. I made some research on the forum and the website, and also on mainline campaings but i couldn't find something similar to what i want. Any idea ?


Also, are you sure you meant to put that dollar sign there? I assume you intended to add 30 to explorer.id.hitpoints, not add 30 to the variable whose name is stored in $explorer.id.hitpoints.
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
Pentarctagon
Forum Administrator
 
Posts: 2919
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Graziani WML Questions

Postby Ravana » September 7th, 2017, 6:05 am

Rather, can change explorer.max_hitpoints. Though, this kind of modifications do not last over levelups. Use object if you want it persist.
User avatar
Ravana
Moderator
 
Posts: 1447
Joined: January 29th, 2012, 12:49 am
Location: Estonia

Re: Graziani WML Questions

Postby Graziani » September 7th, 2017, 1:05 pm

Thanks for your answers! I suceed with this :

Code: Select all
 [object]

                        [filter]
                            x=11
                            y=22
                            side=1
                        [/filter]

id=elvish_potion                     
image=items/potion-red.png                     
name= _ "Elvish Potion"
duration=campaign                       
description= _ "This potion will give you strenght."

 [effect]
 apply_to=attack
 range=melee
 increase_damage=1
 [/effect]

 [effect]
apply_to=hitpoints
increase_total=22
heal_full=yes
[/effect]

[/object]
User avatar
Graziani
 
Posts: 70
Joined: December 20th, 2010, 1:04 am
Location: France

Previous

Return to WML Workshop

Who is online

Users browsing this forum: No registered users and 5 guests