Flameslash's Questions - Is it possible to define the traits of recruits?

The place to post your WML questions and answers.

Moderators: Forum Moderators, Developers

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
Flameslash
Posts: 633
Joined: December 21st, 2008, 12:29 pm

Flameslash's Questions - Is it possible to define the traits of recruits?

Post by Flameslash » April 14th, 2018, 6:28 pm

Okay so I decided to make one thread for my questions from now on, rather than making loads over and over.

Today I'm wondering whether it's possible to define the traits of recruits. I'm making a chase scenario, and I was wondering if I could make it so that all units recruited by the side doing the chasing have the 'Quick' trait.

User avatar
beetlenaut
Developer
Posts: 2185
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: Flameslash's Questions - Is it possible to define the traits of recruits?

Post by beetlenaut » April 15th, 2018, 4:46 am

Not exactly, but it's easy to create a unit with whatever traits you want. So, you can check all recruited units to see if they have quick. If one of them doesn't, you can kill it and manually replace it with a [unit] that does. (If you define a unit with only one trait, the other trait will be filled in automatically.)
Campaigns: Dead Water
The Founding of Borstep
Secrets of the Ancients

User avatar
Flameslash
Posts: 633
Joined: December 21st, 2008, 12:29 pm

Re: Flameslash's Questions - Is it possible to define the traits of recruits?

Post by Flameslash » April 15th, 2018, 4:10 pm

Hmm, that seems a pretty convoluted way of doing it. It could work, sure, but I think I'll go with something simpler and just give the chaser more distance to catch up over. Thanks anyway.

User avatar
beetlenaut
Developer
Posts: 2185
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: Flameslash's Questions - Is it possible to define the traits of recruits?

Post by beetlenaut » April 15th, 2018, 7:31 pm

Okay, if you say so. Mainline campaigns include some far more convoluted code than that though. Sometimes WML doesn't leave you a lot of options. That said, giving the quick trait might not be a good idea anyway because it would just seem like good luck to the player. You might consider having the leader hand out a potion that increases speed for the scenario or something like that. (There's precedent for that with holy water on undead scenarios.) Changing the map would still be the easiest solution.
Campaigns: Dead Water
The Founding of Borstep
Secrets of the Ancients

User avatar
Flameslash
Posts: 633
Joined: December 21st, 2008, 12:29 pm

Re: Flameslash's Questions - Is it possible to define the traits of recruits?

Post by Flameslash » April 15th, 2018, 8:17 pm

A bit convoluted is my way of saying that it's probably beyond my ability-level at the moment. Just look at the amount of threads I've made in this forum recently, clearly I'm not very good.

Worth noting that the chaser is AI-controlled, so I'm not sure if the AI could handle the potion option.

I suppose a third option could be to create a custom unit that's simply a clone of the base unit, but with an additional MP.

User avatar
beetlenaut
Developer
Posts: 2185
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: Flameslash's Questions - Is it possible to define the traits of recruits?

Post by beetlenaut » April 15th, 2018, 9:56 pm

Flameslash wrote:
April 15th, 2018, 8:17 pm
Worth noting that the chaser is AI-controlled, so I'm not sure if the AI could handle the potion option.
That's probably the simplest one actually. I didn't test this, but it would be something like:

Code: Select all

[event]
	name=recruit
	first_time_only=no
	[filter]
		side=2
	[/filter]
	[object]
		silent=yes
		[effect]
			apply_to=movement
			increase=1
		[/effect]
	[/object]
[/event]
...
[message]
	speaker=leader_of_side_1
	message= _ "Uh, oh. That stuff they are drinking is called coffee. It makes you run faster, so we'd better hurry!"
[/message]
Cloning the unit is just as easy conceptually, but it adds an extra file, so it's a bit messier I think.
Campaigns: Dead Water
The Founding of Borstep
Secrets of the Ancients

User avatar
Flameslash
Posts: 633
Joined: December 21st, 2008, 12:29 pm

Re: Flameslash's Questions - Is it possible to define the traits of recruits?

Post by Flameslash » April 15th, 2018, 10:09 pm

Ah, when you said a potion I was picturing a pick-up on the map that the AI units would have to move to. That solution could work very elegantly, actually, thank you.

User avatar
octalot
Code Contributor
Posts: 188
Joined: July 17th, 2010, 7:40 pm

Re: Flameslash's Questions - Is it possible to define the traits of recruits?

Post by octalot » April 15th, 2018, 10:41 pm

A version which also lets the player see that these units have drunk a quickness potion in the right-hand-side status bar.

Code: Select all

	[event]
		name=recruit
		first_time_only=no
		[filter]
			side=2
		[/filter]
		[object]
			silent=yes
			duration=forever
			[effect]
				apply_to=movement
				increase=1
			[/effect]
			# the second effect just adds text to the unit's stats on the
			# right-hand side of the screen
			[effect]
				apply_to=new_ability
				[abilities]
					[dummy]
						id=example_quick_potion
						name="magic quickness"
						description="All of Big Bad's recruits have drunk a magic potion which makes them chase you faster"
					[/dummy]
				[/abilities]
			[/effect]
		[/object]
	[/event]
[code]

Post Reply