set difficulty in a scenario?

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
cool evil
Posts: 244
Joined: September 13th, 2007, 10:56 pm

set difficulty in a scenario?

Post by cool evil »

Hi, i have something to ask, it's been bugging me for a long time, the problem is that how do you set difficulty in a scenario? i know how to do it in a campaign, but i need some insights on a scenario level.

I need the following things in WML codes:

-A unit from side 1 at the start of the game must moves to location 17,17, it triggers an event and pops up a window saying to choose difficulty, then the users choose from three different difficulty (easy, medium, hard)

-on easy side 1,2,3 gets 100 gold
-on medium side 1,2,3,4,5,6 all gets 100 gold
-on hard side 1,2,3 gets 50 gold, 4,5,6 gets 100.

Code: Select all

[multiplayer]
     id=multiplayer_Battle1
     name= _ "3p - Battle1"
     map_data="{maps/multiplayer/6p_Battle1}"
     description= _ "Use map settings."
  
     {DEFAULT_SCHEDULE}
     {DEFAULT_MUSIC_PLAYLIST}

     [side]
     [ai]
     village_per_scout=12
     [/ai]
     side=1
     canrecruit=1
     controller=human
     gold=50
     village_gold=3
     fog=yes
     [/side] 

     [side]
     [ai]
     village_per_scout=12
     [/ai]
     side=2
     canrecruit=1
     controller=human
     gold=50
     village_gold=3
     fog=yes
     [/side] 

     [side]
     [ai]
     village_per_scout=12
     [/ai]
     side=3
     canrecruit=1
     controller=human
     gold=50
     village_gold=3
     fog=yes
     [/side] 

     [side]
     [ai]
     village_per_scout=12
     [/ai]
     side=4
     canrecruit=1
     controller=ai
     gold=50
     village_gold=3
     fog=yes
     [/side] 

     [side]
     [ai]
     village_per_scout=12
     [/ai]
     side=5
     canrecruit=1
     controller=ai
     gold=50
     village_gold=3
     fog=yes
     [/side] 

     [side]
     [ai]
     village_per_scout=12
     [/ai]
     side=6
     canrecruit=1
     controller=ai
     gold=50
     village_gold=3
     fog=yes
     [/side] 

[/multiplayer] 
Thanks in advance for answering.
CIB
Code Contributor
Posts: 625
Joined: November 24th, 2006, 11:26 pm

Post by CIB »

If it is not Multiplayer, you can simply pop up a select dialog at the start of a scenario(see InterfaceActionsWML). If it is multiplayer, you will have to use some trick(see Unnatural Winter for a good example)
meriton
Posts: 77
Joined: March 17th, 2007, 1:17 pm

Post by meriton »

The following approach should work for both multi- and single player:

Write a moveto-event that triggers when side=1 and x,y=17,17
In that event, use [message] to display a prompt, and inside it, an [option] for each difficulty setting you want. In each option, you use [gold] to give the corresponding side(s) additional gold.

I leave the details for you to work out. The wml reference is your friend.
User avatar
cool evil
Posts: 244
Joined: September 13th, 2007, 10:56 pm

Post by cool evil »

Ummmm, okay.... i was looking for a more straightforward post for someone to finish the code for me. The WML reference isn't really helpful so i think i'll just drop this idea then.
meriton
Posts: 77
Joined: March 17th, 2007, 1:17 pm

Post by meriton »

The WML reference isn't really helpful
I think it is - if you take the time to read it. If it isn't, please point out how it could be improved.
User avatar
Bob_The_Mighty
Posts: 870
Joined: July 13th, 2006, 1:15 pm

Post by Bob_The_Mighty »

Code: Select all

[event]
name=moveto
[filter]
x=17
y=17
side=1
[/filter]
[message]
	speaker=narrator
	caption="Difficulty"
	message= _ "Choose a difficulty level."

[option]
	message= _ "Easy"
[command]
[gold]
	side=1
	amount=100
	[/gold]
[gold]
	side=2
	amount=100
	[/gold]
[gold]
	side=3
	amount=100
	[/gold]
[/command]
[/option]

[option]
	message= _ "Medium"
[command]
[gold]
	side=1
	amount=100
	[/gold]
[gold]
	side=2
	amount=100
	[/gold]
[gold]
	side=3
	amount=100
	[/gold]
[gold]
	side=4
	amount=100
	[/gold]
[gold]
	side=5
	amount=100
	[/gold]
[gold]
	side=6
	amount=100
	[/gold]
[/command]
[/option]

[option]
	message= _ "Hard"
[command]
[gold]
	side=1
	amount=50
	[/gold]
[gold]
	side=2
	amount=50
	[/gold]
[gold]
	side=3
	amount=50
	[/gold]
[gold]
	side=4
	amount=100
	[/gold]
[gold]
	side=5
	amount=100
	[/gold]
[gold]
	side=6
	amount=100
	[/gold]
[/command]
[/option]

[/message]
[/event]
My current projects:
MP pirate campaign: The Altaz Mariners
RPG sequel: Return to Trent
MP stealth campaign: Den of Thieves
User avatar
cool evil
Posts: 244
Joined: September 13th, 2007, 10:56 pm

Post by cool evil »

meriton wrote:
The WML reference isn't really helpful
I think it is - if you take the time to read it. If it isn't, please point out how it could be improved.
For starters, there could be more examples, just giving out tags and several sentences about how you should use it doesn't sound straightforward to me. There is no clearly organized section about what kind of WML should you use if you want to set difficulty, set the turns to change according to user actions, all this code is hard to find unless you dig through some very complex sections (the variableWML is probably one of the most confusing)

Maybe people here got an uncanny knack to find and decipher WMLs, but from my looks of it, the reference isn't that helpful.

BTW, thanks for the codes, Bob! You sure saved me the time and fraustration to go through and find everything!
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

Yes, the WML reference is certainly not useful in learning WML when you don't know where to start. It's only useful in learning what specific tags do when you already know how things generally work and you already do more or less what you want to do.

We have no good "WML for beginners" tutorial, and probably won't be getting one anytime soon either. Which is a shame of course, but I'm afraid not many people who would be capable of writing something like that would be very interested in doing so.
CIB
Code Contributor
Posts: 625
Joined: November 24th, 2006, 11:26 pm

Post by CIB »

When you want to learn how to do something, you do it like this:

-you look at the source of a scenario that does what you want
-you find the section that does it
-you find out, how it is done by looking all the tags up in ReferenceWM
User avatar
cool evil
Posts: 244
Joined: September 13th, 2007, 10:56 pm

Post by cool evil »

CIB wrote:When you want to learn how to do something, you do it like this:

-you look at the source of a scenario that does what you want
-you find the section that does it
-you find out, how it is done by looking all the tags up in ReferenceWM
The thing is you have to download bunch of add-ons just to view their codes, most of the advanced codes isn't built into the default scenarios of wesnoth. And even sometimes the codes in the add-ons aren't exactly the ones you were looking for. So that's why the WML workshop is here.
User avatar
cool evil
Posts: 244
Joined: September 13th, 2007, 10:56 pm

Post by cool evil »

Just one last question, what do you have to do to set turn limits according to the difficulty settings?
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

Post Reply