a way to limit the number of specific units?

General feedback and discussion of the game.

Moderator: Forum Moderators

Post Reply
the81kid
Posts: 4
Joined: March 22nd, 2008, 11:47 am

a way to limit the number of specific units?

Post by the81kid »

Hi, I'm new to the forum and the game, but I'm fiddling with the creative aspect of it. I'm wondering if there is a way to limit how many of a specific unit a player can buy/recruit? For example, a hero-type unit. Is there a way or script to only let the player have one of this unit at any one time. So if/when the unit dies, the player must re-recruit it again, and there is always only one of this unit on the board. Or maybe I would limit it to two or nine, for example, on the board at any one time.

Thanks!
AI
Developer
Posts: 2396
Joined: January 31st, 2008, 8:38 pm

Re: a way to limit the number of specific units?

Post by AI »

Very possible, you can create a recruit event that disallows further recruiting, and a die event that re-allows it again. There are actual some official macros that do something similar.
Soliton
Site Administrator
Posts: 1685
Joined: April 5th, 2005, 3:25 pm
Location: #wesnoth-mp

Re: a way to limit the number of specific units?

Post by Soliton »

There are two core macros that should make this easy. Look for LIMIT_RECRUITS here
"If gameplay requires it, they can be made to live on Venus." -- scott
User avatar
appleide
Posts: 1003
Joined: November 8th, 2003, 10:03 pm
Location: Sydney,OZ

Re: a way to limit the number of specific units?

Post by appleide »

Put the hero into the player's recall list.
When it dies, put it back into the recall list.

Or you could use any other method. But I think this one is more appropriate for your purpose. The disadvantage though, is that the hero would cost 20 gold no matter what.
Why did the fish laugh? Because the sea weed.
the81kid
Posts: 4
Joined: March 22nd, 2008, 11:47 am

Re: a way to limit the number of specific units?

Post by the81kid »

All helpful. Thanks guys! I'm not much of a programmer or scripter (I'm a piano player!) but i'll have a gander over the easter weekend...
the81kid
Posts: 4
Joined: March 22nd, 2008, 11:47 am

Re: a way to limit the number of specific units?

Post by the81kid »

PS but if anyone has any more suggestions it would really help! me scripting is mostly trial and error...
Post Reply