[engine] Stop when attacked

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:
Post Reply
User avatar
beetlenaut
Developer
Posts: 2814
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: [engine] Stop when attacked

Post by beetlenaut »

Load the autosave of the turn with "Cancel orders" checked in the load dialog. That will prevent automatic movement at the beginning of the turn right after it loads.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
Tad_Carlucci
Inactive Developer
Posts: 503
Joined: April 24th, 2016, 4:18 pm

Re: [engine] Stop when attacked

Post by Tad_Carlucci »

I've not looked, but it seems to me that it is actually a good idea to offer a Settings option (default: No) to Automatically Cancel Orders When Attacked. Having to load an autosave seems to support the idea that Wesnoth depends upon reloading.
I forked real life and now I'm getting merge conflicts.
User avatar
WhiteWolf
Forum Moderator
Posts: 769
Joined: September 22nd, 2009, 7:48 pm
Location: Hungary

Re: [engine] Stop when attacked

Post by WhiteWolf »

I'm seconding the idea of having the feature available as a settings option.

In the meantime, this can actually be done already in a half-minute-to-write mod with a simple attack end event that resets the attacked unit's gotos.
So if anyone wants this available now, feel free to download the new Cancel the Preset Unit-Course if Attacked mod from the add-ons server... :D
Main UMC campaigns: The Ravagers - now for 1.16, with new bugs!
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
User avatar
josteph
Inactive Developer
Posts: 741
Joined: August 19th, 2017, 6:58 pm

Re: [engine] Stop when attacked

Post by josteph »

peterbill wrote: April 26th, 2019, 3:52 am It would be really great that I could choose an option (although I don't see why I wouldn't want it to be chosen) that would forget the path and make the unit to stop if it's been attacked.
The potential problem with such an option is that it discards user data. In general, when a program is dealing with data the user may have spent time creating, that data should not be deleted except by explicit user request. Maybe in this case it'd be fine...? :hmm:
WhiteWolf wrote: May 1st, 2019, 3:41 pm feel free to download the new Cancel the Preset Unit-Course if Attacked mod from the add-ons server... :D
Kudos! :)
User avatar
WhiteWolf
Forum Moderator
Posts: 769
Joined: September 22nd, 2009, 7:48 pm
Location: Hungary

Re: [engine] Stop when attacked

Post by WhiteWolf »

Just letting everyone know - the mod has been renamed to Advanced Order Cancelling, and now also supports issue https://github.com/wesnoth/wesnoth/issu ... -408765480 to have the ability to quickly unset a unit's orders through a right-click menu item or hotkey :)
Main UMC campaigns: The Ravagers - now for 1.16, with new bugs!
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
User avatar
Atreides
Posts: 1055
Joined: March 30th, 2019, 10:38 pm
Location: On the 2nd story of the centre village of Merwuerdigliebe turning the lights on and off

Re: [engine] Stop when attacked

Post by Atreides »

Thank you so much WhiteWolf for this mod that I've been desperately needing for quite a while now. I usually play on large or gigantic (Dominus maps 200x200 some!) maps and this is a godsend.

I was wondering if it could be extended to also cancel auto move orders for units that have _not_ seen a newly discovered unit (one that stops only the first unit to spot it... the following units keep going...). I realize that might be complicated but if there is a simple way to do it... :) It's not a big deal so don't bother unless there's a simple way.
User avatar
WhiteWolf
Forum Moderator
Posts: 769
Joined: September 22nd, 2009, 7:48 pm
Location: Hungary

Re: [engine] Stop when attacked

Post by WhiteWolf »

Atreides wrote: January 14th, 2021, 4:50 am cancel auto move orders for units that have _not_ seen a newly discovered unit (one that stops only the first unit to spot it... the following units keep going...).
I'm not sure I entirely understand. Wouldn't this just mean cancelling all orders unconditionally? It's been a while since I actually played so I don't remember how it works. Let me understand this:
- An enemy attacks your units and the mod cancels its orders. And the issue is that nearby units that do NOT get engaged by enemy units are not cancelled?
I guess that's a fair observation, after all you might want to reconsider movement based on the attack of an enemy, even if other units were attacked.
- Or do you mean that the unit is not attacked, but an enemy emerges from fog during their turn, and then the sighting unit and units around it should have their orders cancelled?

What do you think would be the correct radius in which to cancel orders? (That's the only way I can think of to make this happen, because at the time of sighted, the only data to filter on is the unit doing the sighting). I don't know, like a radius of 1.5*vision of sighting unit sounds reasonable? (and do a hard cut minimum of idk, 10 hexes in case a slow unit is doing the sighting but a fast unit with orders is also nearby).
Other option is to just cancel all remaining orders when an enemy is sighted, but that just sounds too extreme to me in terms of discarding user input data.
Main UMC campaigns: The Ravagers - now for 1.16, with new bugs!
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
User avatar
Atreides
Posts: 1055
Joined: March 30th, 2019, 10:38 pm
Location: On the 2nd story of the centre village of Merwuerdigliebe turning the lights on and off

Re: [engine] Stop when attacked

Post by Atreides »

Sorry if I was confusing. I was talking about when a unit stops its movement due to seeing a enemy unit. It gets the standard continue move message. On your turn when manually moving you get a choice to hit a key to move on but at the start of your turn automovers also get this message (only without an option - it's just a message).

That auto stop only works for the unit that sees the enemy first. If you have a couple moving in a bunch the rest will keep going unless they discover another enemy.

Come to think of it it is probably fine. If you spot only one new enemy only the lead unit stops and the rest rush on to meet that single enemy... OTOH if you run into a large number of hidden enemies they would stop an equal number of your units automoves.

Yeah, never mind, hehe. I was my bad habit of thinking with my fingers...

Your mod handles the far more critical problem of automovers actually getting attacked and they keep trying to move around them. It's happened to me many times!

The cancel all automoves menu option (which I enabled and seems to be sticky, nice) is great too. Very handy for RED ALERT cases when a Water Serpent suddenly pops up in in Twister Desert or Oasis in Freeze.
Last edited by Atreides on August 6th, 2021, 3:26 pm, edited 1 time in total.
User avatar
Atreides
Posts: 1055
Joined: March 30th, 2019, 10:38 pm
Location: On the 2nd story of the centre village of Merwuerdigliebe turning the lights on and off

Re: [engine] Stop when attacked

Post by Atreides »

To retrofit old saved games with this mod paste this into your savegame:

Code: Select all

	[event]
		name=attack end
		first_time_only=no
		id=CGIA_resetter
		[modify_unit]
			[filter]
				id=$second_unit.id
			[/filter]
			goto_x=0
			goto_y=0
		[/modify_unit]
	[/event]
Inevitably the saved games that need this mod the most are hundreds of turns long on oversized maps and take months to finish. These are wars, not skirmishes. Hehehe. Naturally I have a dozen saved games like this that I need to retrofit so I realized how to do it.

Naturally this only adds the most basic and essential function. No menus etc.
Post Reply