Is there a way to make a Super Skirmisher ability?

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
weewah
Posts: 101
Joined: October 31st, 2019, 7:11 pm

Is there a way to make a Super Skirmisher ability?

Post by weewah »

I want to make a unit that can literally walk through enemy units, so that it becomes practically impossible to trap that unit. Even if you surround it with 6 level 3s it can just walk through them and escape. Is there a way to do that?
User avatar
Helmet
Posts: 641
Joined: December 19th, 2006, 5:28 pm
Location: Florida, USA

Re: Is there a way to make a Super Skirmisher ability?

Post by Helmet »

Somebody had a similar question recently. They also wanted a unit to move through an enemy unit.

This is the thread:
https://forums.wesnoth.org/viewtopic.php?f=21&t=53463

Ravana suggested, "This goal seems more suited to [move_unit_fake] and [unstore_unit]/[teleport]."
Author of:
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
weewah
Posts: 101
Joined: October 31st, 2019, 7:11 pm

Re: Is there a way to make a Super Skirmisher ability?

Post by weewah »

That's kind of different from what I want. That thread is for automatic moving of a unit through an enemy unit, with a predefined destination (behind the enemy). I want the player to be able to arbitrarily choose the destination instead.

The closest thing I can think of is to set Super Skirmishers to have 1 Max MP, and at the start of the scenario create [tunnel]s everywhere that only super skirmishers can move through. But this, while functionally identical to what I want for gameplay, looks really really weird.

Is there some kind of event that triggers just before a unit moves, so that I can fake move unit over the map from the start of the tunnel to the end, before the unit appears at the end?
User avatar
Helmet
Posts: 641
Joined: December 19th, 2006, 5:28 pm
Location: Florida, USA

Re: Is there a way to make a Super Skirmisher ability?

Post by Helmet »

weewah wrote: November 11th, 2020, 8:49 pm Is there some kind of event that triggers just before a unit moves, so that I can fake move unit over the map from the start of the tunnel to the end, before the unit appears at the end?
I don't recall seeing any kind of "pre-move" event on the Wiki. There is [select], but I can't imagine how that would help you.
Author of:
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
User avatar
Pentarctagon
Project Manager
Posts: 5566
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Is there a way to make a Super Skirmisher ability?

Post by Pentarctagon »

exit_hex, potentially?
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
User avatar
Celtic_Minstrel
Developer
Posts: 2233
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: Is there a way to make a Super Skirmisher ability?

Post by Celtic_Minstrel »

weewah wrote: November 11th, 2020, 8:49 pm at the start of the scenario create [tunnel]s everywhere that only super skirmishers can move through.
You probably want to make this a [teleport] ability rather than placing [tunnel]s in the scenario.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
weewah
Posts: 101
Joined: October 31st, 2019, 7:11 pm

Re: Is there a way to make a Super Skirmisher ability?

Post by weewah »

Celtic_Minstrel wrote: November 12th, 2020, 1:47 pm
weewah wrote: November 11th, 2020, 8:49 pm at the start of the scenario create [tunnel]s everywhere that only super skirmishers can move through.
You probably want to make this a [teleport] ability rather than placing [tunnel]s in the scenario.
I see that [teleport] allows you to put [tunnel] inside, but I don't quite understand how that works. Also, wouldn't teleport let the unit actually teleport between villages? Is there a way to use it just for tunneling but not for teleporting between villages?
User avatar
Helmet
Posts: 641
Joined: December 19th, 2006, 5:28 pm
Location: Florida, USA

Re: Is there a way to make a Super Skirmisher ability?

Post by Helmet »

weewah wrote: November 12th, 2020, 6:42 pm...wouldn't teleport let the unit actually teleport between villages? Is there a way to use it just for tunneling but not for teleporting between villages?
Teleporting doesn't involve villages at all, unless you add extra code.

You might consider experimenting with tunnel and teleport in a test scenario and compare the results.

Here is some code that creates a one-way tunnel from (3,3) to (15,3).

Code: Select all

[tunnel]
	[filter]
		side=1
	[/filter]
	[source]
		x,y=3,3
	[/source]
	[target]
		x,y=15,3
	[/target]
	pass_allied_units=no
	bidirectional=no
[/tunnel]	
And here is some code that will move a specific unit to (20,5). That's the nice thing about teleport. It doesn't care where you start, only where you're going.

Code: Select all

[teleport]
	[filter]
		id=MyLeader
	[/filter]
	x,y=20,5
[/teleport]
Author of:
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
weewah
Posts: 101
Joined: October 31st, 2019, 7:11 pm

Re: Is there a way to make a Super Skirmisher ability?

Post by weewah »

There's two different things both called [teleport]: a unit ability, and a direct action.

The direct action version of [teleport] doesn't help here, as far as I know.
User avatar
Celtic_Minstrel
Developer
Posts: 2233
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: Is there a way to make a Super Skirmisher ability?

Post by Celtic_Minstrel »

weewah wrote: November 12th, 2020, 6:42 pm I see that [teleport] allows you to put [tunnel] inside, but I don't quite understand how that works. Also, wouldn't teleport let the unit actually teleport between villages? Is there a way to use it just for tunneling but not for teleporting between villages?
A teleport ability just creates tunnels that only the owning unit can pass through. If those tunnels are set to be on villages, then the unit can teleport between villages. If they're set to be on keeps, then the unit can teleport between keeps. If they're set to be on spaces adjacent to an enemy unit that's adjacent to the owner, then the unit can teleport to any unoccupied space adjacent to an adjacent enemy.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
User avatar
Helmet
Posts: 641
Joined: December 19th, 2006, 5:28 pm
Location: Florida, USA

Re: Is there a way to make a Super Skirmisher ability?

Post by Helmet »

Celtic_Minstrel wrote: November 13th, 2020, 7:29 pmA teleport ability just creates tunnels that only the owning unit can pass through. If those tunnels are set to be on villages, then the unit can teleport between villages. If they're set to be on keeps, then the unit can teleport between keeps. If they're set to be on spaces adjacent to an enemy unit that's adjacent to the owner, then the unit can teleport to any unoccupied space adjacent to an adjacent enemy.
For a code example, you might check out the excellent campaign "The Black Cross of Aleron." Some elvish shamans in that campaign can treewalk; that is, teleport between Great Trees.
Author of:
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
User avatar
Celtic_Minstrel
Developer
Posts: 2233
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: Is there a way to make a Super Skirmisher ability?

Post by Celtic_Minstrel »

Yes, my treewalk is indeed another example of what the teleport ability can do.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
weewah
Posts: 101
Joined: October 31st, 2019, 7:11 pm

Re: Is there a way to make a Super Skirmisher ability?

Post by weewah »

Hmm. I just realized that I don't actually know how to do that. :doh:

So I currently have something like:

Code: Select all

	#define ABILITY_SUPER_SKIRMISHER
		[teleport]
			...
			[tunnel]
				[source]
					?
				[/source]
				[target]
					?
				[/target]
			[/tunnel]	
		[/teleport]
	#enddef

	[unit_type]
		...
		[abilities]
			{ABILITY_SUPER_SKIRMISHER}
		[/abilities]
	[/unit_type]
But I am not sure what to put in the source and target tags. How do I get it to say the unit can teleport from its current location to any location within radius 5?
User avatar
Celtic_Minstrel
Developer
Posts: 2233
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: Is there a way to make a Super Skirmisher ability?

Post by Celtic_Minstrel »

The source and target is the same as any ordinary tunnel, so you have access to the unit as $teleport_unit. So, if you want the unit to be able to teleport from anywhere, you could set the source to x,y=$teleport_unit.x,$teleport_unit.y. If you want a radius, use the same thing for the target and add radius=5.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
Post Reply