A small bit of WML begs to be used!

Discussion and development of scenarios and campaigns for the game.

Moderators: Forum Moderators, Developers

Post Reply
Burnsaber
Posts: 322
Joined: August 1st, 2004, 6:10 pm
Location: Kuopio, finland

A small bit of WML begs to be used!

Post by Burnsaber »

I was in the thought of doing my own campaing, but now i noticed that i have lost all of my WML skills, and i`m not too fond of re-learning them. I had only done 3 scenarios so it`s not that much of a loss.

There is jut one thing. I spent hours and hours on a small piece of WML and like to see it getting used somewhere. I made WML for a wishing well, from where heroe(s) could get a one wish for a boosted trait.

This WML worked in wesnoth 9.0.1. If something has changed in WML since that, it might need some tuning.

Anyone can feel free to copy the WML to his own campaign! You just need to alter the X and Y coordinates and replace instances of heroa and herob with your main characters.

First define a variable for each hero (let`s call them heroa and herob) you want to be able to make a wish in a prestart event

Code: Select all

               [set_variable]
		name=heroawish
		value=0
	[/set_variable]
	[set_variable]
		name=herobwish
		value=0
	[/set_variable]

Then a *large* moveto event, first have it check if the characters have already wished

Code: Select all


[event]
	name=moveto
	first_time_only=no
		[filter]
		side=1
		x=where you want the well to be
		y=where you want the well to be
		[/filter]
		[if]
			[variable]
			name=heroawish
			numerical_equals=1
			[/variable]
			[then]
			[if]	
			[have_unit]
			description=Heroa
			x=wellcoordinate
			y=wellcoordinate
			[/have_unit]
			[then]
			[message]
			description=HeroA
		message=_ "I have already made my wish..." 
			[/message]
			[/then]
			[/if]
			[/then]
		[/if]
                                 [if]
			[variable]
			name=herobwish
			numerical_equals=1
			[/variable]
			[then]
			[if]	
			[have_unit]
			description=Herob
			x=wellcoordinate
			y=wellcoordinate
			[/have_unit]
			[then]
			[message]
			description=HeroB
		message=_ "I have already made my wish..." 
			[/message]
			[/then]
			[/if]
			[/then]
		[/if]
Then put this in the same event. You must create samekind bit for each hero and alter the id`s. So in Herob`s bit the object ids could be A_Speed_Hack , A_Power_Hack and so on.

Code: Select all

		[if]
			[variable]
			name=heroawish
			numerical_equals=0
			[/variable]
				[then]
				[if]
				[have_unit]
				description=HeroA
				x=Wellcoordinate
				y=Wellcoordinate
				[/have_unit]
						[then]
						[message]
						id=Moun_WISHINGWELL1
						speaker=narrator
						message= _ "You have come across to a wishing well. What would you like to wish for?"
						[option]
						id=Moun_WISHINGWELL2a
						message= _ "With this golden coin, i wish for speed to catch my enemies."
						[command]
						[gold]
						amount=-1
						[/gold]			
						[object]
						x=Wellcoordinate
						y=Wellcoordinate
						id=G_Speed_Hack
						duration=forever
						description= "Your wish will be fulfilled.."
						[effect]
						apply_to=movement
						increase=1
						[/effect]
						[/object]
								[set_variable]
								name=heroawish
								value=1
								[/set_variable]	
						[/command]
						[/option]

						[option]
						id=Moun_WISHINGWELL2b
						speaker=unit
						message= _ "With this golden coin, I wish for strenght to defeat my enemies."
						[command]
						[gold]
						amount=-1
						[/gold]
						[object]
						x=Wellcoordinate
						y=Wellcoordinate
						id=G_Power_Hack
						duration=forever
						description= "Your wish will be fulfilled.."
						[effect] 	
						apply_to=attack 
						range=short 
						increase_damage=2 
						[/effect] 
						[/object]
						[set_variable]
							name=HeroAwish
							value=1
						[/set_variable]
						[/command]
						[/option]
		
						[option]
						id=Moun_WISHINGWELL3
						speaker=unit
						message= _ "With this golden coin, I wish for resilience to withstand blows from my enemies."
						[command]
						[gold]
						amount=-1
						[/gold]
						[object]
						x=Wellcoordinate
						y=Wellcoordinate
						id=H_Tough_Hack
						duration=forever
						description= "Your wish will be fulfilled.."
						[effect] 
						apply_to=hitpoints
						increase_total=10
						heal_full=yes 
						[/effect]
						[/object]
			 			[set_variable]
							name=heroawish
							value=1
						[/set_variable]
						[/command]
						[/option]

						[option]
						id=Moun_WISHINGWELL3b
						speaker=unit
						message= _ "With this golden coin, I wish for intelligence to see my potential."
						[command]
						[gold]
						amount=-1
						[/gold]
						[object]
						x=Wellcoordinate
						y=Wellcoordinate
						id=H_Intelligence_Hack
						duration=forever
						description= "Your wish will be fulfilled.."
						[effect] 
						apply_to=max_experience 
						increase=-25% 
						[/effect]
						[/object]
						[set_variable]
							name=heroawish
							value=1
						[/set_variable]
						[/command]
						[/option]
						[/message]
						[message]
						description=HeroA
						message=_ "It worked! Too bad it`s a one shot wonder." 
						[/message]
						[/then]
				[/if]
				[/then]
		[/if]

Read about the adventurers of my pen & paper RPG group

"How could drops of water know themselves to be a river? Yet the river flows on." - Guess who?
ott
Inactive Developer
Posts: 838
Joined: September 28th, 2004, 10:20 am

Post by ott »

Would it not be simpler to define two wish events with first_time_only=yes, one specific to each hero, instead of keeping track of a variable?
This quote is not attributable to Antoine de Saint-Exupéry.
Burnsaber
Posts: 322
Joined: August 1st, 2004, 6:10 pm
Location: Kuopio, finland

Post by Burnsaber »

ott wrote:Would it not be simpler to define two wish events with first_time_only=yes, one specific to each hero, instead of keeping track of a variable?
It`s a small thing, but then you wouldn`t be able to wish again if you choose "i don`t want to make a wish right now".
Read about the adventurers of my pen & paper RPG group

"How could drops of water know themselves to be a river? Yet the river flows on." - Guess who?
Dacyn
Posts: 1855
Joined: May 1st, 2004, 9:34 am
Location: Texas

Re: A small bit of WML begs to be used!

Post by Dacyn »

Burnsaber wrote:I spent hours and hours on a small piece of WML and like to see it getting used somewhere.
Code like this should go here. I added it, and made several changes (it is much shorter now :) ). If you want to change something, it is a wiki...
Burnsaber
Posts: 322
Joined: August 1st, 2004, 6:10 pm
Location: Kuopio, finland

Re: A small bit of WML begs to be used!

Post by Burnsaber »

Dacyn wrote: I added it, and made several changes (it is much shorter now :) ). If you want to change something, it is a wiki...
Thank you very much! I`m no WML wizard, so thanks for shortening it up. I hope someone uses it, otherwise all my #!"&%!¤#`s said during the creating process would have gone to waste. It alwyas annoyed me how your heroes coulnd`t have traits.
Read about the adventurers of my pen & paper RPG group

"How could drops of water know themselves to be a river? Yet the river flows on." - Guess who?
Post Reply