ActionWML to remove [object]s

Discussion among members of the development team.

Moderators: Forum Moderators, Developers

ActionWML to remove [object]s

Postby AI » August 4th, 2013, 1:03 am

With [object]'s new 'turn' duration, along with the renamed 'scenario' duration (freeing up 'level' for objects to be removed on levelup somewhere in the future), direct modifications to units are less and less needed. If an object needs to be removed at a different time though, only option other than adding an extra object to cancel the effect of the first, is hand-hacking the stored unit to remove the object and then either using [transform_unit] to rebuild it or manually correcting for the object's [effect]s.
The [remove_object] tag in 8680's lua pack uses the second method.

I'd like to implement the tag in C++ using the first method, but there's the issue of identifying an object. The lua pack version uses [filter_wml] or [filter_effect] to identify the object (example), but that's not the prettiest solution. I'd like to filter for [object]id, but that brings up another issue.

The 'id' key is already in use to ensure an object is only picked up once (example in THoT). This makes it unusable for objects that may be given to multiple units, unless you start working the unit's ID in there or something.

The possibility of an 'allow_multiple' key or the like was suggested, but I'd prefer to just get rid of that feature, possibly along with its [then] tag.
AI
Developer
 
Posts: 2398
Joined: January 31st, 2008, 8:38 pm

Re: ActionWML to remove [object]s

Postby AI » August 5th, 2013, 11:32 pm

Several people have suggested just adding extra keys to the [object] to filter on, as the entire tag is thrown into [modifications].
Another point is that [object] originated as the functional part behind an [item], but is now used far more as a vehicle for [effect]s added in other ways. It could make sense to move this functionality to a different tag. Pyrophorus suggested a [change] tag, to be added and removed with [add_change] and [remove_change].
AI
Developer
 
Posts: 2398
Joined: January 31st, 2008, 8:38 pm

Re: ActionWML to remove [object]s

Postby 8680 » August 6th, 2013, 7:20 pm

AI wrote:[…] hand-hacking the stored unit to remove the object and then either using [transform_unit] to rebuild it or manually correcting for the object's [effect]s.

I will note that both methods have their limitations — the first would discard any direct modifications made to the unit (acceptable in some use cases, but rendering it useless in others), and the second apparently cannot remove new_ability [effect]s (though this may well be merely the fault of my mess of an implementation). To cover all use cases, it may thus be necessary or desirable to make both methods available, via an attribute or via separate tags (of which the former seems to me preferable).

AI wrote:It could make sense to move this functionality to a different tag. Pyrophorus suggested a [change] tag, to be added and removed with [add_change] and [remove_change].

I would support that. If name suggestions are welcome, I would suggest [modification], for consistency — length, at least, does not appear to me to be a concern in the naming of WML tags.
User avatar
8680
Moderator Emeritus
 
Posts: 745
Joined: March 20th, 2011, 11:45 pm

Re: ActionWML to remove [object]s

Postby Pentarctagon » August 7th, 2013, 12:51 am

Another name suggestion: [unit_change]/[add_unit_change]/[remove_unit_change], which would make it much more obvious what the tags change.
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
Pentarctagon
Forum Administrator
 
Posts: 2793
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: ActionWML to remove [object]s

Postby bumbadadabum » August 7th, 2013, 10:08 am

Pentarctagon wrote:Another name suggestion: [unit_change]/[add_unit_change]/[remove_unit_change], which would make it much more obvious what the tags change.


This is a thing indeed, but I'm still in favor of [modification]. I think it makes it clear enough what it does, and it sounds better in my opinion. Well, no matter what it's called, it'd be good to have a tag like this.
User avatar
bumbadadabum
Developer
 
Posts: 1004
Joined: March 20th, 2008, 5:54 pm
Location: Netherlands

Re: ActionWML to remove [object]s

Postby AI » August 7th, 2013, 2:00 pm

A phone is not the ideal device to write this with, so here's a short summary of my current plan:
A [modification] tag that contains [effect]s along with a duration key and any other keys (for filtering purposes). These will go verbatim into [unit][modifications].
[object] will retain its [filter], [then], id key, cannot_use_message and everything else related to picking up items. The rest will become the new [modification] subtag.

I'm not sure what the removal tag should look like yet, and I just realized [modification] might be confused with MP modifications by automated tools. I'll also have to look into the new_ability removal failing.
AI
Developer
 
Posts: 2398
Joined: January 31st, 2008, 8:38 pm

Re: ActionWML to remove [object]s

Postby bumbadadabum » August 7th, 2013, 2:08 pm

AI wrote:I'm not sure what the removal tag should look like yet, and I just realized [modification] might be confused with MP modifications by automated tools.


The solution would be to make it [add_modification] and [remove_modification], although I don't know how that would look like inside [object].
User avatar
bumbadadabum
Developer
 
Posts: 1004
Joined: March 20th, 2008, 5:54 pm
Location: Netherlands

Re: ActionWML to remove [object]s

Postby vultraz » August 7th, 2013, 2:24 pm

I agree with bumba about the [add_modification] tag name, but I'm wondering, why make it retain [effect] instead of allowing it to directly access the code under [effect], but with it's own duration= and id= keys. That would prevent another layer of WML, and would effectively be a rename and expansion of the [effect] tag. Eg:

Code: Select all
[add_modification]
    id=foo
    duration=turn
    apply_to=new_ability
    [abilities]
        {ABILITY_REGENERATES}
    [/abilities]
[/add_modification]


And in regards to [object], if you're going to keep it as an interface for picking up items, should not it have a built-in way to decide whether to pick up or decline to pick up the object without UMC authors having to use [message][option]?

Something like this:
Attachments
itempickupdialog.png
itempickupdialog.png (96.68 KiB) Viewed 6621 times
Creator of Shadows of Deception (for 1.12) and co-creator of the Era of Chaos (for 1.12/1.13).
SurvivalXtreme rocks!!!
What happens when you get scared half to death...twice?
User avatar
vultraz
Community Manager
 
Posts: 809
Joined: February 7th, 2011, 12:51 pm
Location: Dodging Daleks

Re: ActionWML to remove [object]s

Postby bumbadadabum » August 7th, 2013, 2:49 pm

vultraz wrote:And in regards to [object], if you're going to keep it as an interface for picking up items, should not it have a built-in way to decide whether to pick up or decline to pick up the object without UMC authors having to use [message][option]?


I second this, although I do think there should still be some flexibility, and the option to make 'accepting' the object mandatory should still exist.
User avatar
bumbadadabum
Developer
 
Posts: 1004
Joined: March 20th, 2008, 5:54 pm
Location: Netherlands

Re: ActionWML to remove [object]s

Postby AI » August 7th, 2013, 3:47 pm

The reason for retaining [effect] is grouping things together.

bumbadadabum wrote:
vultraz wrote:And in regards to [object], if you're going to keep it as an interface for picking up items, should not it have a built-in way to decide whether to pick up or decline to pick up the object without UMC authors having to use [message][option]?


I second this, although I do think there should still be some flexibility, and the option to make 'accepting' the object mandatory should still exist.

That was an additional plan, but even less defined and I ran out of time to type it out.
AI
Developer
 
Posts: 2398
Joined: January 31st, 2008, 8:38 pm

Re: ActionWML to remove [object]s

Postby Celtic_Minstrel » October 1st, 2016, 2:35 am

So, three years later, there is now a [remove_object] tag in 1.13 which uses the duration expiry mechanism to remove an object that matches a WML filter (as with [filter_wml]).
Author of The Black Cross of Aleron campaign and Default++ era.
Maintainer of Steelhive.
User avatar
Celtic_Minstrel
Developer
 
Posts: 694
Joined: August 3rd, 2012, 11:26 pm

Re: ActionWML to remove [object]s

Postby beetlenaut » October 3rd, 2016, 1:46 am

Very nice! I have wished this tag existed before.
Campaigns: Dead Water
The Founding of Borstep
Secrets of the Ancients
User avatar
beetlenaut
Developer
 
Posts: 2039
Joined: December 8th, 2007, 3:21 am
Location: Oaxaca, Mexico


Return to Developers’ Discussions

Who is online

Users browsing this forum: No registered users and 1 guest