Elvish Tutorial

Discussion and development of scenarios and campaigns for the game.

Moderator: Forum Moderators

User avatar
Viliam
Translator
Posts: 1341
Joined: January 30th, 2004, 11:07 am
Location: Bratislava, Slovakia
Contact:

Elvish Tutorial

Post by Viliam »

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.
Attachments
Elvish_Tutorial.zip
Elvish Tutorial, v.0.0.1
(12.01 KiB) Downloaded 196 times
User avatar
turin
Lord of the East
Posts: 11662
Joined: January 11th, 2004, 7:17 pm
Location: Texas
Contact:

Post by turin »

1) AFAICT, they are reloaded when you restart the program.

2)To add images for campaign use, you have to do this:

Code: Select all

[binary_path]
path=data/campaigns/{CAMPAIGN_NAME}/
[/binary_path]
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.
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
User avatar
Viliam
Translator
Posts: 1341
Joined: January 30th, 2004, 11:07 am
Location: Bratislava, Slovakia
Contact:

Post by Viliam »

Thanks for the answers!
turin wrote:3) Probably an out-of-date or misinformed wiki. I have never heard of anyone doing this.
So, is there a way to make leader start out of keep? If yes, how?

(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.
User avatar
Tomsik
Posts: 1401
Joined: February 7th, 2005, 7:04 am
Location: Poland

Post by Tomsik »

Try this:

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]
NOTE: Code untested.
User avatar
Viliam
Translator
Posts: 1341
Joined: January 30th, 2004, 11:07 am
Location: Bratislava, Slovakia
Contact:

Post by Viliam »

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

Code: Select all

[binary_path]
  path=data/campaigns/MYCAMPAIGN/
[/binary_path]
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

Code: Select all

[binary_path]
  path=data/campaigns/OTHERCAMPAIGN/
[/binary_path]
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:

Code: Select all

#ifdef CAMPAIGN_MYCAMPAIGN
[binary_path]
  path=data/campaigns/MYCAMPAIGN/
[/binary_path]
{@campaigns/MYCAMPAIGN/scenarios}
#endif
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.
User avatar
Viliam
Translator
Posts: 1341
Joined: January 30th, 2004, 11:07 am
Location: Bratislava, Slovakia
Contact:

Too many deaths

Post by Viliam »

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.

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]
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.
Attachments
Elvish_Tutorial.zip
Elvish Tutorial, v.0.0.2
(14.62 KiB) Downloaded 179 times
User avatar
Tomsik
Posts: 1401
Joined: February 7th, 2005, 7:04 am
Location: Poland

Post by Tomsik »

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] 
scott
Posts: 5243
Joined: May 12th, 2004, 12:35 am
Location: San Pedro, CA

Post by scott »

I second Tomsik's fix.
Hope springs eternal.
Wesnoth acronym guide.
User avatar
turin
Lord of the East
Posts: 11662
Joined: January 11th, 2004, 7:17 pm
Location: Texas
Contact:

Post by turin »

You don't use [filter] for [kill]. Just do

Code: Select all

[kill]
description=scout1
[/kill]
Again, if the Wiki contradicts this, it is probably wrong...

Scott, I'm suprised you didn't catch on to that. :P


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
scott
Posts: 5243
Joined: May 12th, 2004, 12:35 am
Location: San Pedro, CA

Post by scott »

Tomsik wrote:Maybe try it without description in filter in [kill], just x=51 and y=50.
That's what you just said, right?
Hope springs eternal.
Wesnoth acronym guide.
User avatar
turin
Lord of the East
Posts: 11662
Joined: January 11th, 2004, 7:17 pm
Location: Texas
Contact:

Post by turin »

scott wrote:
Tomsik wrote:Maybe try it without description in filter in [kill], just x=51 and y=50.
That's what you just said, right?
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=".

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
User avatar
Viliam
Translator
Posts: 1341
Joined: January 30th, 2004, 11:07 am
Location: Bratislava, Slovakia
Contact:

Post by Viliam »

turin wrote:Again, if the Wiki contradicts this, it is probably wrong...
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".

Thanks for help!
User avatar
Viliam
Translator
Posts: 1341
Joined: January 30th, 2004, 11:07 am
Location: Bratislava, Slovakia
Contact:

Gold

Post by Viliam »

I wanted to make player wait until they have enough gold to recruit another unit. At that moment, I wanted to display a reminder.

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]
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.
Attachments
Elvish_Tutorial_v_0_3.zip
Elvish Tutorial v 0.3
(14.29 KiB) Downloaded 188 times
Emmanovi
Posts: 266
Joined: October 21st, 2005, 4:24 pm
Location: In a galaxy, far, far away........

Re: Gold

Post by Emmanovi »

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)?
But if a scout levels up, doesn't it cost more?

(Or have I misunderstood a vital point :?: )
If white was black and black was white, what would happen to zebra crossings?
User avatar
Viliam
Translator
Posts: 1341
Joined: January 30th, 2004, 11:07 am
Location: Bratislava, Slovakia
Contact:

Re: Gold

Post by Viliam »

Emmanovi wrote:But if a scout levels up, doesn't it cost more?
Yes, it does... but in my first scenario there are no enemies... so the scout will not level up. ;-)
Post Reply