Allowing units to swap places

Brainstorm ideas of possible additions to the game. Read this before posting!

Moderator: Forum Moderators

Forum rules
Before posting a new idea, you must read the following:
User avatar
Ken_Oh
Moderator Emeritus
Posts: 2178
Joined: February 6th, 2006, 4:03 am
Location: Baltimore, Maryland, USA

Re: Allowing units to swap places

Post by Ken_Oh »

Go for it.
User avatar
DEATH_is_undead
Posts: 960
Joined: March 4th, 2007, 3:00 pm
Location: Northern United States

Re: Allowing units to swap places

Post by DEATH_is_undead »

5dPZ wrote: d. Players wanted and showed thier support to the previous idea raiser, instead of creating a duplicated topic - an unwanted action by devs/mods.
The idea is 2 years old; most of the people who were working on it (if any) have most likely abandoned it. Thread Necromancy is when you bump an old topic, with no gain to the topic whatsoever. As far as I could tell, support for this topic is not a gain to getting it any closer to finished.
3P MP Scenario - Great Dwarves Escape
The best way to learn is to follow. In order to learn WML, you have to follow other's work, and check their codes.
Tonepoet
Posts: 184
Joined: November 18th, 2005, 2:54 pm
Contact:

Re: Allowing units to swap places

Post by Tonepoet »

When somebody wants something implemented that was rejected simply due to developmental resource issues as opposed to gameplay issues, work towards that goal is appreciated and warrants new discussion. This was rejected due to both though. The lead developer likes the congested style of play caused by no unit swapping, so it'd not be included in mainline content. Therefore unless you can prove it'd be useful for usermade content, there's nothing justifying the bloat or the maintenance for inclusion in the game. The only outlined rule against necromancy concerns F.P.I. so I'd not sweat that too much. It pollutes the thread ecosphere a lot less to simply recycle an old topic, and keeps all posts within the same vein neatly bundled together for fuller consideration. If necromancy was automatically bad, I'd suggest the threads should just all autolock to prevent it myself.

On the other hand it is against general posting guidelines to post ideas without a good reasoning, regardless of the age of said post. Just be sure to read forum stickies wherever you post on the web in the future 'kay? Keeps the web nice clean and friendly. +1 vote isn't really a reason for anything, since Wesnoth's development methods aren't a democracy. ;)

That being said, if your suggestion to patch it wasn't simply just idle talk Ivan_D, I think this idea in particular might add interesting functionality to the right click menu functions in implementation. You can do things with it such as healing, gaining abilities and even create units with it already, so swapping seems like a rather natural extension of that set in my opinion. We already have teleportation to move a unit from one hex to another and plague which replaces an adjacent foe with a replica so I'd have assumed a simple thing such as a unit swap would already be possible in WML.

There's a lot of strategic implementation this could have in practice, particularly in low unit density cases. For one use it could be used as a clerical type spell in those RPG type scenarios that used to be so popular. You know, those little games where everybody controls a fixed number of units (usually only one) exploring a vast map containing a bunch of scripted events together. If applicable to friend and foe alike, it'd be rather useful to have the option to swap yourself with friends to get an extra attack in that'd otherwise be impossible or with certain foes to break specifically bothersome instances of ZoC and/or maybe even bring certain units into attacking range of a unit otherwise juust out of reach. For similar reasons, it'd be also be a useful ability to potentially have in Rumbles, Survival eXtremes, DotX, Arena Scenarios, and whatever other such similarly fun nonsense the community comes up with. We have had a lot of those in the past and I'm sure there are more coming.

Then again, I suppose this wouldn't be an immediately obvious function to think of if it's not implemented, now would it? Ah well, just throwing the thought out there so long as this thread is back from the grave.
Last edited by Tonepoet on March 15th, 2010, 9:32 pm, edited 1 time in total.
Htonsew Rof Elttab Eht is just too cool for school. I've got no words to describe it. Have any of you guys tried it? ;-)
User avatar
thespaceinvader
Retired Art Director
Posts: 8414
Joined: August 25th, 2007, 10:12 am
Location: Oxford, UK
Contact:

Re: Allowing units to swap places

Post by thespaceinvader »

If anyone's really concerned to do so, I wouldn't be *too* surprised to learn this could be done with WML anyway - I know some fairly esoteric effects can be accomplished.
http://thespaceinvader.co.uk | http://thespaceinvader.deviantart.com
Back to work. Current projects: Catching up on commits. Picking Meridia back up. Sprite animations, many and varied.
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: Allowing units to swap places

Post by zookeeper »

thespaceinvader wrote:If anyone's really concerned to do so, I wouldn't be *too* surprised to learn this could be done with WML anyway - I know some fairly esoteric effects can be accomplished.
No, can't really be done in a good way. Unless I'm forgetting something, you can't really check whether both units have enough MP to do the swap, and of course you'd lose undoability as well.
User avatar
thespaceinvader
Retired Art Director
Posts: 8414
Joined: August 25th, 2007, 10:12 am
Location: Oxford, UK
Contact:

Re: Allowing units to swap places

Post by thespaceinvader »

I thought you could check the MP - I seem to recall this being possible for merging units...?

Either way, it was merely a guess. I don't know WML that well...
http://thespaceinvader.co.uk | http://thespaceinvader.deviantart.com
Back to work. Current projects: Catching up on commits. Picking Meridia back up. Sprite animations, many and varied.
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: Allowing units to swap places

Post by zookeeper »

thespaceinvader wrote:I thought you could check the MP - I seem to recall this being possible for merging units...?
Right, actually that would be possible. Still, you'd lose undo whenever you'd swap, which would be quite an annoyance considering that you'd mostly use the feature when trying to find a way to shuffle units around in a tight situation, in which case being able to try out different things and undo when necessary is really nice. Although to be fair, even undoability could be retained in SP, just not in MP since it'd cause OOS.
User avatar
Zachron
Posts: 416
Joined: July 24th, 2007, 5:12 pm
Location: North Central Texas
Contact:

Re: Allowing units to swap places

Post by Zachron »

That would probably require a bit more than a simple patch...

Not to mention a potential abuse of the feature, would be to use skirmishers to dislodge flanked units from ZOC traps... Such a feature would undermine the balance of the whole game. Considering the flavor of such a feature, it would only be fitting if it were restricted to certain unit types. I.e. require units have an ability called "retrieve" which allows them to displace other units. (comparable to how, in some Fire Emblem games, horse-mounted units can pick up and move footman type units.) A good restriction for such an ability would be "not in default era" and "no skirmishers." Now it would be rather unseemly to addjust the games engine to allow for a feature that would basically be UMC bound. (Although it might be apt for the flavor of the Orbivm setting)
Project Battlescar: An rpg engine of my own design.
http://battlescar.wikispaces.com/
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: Allowing units to swap places

Post by zookeeper »

Here's a WML implementation of the swapping. It respects ZoC (moves are depleted if you swap-move next to an enemy with ZoC, unless you're a skirmisher) and depletes MPs correctly so it's not abusable, and fires moveto events for both units. Doesn't work for movement costs higher than 5, but there ought to be none of those in mainline. You can't undo except in single-player if you attempt a swap with not enough MP (but I didn't test if even that works).
Spoiler:
I don't know if the prestart event is necessary, I just put it there since I suspected OOS might ensue otherwise, but I never tested for it.
Attachments
Place in images/misc/
Place in images/misc/
swap.png (1.63 KiB) Viewed 3635 times
silene
Posts: 1109
Joined: August 28th, 2004, 10:02 pm

Re: Allowing units to swap places

Post by silene »

zookeeper wrote:Doesn't work for movement costs higher than 5, but there ought to be none of those in mainline.
You can use the following code to avoid this issue with movement cost (and to make the whole thing much shorter).

Code: Select all

[lua]
  code=<<
local x, y = wesnoth.get_variable "swapped.x", wesnoth.get_variable "swapped.y"
local u = wesnoth.get_units({x=x, y=y})[1]
local cost = wesnoth.unit_movement_cost(u, wesnoth.get_terrain(x, y))
wesnoth.set_variable("swapper_movement_cost", cost)
  >>
[/lua]
User avatar
Sapient
Inactive Developer
Posts: 4453
Joined: November 26th, 2005, 7:41 am
Contact:

Re: Allowing units to swap places

Post by Sapient »

wow, you definitely earned your title of "WML Wizard" with that post, zookeeper. :)
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
Post Reply