Elvish Tutorial
Moderator: Forum Moderators
- Viliam
- Translator
- Posts: 1341
- Joined: January 30th, 2004, 11:07 am
- Location: Bratislava, Slovakia
- Contact:
Elvish Tutorial
I started work on a new tutorial (technically, it is a user campaign)... I have a few ideas and would like to try them. So I started to study the WML language, and here are a few questions:
1) When are WML files re-loaded? When I change some campaign files, what do I have to do to make program use the newest version - should I exit to main menu and start a campaign again, or do I have to turn off program and start it again?
2) The "[scenario].[story].[part].background" attribute means which image should be shown in the story. Relatively to which directory? What should I write to make it point to campaign images in "userdata"? The convention that "~filename" is a "filename" in userdata directory, does it work only for preprocessor, or also for attributes containing file names?
3) Help says that when "[side]" includes attributes "x" and "y", the leader will start at that position (regardless of keep location). I tried to use this, but my leader still appears in the keep; why?
Please someone help me with these things... I hope you have already solved similar problems while making your campaigns. Here is included a ZIP file, the files belong to the "userdata/data/campaigns" directory.
1) When are WML files re-loaded? When I change some campaign files, what do I have to do to make program use the newest version - should I exit to main menu and start a campaign again, or do I have to turn off program and start it again?
2) The "[scenario].[story].[part].background" attribute means which image should be shown in the story. Relatively to which directory? What should I write to make it point to campaign images in "userdata"? The convention that "~filename" is a "filename" in userdata directory, does it work only for preprocessor, or also for attributes containing file names?
3) Help says that when "[side]" includes attributes "x" and "y", the leader will start at that position (regardless of keep location). I tried to use this, but my leader still appears in the keep; why?
Please someone help me with these things... I hope you have already solved similar problems while making your campaigns. Here is included a ZIP file, the files belong to the "userdata/data/campaigns" directory.
- Attachments
-
- Elvish_Tutorial.zip
- Elvish Tutorial, v.0.0.1
- (12.01 KiB) Downloaded 196 times
1) AFAICT, they are reloaded when you restart the program.
2)To add images for campaign use, you have to do this:
in your campaign definition (CAMPAIGNNAME.cfg in USERPREFS/data/campaigns/).
Then reference the images like normal. If your custom images are in USERPREFS/data/campaigns/{CAMPAIGN_NAME}/images/, they will be able to be referenced.
3) Probably an out-of-date or misinformed wiki. I have never heard of anyone doing this.
2)To add images for campaign use, you have to do this:
Code: Select all
[binary_path]
path=data/campaigns/{CAMPAIGN_NAME}/
[/binary_path]
Then reference the images like normal. If your custom images are in USERPREFS/data/campaigns/{CAMPAIGN_NAME}/images/, they will be able to be referenced.
3) Probably an out-of-date or misinformed wiki. I have never heard of anyone doing this.
For I am Turin Turambar - Master of Doom, by doom mastered. On permanent Wesbreak. Will not respond to private messages. Sorry!
And I hate stupid people.
The World of Orbivm
And I hate stupid people.
The World of Orbivm
- Viliam
- Translator
- Posts: 1341
- Joined: January 30th, 2004, 11:07 am
- Location: Bratislava, Slovakia
- Contact:
Thanks for the answers!
(If there is no way to do this directly, maybe I could edit the keep in the place I want my leader to appear, and then in the scenario startup event replace the terrain with grassland...)
It is not essential to my scenario, but I would like to have it.
So, is there a way to make leader start out of keep? If yes, how?turin wrote:3) Probably an out-of-date or misinformed wiki. I have never heard of anyone doing this.
(If there is no way to do this directly, maybe I could edit the keep in the place I want my leader to appear, and then in the scenario startup event replace the terrain with grassland...)
It is not essential to my scenario, but I would like to have it.
Try this:
NOTE: Code untested.
Code: Select all
[event]
name=prestart
[store_unit]
[filter]
side=INSERT SIDE HERE
canecruit=1
[/filter]
variable=leader
kill=yes
[/store_unit]
[set_variable]
name=leader.x
value=INSERT X HERE
[/set_variable]
[set_variable]
name=leader.y
value=INSERT Y HERE
[/set_variable]
[unstore_unit]
variable=leader
find_vacant=no
[/unstore_unit]
[/event]
- Viliam
- Translator
- Posts: 1341
- Joined: January 30th, 2004, 11:07 am
- Location: Bratislava, Slovakia
- Contact:
I tested the "[binary_path]" tag successfully, but I think this command should be used carefully, because it can lead to possible confict in image names. It could happen like this:
In my campaign "MYCAMPAIGN", I will put an image "hero.png" to a position
$userdata/data/campaigns/MYCAMPAIGN/images/hero.png
and then use
Someone else will make a campaign "OTHERCAMPAIGN" and make the image with same name "hero.png", and put it to
$userdata/data/campaigns/OTHERCAMPAIGN/images/hero.png
and then use
Now, when a user downloads both "MYCAMPAIGN" and "OTHERCAMPAIGN", both main campaign CFG files are processed, and now there is a conflict because "hero.png" for both campaigns will result with the same image (image of the campaign that goes sooner in alphabet).
How to avoid this conflict:
1) If you use images in scenarios only, put the "[binary_path]" command inside of "#ifdef" preprocessor command, like this:
2) If you use images also in the campaign menu (inside the "[campaign]" tag), you have to share the binary path with others. Therefore inside the "image" directory make another directory with the name of your campaign, to prevent namespace conflicts. So your campaign image should be placed like this:
$userdata/data/campaigns/MYCAMPAIGN/images/campaigns/MYCAMPAIGN/hero.png
It looks like twice the same thing, but the first "campaigns/MYCAMPAIGN" serves to physically separate data in disk, and the second "campaigns/MYCAMPAIGN" serves to separate the image namespaces, in case more scenarios will use the "[binary_path]" command.
In my campaign "MYCAMPAIGN", I will put an image "hero.png" to a position
$userdata/data/campaigns/MYCAMPAIGN/images/hero.png
and then use
Code: Select all
[binary_path]
path=data/campaigns/MYCAMPAIGN/
[/binary_path]
$userdata/data/campaigns/OTHERCAMPAIGN/images/hero.png
and then use
Code: Select all
[binary_path]
path=data/campaigns/OTHERCAMPAIGN/
[/binary_path]
How to avoid this conflict:
1) If you use images in scenarios only, put the "[binary_path]" command inside of "#ifdef" preprocessor command, like this:
Code: Select all
#ifdef CAMPAIGN_MYCAMPAIGN
[binary_path]
path=data/campaigns/MYCAMPAIGN/
[/binary_path]
{@campaigns/MYCAMPAIGN/scenarios}
#endif
$userdata/data/campaigns/MYCAMPAIGN/images/campaigns/MYCAMPAIGN/hero.png
It looks like twice the same thing, but the first "campaigns/MYCAMPAIGN" serves to physically separate data in disk, and the second "campaigns/MYCAMPAIGN" serves to separate the image namespaces, in case more scenarios will use the "[binary_path]" command.
- Viliam
- Translator
- Posts: 1341
- Joined: January 30th, 2004, 11:07 am
- Location: Bratislava, Slovakia
- Contact:
Too many deaths
Again, please help me! There is a situation where I do not know if I found a bug in the game, or if I have misunderstood something; in both cases, please tell me what should I do instead.
In the scenario, select Chantal and go to the keep in the north. There is an event triggered, which temporarily creates a friendly unit, displays a dialog, and then kills the friendly unit. Well, this is what it should do. But poor Chantal gets killed too. And I do not understand why.
My guess (but this is only a wild guess) is that "moveto" event associates the "[filter]" with the unit that has moved... and it somehow propagates into the "[kill]" action... both the unit [filter]ed inside the "[kill]" tag (the scout) and outside the "[kill]" tag (Chantal) get killed. Again, this is only a wild guess, I have not tried to read the code.
In the scenario, select Chantal and go to the keep in the north. There is an event triggered, which temporarily creates a friendly unit, displays a dialog, and then kills the friendly unit. Well, this is what it should do. But poor Chantal gets killed too. And I do not understand why.
Code: Select all
[event]
name=moveto
[filter]
x=51
y=51
[/filter]
[unit]
type=Elvish Scout
description=scout0
user_description= _"Scout Leader"
side=1
x=51
y=50
[/unit]
[message]
[filter]
description=scout0
[/filter]
message= _"Madam, we are ready to serve... if you have the money to pay us."
[/message]
[kill]
[filter]
description=scout0
[/filter]
[/kill]
[/event]
- Attachments
-
- Elvish_Tutorial.zip
- Elvish Tutorial, v.0.0.2
- (14.62 KiB) Downloaded 179 times
Maybe try it without description in filter in [kill], just x=51 and y=50.
Code: Select all
[kill]
[filter]
x=51
y=50
[/filter]
[/kill]
You don't use [filter] for [kill]. Just do
Again, if the Wiki contradicts this, it is probably wrong...
Scott, I'm suprised you didn't catch on to that.
Also, although using [filter] for [message]s might work (I don't know), it is not the customary thing to do. Instead, just do
Code: Select all
[kill]
description=scout1
[/kill]
Scott, I'm suprised you didn't catch on to that.
Also, although using [filter] for [message]s might work (I don't know), it is not the customary thing to do. Instead, just do
Code: Select all
[message]
description=scout1
message= _ "Whatever"
[/message]
For I am Turin Turambar - Master of Doom, by doom mastered. On permanent Wesbreak. Will not respond to private messages. Sorry!
And I hate stupid people.
The World of Orbivm
And I hate stupid people.
The World of Orbivm
That's what you just said, right?Tomsik wrote:Maybe try it without description in filter in [kill], just x=51 and y=50.
Hope springs eternal.
Wesnoth acronym guide.
Wesnoth acronym guide.
No; if you look at the code Tomsik posted along with that sentence, what he meant was "replace the description= in the [filter] tag with a x,y=".scott wrote:That's what you just said, right?Tomsik wrote:Maybe try it without description in filter in [kill], just x=51 and y=50.
Which won't work.
For I am Turin Turambar - Master of Doom, by doom mastered. On permanent Wesbreak. Will not respond to private messages. Sorry!
And I hate stupid people.
The World of Orbivm
And I hate stupid people.
The World of Orbivm
- Viliam
- Translator
- Posts: 1341
- Joined: January 30th, 2004, 11:07 am
- Location: Bratislava, Slovakia
- Contact:
Actually, it was my wrong understanding. Wiki says "standard unit filter", which I understood as "put here a [filter] tag", while the correct understanding seems to be "put here what you would put into a [filter] tag".turin wrote:Again, if the Wiki contradicts this, it is probably wrong...
Thanks for help!
- Viliam
- Translator
- Posts: 1341
- Joined: January 30th, 2004, 11:07 am
- Location: Bratislava, Slovakia
- Contact:
Gold
I wanted to make player wait until they have enough gold to recruit another unit. At that moment, I wanted to display a reminder.
But this is wrong. The "new turn" event seems invoked before the money for new turn is calculated, so the variable "$gold" contains the gold before income from villages was calculated.
Is there any nice way to fix this, or should I calculate the money myself (adding 2 + number of villages, subtracting number of scouts)?
By the way, the first scenario is almost playable now (except for this error). Any comments are welcome.
Code: Select all
[event]
name=new turn
first_time_only=no
[store_gold]
side=1
variable=gold
[/store_gold]
[if]
[variable]
name=told_money
equals=no
[/variable]
[variable]
name=gold
greater_than_equal_to=18
[/variable]
[then]
[message]
speaker=narrator
caption= _"Note:"
message= _"Now you can recruit another Scout. Chantal must be in the keep to recruit units."
[/message]
[set_variable]
name=told_money
value=yes
[/set_variable]
[/then]
[/if]
[/event]
Is there any nice way to fix this, or should I calculate the money myself (adding 2 + number of villages, subtracting number of scouts)?
By the way, the first scenario is almost playable now (except for this error). Any comments are welcome.
- Attachments
-
- Elvish_Tutorial_v_0_3.zip
- Elvish Tutorial v 0.3
- (14.29 KiB) Downloaded 188 times
-
- Posts: 266
- Joined: October 21st, 2005, 4:24 pm
- Location: In a galaxy, far, far away........
Re: Gold
But if a scout levels up, doesn't it cost more?Viliam wrote:Is there any nice way to fix this, or should I calculate the money myself (adding 2 + number of villages, subtracting number of scouts)?
(Or have I misunderstood a vital point )
If white was black and black was white, what would happen to zebra crossings?