Graziani WML Questions
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.
Re: Graziani WML Questions
Nooooo!
The code I posted (if I haven't made a minor mistake somewhere) should do the same as the whole event you posted.
The code I posted (if I haven't made a minor mistake somewhere) should do the same as the whole event you posted.
Re: Graziani WML Questions
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
So if i understand, the #define GHOST_CHECK NUM X Y do this job, i don't have to do this
Creator and maintainer of "A goblin adventure" (available) and "From Rocks and Blood"(available) --- Working on a new campaign "Facing Death"
- beetlenaut
- Developer
- Posts: 2827
- Joined: December 8th, 2007, 3:21 am
- Location: Washington State
- Contact:
Re: Graziani WML Questions
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,
and WML Guide
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
Re: Graziani WML Questions
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.
But the event, even like Dugi one, is not fired... As always, i tried some issues, but i don't see the point.
Creator and maintainer of "A goblin adventure" (available) and "From Rocks and Blood"(available) --- Working on a new campaign "Facing Death"
Re: Graziani WML Questions
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.
Re: Graziani WML Questions
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.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.
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]
I'm sorry to insist, i feel myself realy stuck!
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: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.
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]
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]
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.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.
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]
Creator and maintainer of "A goblin adventure" (available) and "From Rocks and Blood"(available) --- Working on a new campaign "Facing Death"
Re: Graziani WML Questions
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.Re: Graziani WML Questions
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
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
Creator and maintainer of "A goblin adventure" (available) and "From Rocks and Blood"(available) --- Working on a new campaign "Facing Death"
Re: Graziani WML Questions
Then I am quite convinced that the problem is elsewhere in your code, not in my code. Maybe you could upload the whole scenario.
Re: Graziani WML Questions
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]
Creator and maintainer of "A goblin adventure" (available) and "From Rocks and Blood"(available) --- Working on a new campaign "Facing Death"
Re: Graziani WML Questions
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]
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 ?
Creator and maintainer of "A goblin adventure" (available) and "From Rocks and Blood"(available) --- Working on a new campaign "Facing Death"
Re: Graziani WML Questions
While this coudl in theory also be done via direct unit manipulation, it's usually beteer to use use [object] with [effect] apply_to=hitpointsA 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
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.
- Pentarctagon
- Project Manager
- Posts: 5567
- Joined: March 22nd, 2009, 10:50 pm
- Location: Earth (occasionally)
Re: Graziani WML Questions
Also, are you sure you meant to put that dollar sign there? I assume you intended to add 30 toGraziani wrote:I tried this :
But just no. It doesnt work.Code: Select all
[set_variable] name=$explorer.id.hitpoints add=30 [/set_variable]
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 ?
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
take one down, patch it around
-2,147,483,648 little bugs in the code
Re: Graziani WML Questions
Rather, can change explorer.max_hitpoints. Though, this kind of modifications do not last over levelups. Use object if you want it persist.
Re: Graziani WML Questions
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]
Creator and maintainer of "A goblin adventure" (available) and "From Rocks and Blood"(available) --- Working on a new campaign "Facing Death"