[engine] Enhancement to [put_to_recall_list]: refresh objects

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

Moderators: Forum Moderators, Developers

Forum rules
Before posting a new idea, you must read the following:
Post Reply
User avatar
WhiteWolf
Forum Regular
Posts: 543
Joined: September 22nd, 2009, 7:48 pm
Location: Hungary

[engine] Enhancement to [put_to_recall_list]: refresh objects

Post by WhiteWolf » September 1st, 2019, 2:25 pm

Hello,

Currently, if you want your units to be put back to the recall list, healed and cleared of statuses (just like it would happen at the end of a scenario), you can use [put_to_recall_list] with heal=yes.
However, this doesn't recalculate scenario duration objects. And if you recall your units on the next scenario, the objects that should have been cleared are still active, and will only disappear at the end of the current scenario.
The workaround that I found for this, is to give all objects an ID, and remove them by hand before using [put_to_recall_list] on the unit.

My proposal is to enhance the tag with a refresh_objects key, so that if it's set to yes, it will remove all scenario (and possibly "turn" as well, if it was applied on that turn?) duration objects.
It'd save a lot of grief, and I hope it's easy to implement :)
Author of the Underness Series, consisting of V parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
Standalone works: The Ravagers - now for 1.14, with new bugs!

User avatar
Ravana
Moderator
Posts: 2177
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: [engine] Enhancement to [put_to_recall_list]: refresh objects

Post by Ravana » September 1st, 2019, 2:28 pm

There is no reason why putting unit to recall list should mean that scenario has ended. If it is in recall list, it can be recalled in same scenario.

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

Re: [engine] Enhancement to [put_to_recall_list]: refresh objects

Post by beetlenaut » September 1st, 2019, 3:24 pm

That wouldn't be a problem if the proposed key defaulted to "no".
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide

User avatar
josteph
Developer
Posts: 678
Joined: August 19th, 2017, 6:58 pm

Re: [engine] Enhancement to [put_to_recall_list]: refresh objects

Post by josteph » September 1st, 2019, 5:33 pm

I don't understand what the proposed key would do. Would it just mean "expire duration=scenario objects when putting units to the recall list"? If so, maybe the API should take the duration to expire as a string? (expire_objects_by_duration=scenario, for example)

In the C++ there's an API for expiring modifications:

https://github.com/wesnoth/wesnoth/blob ... 1202-L1254

Sounds like what you want is to call it (with argument "scenario") when putting a unit to the recall list...but I don't think it's exposed to Lua, is it?

Or maybe you should be creating the objects with duration=until_putting_to_recall_list in the first place? (that's not an already-existing duration value, it'd have to be implemented)

User avatar
WhiteWolf
Forum Regular
Posts: 543
Joined: September 22nd, 2009, 7:48 pm
Location: Hungary

Re: [engine] Enhancement to [put_to_recall_list]: refresh objects

Post by WhiteWolf » September 1st, 2019, 6:17 pm

Here's the case where I would use this feature: let's say a map ended, but you would like to do a little end-scene, with just two of your heroes. And you'll also change the map to a small, scene-map, like a room in a tower or whatever. Then you need to solve all the remaining units on the battlefield in the end. The easiest and quickest is to put them all to the recall list with heal=yes, and they'll be fine for the next scenario.
However, let's say there are weapon specials that dealt lots of [object]'s on the units, some even affecting the max HP, but with scenario duration. At the end, when I put back all units onto the recall list, these objects should expire. Currently they don't.
Ravana wrote:
September 1st, 2019, 2:28 pm
There is no reason why putting unit to recall list should mean that scenario has ended. If it is in recall list, it can be recalled in same scenario.
Indeed, so the default value should definitely be no. Generally you wouldn't need this key, but I'd find it useful in cases like the one above, or any other mid-scenario map switching, stuff like that.
josteph wrote:
September 1st, 2019, 5:33 pm
I don't understand what the proposed key would do. Would it just mean "expire duration=scenario objects when putting units to the recall list"? If so, maybe the API should take the duration to expire as a string? (expire_objects_by_duration=scenario, for example)
As long as it's a comma separated list for scenario,turn cases, I think that sounds good. Maybe you don't need the "by_duration"? So the key is just: expire_objects=: a comma separated list of forever,scenario,turn (I don't remember if there's anything else) duration objects to expire upon putting the unit back to the recall list.
Or maybe you should be creating the objects with duration=until_putting_to_recall_list in the first place? (that's not an already-existing duration value, it'd have to be implemented)
If I understood correctly, than I don't think that's a good idea. The object can't know if it'll be but in a situation where it will have to expire when the unit is put on the recall list. If you specify this duration, it could create a problem like in Ravana's post, that what if you just use the put_to_recall_list in a regular mid-scenario case, and the unit can still be recalled in the same scenario? Then the object expired too soon.
That's why the object would have duration=scenario, to work like it does now, and the situational put_to_recall_list could make it expire if needed.
Author of the Underness Series, consisting of V parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
Standalone works: The Ravagers - now for 1.14, with new bugs!

User avatar
josteph
Developer
Posts: 678
Joined: August 19th, 2017, 6:58 pm

Re: [engine] Enhancement to [put_to_recall_list]: refresh objects

Post by josteph » September 1st, 2019, 6:25 pm

About expire_objects_by_duration, I didn't mean propose that as literally the key name to use. Something shorter or entirely different would be fine by me. Agree about a comma separated list, I thought so too but didn't want to complicate the example.

About "The object can't know if it'll be but in a situation where it will have to expire when the unit is put on the recall list.", no, the object definition doesn't know its use, but the scenario author does... so maybe the macro that defines the object could take the duration as an argument - maybe even an optional argument defaulting to forever - and in scenarios such as yours, the scenario author would specify the duration as scenario or until_recall when calling the macro.

User avatar
WhiteWolf
Forum Regular
Posts: 543
Joined: September 22nd, 2009, 7:48 pm
Location: Hungary

Re: [engine] Enhancement to [put_to_recall_list]: refresh objects

Post by WhiteWolf » September 1st, 2019, 6:40 pm

I'm afraid I still don't entirely understand. Here's how I see it:
#Example 1: use/implement the duration=until_recall in the object, and not the expire_object in put_to_recall_list.

Code: Select all

[event]
    name=whatever, give to units during the scenario
    [object]
	duration=until_recall
        ...stuff
    [/object]
[/event]
Then the object will expire if:
  • The scenario is ended, and Wesnoth returns the unit to the recall list
  • Whenever [put_to_recall_list] is called, no matter what.
#Example 2: use/implement the expire_object in put_to_recall_list.

Code: Select all

[event]
    name=whatever, give to units during the scenario
    [object]
	duration=scenario
        ...stuff
    [/object]
[/event]
Then the object will expire if:
  • The scenario is ended, and Wesnoth returns the unit to the recall list
  • Whenever [put_to_recall_list] is called, but only with expire_object=scenario enabled.
There's the difference, for me in favor of example 2, that the object is not unconditionally expired if put_to_recall_list is used. Let's stick to the weapon special example, the object is that the unit loses 10% max HP with each strike. For example. And it is supposed to expire on scenario end, that's what the coder wants to achieve.
And then there are scenes like in the above post example, and units are put back to the recall list with the tag, and not by Wesnoth at the end of the scenario. Then, these object should also expire.
But, let's say there's another weapon special that if it hits the enemy it is put back on its side's recall list :D (I just made this up but it sounds like a weapon special worth experimenting with...).
Anyway, the point is, if the object is defined with duration=until_recall, then it will also expire in this case, which is something we don't want.
However, expire_objects can handle it, the object is defined with duration=scenario, and in the end-scene case it's called with expire_object=scenario, and in the put back to recall list-effect weapon special case it's called without it, and doesn't affect objects.
Author of the Underness Series, consisting of V parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
Standalone works: The Ravagers - now for 1.14, with new bugs!

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

Re: [engine] Enhancement to [put_to_recall_list]: refresh objects

Post by beetlenaut » September 1st, 2019, 6:43 pm

If we do end up adding the ability to expire objects, it should be flexible: You shouldn't be required to move a unit to the recall list to use it, or know when the object is created that you will need it. It seems to me that it would make the most sense as an available tag in modify_unit. (It could certainly be added to other tags like put_to_recall_list as well, but it should start in a more accessible place.)
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide

User avatar
octalot
Developer
Posts: 375
Joined: July 17th, 2010, 7:40 pm

Re: [engine] Enhancement to [put_to_recall_list]: refresh objects

Post by octalot » September 1st, 2019, 7:17 pm

Why don't we just change the engine to expire objects for units on the recall list just as it does for units on the map?

gfgtdf
Developer
Posts: 1167
Joined: February 10th, 2013, 2:25 pm

Re: [engine] Enhancement to [put_to_recall_list]: refresh objects

Post by gfgtdf » September 1st, 2019, 7:49 pm

octalot wrote:
September 1st, 2019, 7:17 pm
Why don't we just change the engine to expire objects for units on the recall list just as it does for units on the map?
yes that's what i'd have suggested aswell.
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.

User avatar
WhiteWolf
Forum Regular
Posts: 543
Joined: September 22nd, 2009, 7:48 pm
Location: Hungary

Re: [engine] Enhancement to [put_to_recall_list]: refresh objects

Post by WhiteWolf » September 2nd, 2019, 5:22 pm

That'd be another great solution :) I don't know which would be easier to implement.
Author of the Underness Series, consisting of V parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
Standalone works: The Ravagers - now for 1.14, with new bugs!

gfgtdf
Developer
Posts: 1167
Joined: February 10th, 2013, 2:25 pm

Re: [engine] Enhancement to [put_to_recall_list]: refresh objects

Post by gfgtdf » September 2nd, 2019, 6:12 pm

both are easy to implement but my current plan is to do what octalot suggested.

Note that 1.14 already has a `remove_modification` function so you can probably just use
u:remove_modifications({ duration = "scenario" }) before putting the unit u to the recall list.
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.

gfgtdf
Developer
Posts: 1167
Joined: February 10th, 2013, 2:25 pm

Re: [engine] Enhancement to [put_to_recall_list]: refresh objects

Post by gfgtdf » September 3rd, 2019, 12:08 am

so i'm currently wondering, shoduil the engine only expire these objects or should the unit on the recall list also be healed like the units on the map?
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.

User avatar
WhiteWolf
Forum Regular
Posts: 543
Joined: September 22nd, 2009, 7:48 pm
Location: Hungary

Re: [engine] Enhancement to [put_to_recall_list]: refresh objects

Post by WhiteWolf » September 4th, 2019, 6:32 pm

I think it makes sense, yes. It basically means, that your recall list gets the same "treatment" at the end of the scenario that your units on the battlefield get. To which I'd say it's fair.
Author of the Underness Series, consisting of V parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
Standalone works: The Ravagers - now for 1.14, with new bugs!

Post Reply