Giving units new abilities.

Discussion and development of scenarios and campaigns for the game.

Moderator: Forum Moderators

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

Giving units new abilities.

Post by Burnsaber »

I ran into a small problem while making my campaigns third scenario. I have opponent(trevor) that gives you a staff of teleportation when he dies. The problem is how i give the unit teleport? I don`t know if it can be done with [object], i have tried Scott`s idea( i have been bugging him with PM`s of my WML N00biness) of variables, but it doesn`t seem to work.

I have tried teleunit.abilities and teleunit.ability.
This is my current try...

Code: Select all

[event]
	name=die
		[filter]
		description=Trevor
		[/filter]
		[message]
		id=Moun_Laedos_42
		description=Trevor
		message= "No! My staff! It`s mine! MINE!"
		[/message]
		[kill]
		description=Trevor
		[/kill]
		[item]
		x=49
		y=10
		image=misc/item-staff.png
		[/item]
	[event]
	name=moveto
		[filter]
		side=1
		x=49
		y=10
		[/filter]
		[object]
		id={ID}
		name= _ "staff of teleportation"
		image=misc/item-staff.png
		duration=forever
		description= _ "This staff allows its wielder to teleport. It`s quite simple to use too!"
			[filter]
			side=1
			x=49
			y=10
			[/filter]
			[then]
				[removeitem]
				x=49
				y=10
				[/removeitem]
			[/then]
		[/object]
			[event]
				name=moveto
					[filter]
					side=1
					x=49
					y=10
					[/filter]
						[store_unit]
							[filter]
							x=49
							y=10
							[/filter]
						variable=teleunit
						[/store_unit]
						[set_variable]
						name=teleunit.ability
						teleport=on
						[/set_variable]
						[unstore_unit]
						variable=teleunit
						x=49
						y=10
						[/unstore_unit]
					[clear_variable]
					variable=teleunit
					[/clear_variable]
		[/event]
	[/event]
[/event]
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?
scott
Posts: 5243
Joined: May 12th, 2004, 12:35 am
Location: San Pedro, CA

Post by scott »

When you set the variable, try something like

[set_variable]
name=teleunit.abilities.teleport
value=on
[set_variable]

I would try to get this to work by itself and not worry about defining the object. The object should be defined outside of the [event] tag - it should be a child of [scenario].

However, if there is a way to define an object so that it will give you teleport, then never mind about storing the unit/setting the variable.
Hope springs eternal.
Wesnoth acronym guide.
User avatar
Elvish_Pillager
Posts: 8137
Joined: May 28th, 2004, 10:21 am
Location: Everywhere you think, nowhere you can possibly imagine.
Contact:

Post by Elvish_Pillager »

scott wrote:name=teleunit.abilities.teleport
Abilities are not unit variables. The only way to change a unit's abilities is to change its type.
It's all fun and games until someone loses a lawsuit. Oh, and by the way, sending me private messages won't work. :/ If you must contact me, there's an e-mail address listed on the website in my profile.
Burnsaber
Posts: 322
Joined: August 1st, 2004, 6:10 pm
Location: Kuopio, finland

Post by Burnsaber »

Elvish Pillager wrote: Abilities are not unit variables. The only way to change a unit's abilities is to change its type.
What a shame. I quess i`ll have to come up with different "reward" for killing him.
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