Flamesword,1.2,[event]

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
troodon
Posts: 218
Joined: July 22nd, 2006, 8:55 pm

Flamesword,1.2,[event]

Post by troodon »

3 questions.
1. How do you get it so that there is something like the flamesword from Heir to the Throne but isn't it into a campaign?
2. Will a campaign made for 1.1.2 work on wesnoth 1.2?
3. In my campaign, there is an event [move_unit_fake] that makes an ai unit move to a spot on the map. Then there is a message, a red flash, and some units appear on the map. So far, so good. But I want the unit that moved onto the spot to still be there, but with some damage done to the unit. How do I do that?
User avatar
Noyga
Inactive Developer
Posts: 1790
Joined: September 26th, 2005, 5:56 pm
Location: France

Post by Noyga »

2. unlikely. There were too much changes in the engine.
3. this can be done with store/unstore_unit... I don't remeber exactly the trick, and l'm too lazy to read the wiki for this.
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: Flamesword,1.2,[event]

Post by zookeeper »

troodon wrote:2. Will a campaign made for 1.1.2 work on wesnoth 1.2?
Actually, I think that there's a good chance of the campaign itself working (expect to have to make some small changes). But if your campaign includes custom units, then those might need to be changed more.
scott
Posts: 5248
Joined: May 12th, 2004, 12:35 am
Location: San Pedro, CA

Re: Flamesword,1.2,[event]

Post by scott »

troodon wrote:3 questions.
1. How do you get it so that there is something like the flamesword from Heir to the Throne but isn't it into a campaign?
Just take a look at how the event was put together. The WML that creates the flaming sword is right here:

Code: Select all

#define OBJ_SWORD_FIRE X Y ID
	{PLACE_IMAGE items/flame-sword.png ({X}) ({Y})}
	{VARIABLE sword_taken 0}
	[event]
	name=moveto
	first_time_only=no
		[filter]
		side=1
		x={X}
		y={Y}
		[/filter]
		[if]
		[variable]
		name=sword_taken
		numerical_equals=0
		[/variable]
		[then]
			[message]
			speaker=narrator
			image="wesnoth-icon.png"
				message= _ "Do you want this unit to pick up the sword?"
				[option]
				message= _ "Yes"
					[command]
						[object]
						id={ID}
						name= _ "Flaming Sword"
						image=attacks/sword-flaming.png
						duration=forever
						description= _ "This massive blade was created centuries ago by long-forgotten elvish forgemasters, who managed to imbue the bluish steel with an inner magical fire. Tongues of flame dance on the surface, giving the bluish steel a flawless mirrored finish."
						cannot_use_message= _ "Only the leader of an army can wield this sword!"
							[filter]
							type=Fighter,Commander,Lord,Princess,Battle Princess,Elvish Captain,Elvish Hero,Elvish Marshal,Elvish Champion,Paladin
							x,y={X},{Y}
							[/filter]
							[then]
								[removeitem]
								x,y={X},{Y}
								[/removeitem]
								[message]
								speaker=narrator
								image="wesnoth-icon.png"
								message= _ "As you place your hand around the glittering leather hilt, the sword roars to life! Strangely, you feel no heat once you pick it up, yet the grass at your feet bursts into flame as you test the heft of this mighty weapon."
								[/message]
								{VARIABLE sword_taken 1}
							[/then]
							[effect]
							apply_to=new_attack
							name= _ "flaming sword"
							icon=attacks/sword-flaming.png
							type=fire
							range=melee
							special=magical
							damage=15
							number=4
								[sound]
								time=-200
								sound=fire.wav
								[/sound]
							[/effect]
						[/object]
					[/command]
				[/option]
				[option]
				message= _ "No"
				[/option]
			[/message]
		[/then]
		[/if]
	[/event]
#enddef
Ok. All you have to do is modify this with the images, effects, etc. that you want.
There are other items you can look up in items.cfg in the game data directory.
Hope springs eternal.
Wesnoth acronym guide.
Post Reply