'kill'= misleading name

The place to post your WML questions and answers.

Moderators: Forum Moderators, Developers

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
User avatar
Simons Mith
Posts: 784
Joined: January 27th, 2005, 10:46 pm
Location: Twickenham
Contact:

'kill'= misleading name

Post by Simons Mith »

An idle observation, if I may:

While kill= is often used to kill units, it's also used for unit modifications (e.g. stopping a fight partway, as in another recent thread). Wouldn't it be less misleading if this ever so commonly-used function was called 'remove' instead? If you save a unit's current state, then 'kill' it, then restore it, then you didn't really 'kill' it in the first place. I appreciate that making such a wide-reaching change is somewhat unlikely, but from a coding viewpoint I definitely would prefer to use 'remove' and 'restore' when that's what I'm doing, and only use 'kill' when I really mean 'kill'. Alternatively, what's the opinion of having aliases for commands, or having a new 'remove' command that 'saves-and-'kills'' while the 'kill' command just 'kills', as now?
 
User avatar
Pentarctagon
Project Manager
Posts: 4500
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: 'kill'= misleading name

Post by Pentarctagon »

personally i like it the way it is now fine, just because the death is 'temporary' doesn't mean that it didn't die.
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
Captain_Wrathbow
Posts: 1664
Joined: June 30th, 2009, 2:03 pm
Location: Guardia

Re: 'kill'= misleading name

Post by Captain_Wrathbow »

I'm afraid I don't see much of a problem with the current way, either.
User avatar
Ken_Oh
Moderator Emeritus
Posts: 2176
Joined: February 6th, 2006, 4:03 am
Location: Baltimore, Maryland, USA

Re: 'kill'= misleading name

Post by Ken_Oh »

I kind of see where you're coming from, but using kill=yes inside store_unit kills it just as much as by any other means (barring firing events and animation). There's no difference between the two scenarios below. Indeed, kill=yes replaces the basic function of [kill].

Code: Select all

# scenario 1

[store_unit]
    variable=unit
    [filter]
        x,y=1,1
    [/filter]
[/store_unit]

[kill]
    x,y=1,1
[/kill]

[unstore_unit]
    variable=unit
[/unstore_unit]


# scenario 2

[store_unit]
    variable=unit
    [filter]
        x,y=1,1
    [/filter]
    kill=yes
[/store_unit]

[unstore_unit]
    variable=unit
[/unstore_unit]
User avatar
Reepurr
Posts: 1088
Joined: August 29th, 2010, 5:38 pm

Re: 'kill'= misleading name

Post by Reepurr »

I don't see a problem with [kill]'s name. The only problem I see with it is that animate=yes doesn't show a death animation, only a fade.
"What do you mean, "a dwarvish dragonguard with marksman is overpowered"?"

Story of a Drake Outcast | The Nonsense Era
Played HttT-Underground Channels? Thought it was rubbish? Help us develop it here!
Anonymissimus
Inactive Developer
Posts: 2460
Joined: August 15th, 2008, 8:46 pm
Location: Germany

Re: 'kill'= misleading name

Post by Anonymissimus »

However, it may be nice to support fire_event=yes|no and animate=yes|no if kill=yes. The name kill makes more sense then since you can actually see the unit die.

@Simons Mith Make the thread title better, I thought of [kill] too at first.

EDIT
https://gna.org/patch/?2031
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml startersPlan Your Advancements: mp mod
The Earth's Gut: sp campaignSettlers of Wesnoth: mp scenarioWesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
User avatar
Captain_Wrathbow
Posts: 1664
Joined: June 30th, 2009, 2:03 pm
Location: Guardia

Re: 'kill'= misleading name

Post by Captain_Wrathbow »

Reepurr wrote:The only problem I see with it is that animate=yes doesn't show a death animation, only a fade.
That's the default death animation when a custom one isn't specified in the unitfile. At this point most units don't have custom death animations, so fading out is the unit's death anim. IIRC, death anims aren't very high priority for the artists right now...
But this is a completely different topic. :?
Tet
Posts: 391
Joined: February 18th, 2009, 5:11 am

Re: 'kill'= misleading name

Post by Tet »

you could add a remove order including no-death animation. it would be allmost similar to kill.
My Temple Project: http://forums.wesnoth.org/viewtopic.php?f=23&t=29800
This is "must-play" campaign! Don´t read the thread, unless you need help. http://forums.wesnoth.org/viewtopic.php?f=8&t=31895
User avatar
bumbadadabum
Developer
Posts: 1005
Joined: March 20th, 2008, 5:54 pm
Location: Netherlands
Contact:

Re: 'kill'= misleading name

Post by bumbadadabum »

Tet wrote:you could add a remove order including no-death animation. it would be allmost similar to kill.
Ahem...

Code: Select all

    [lua]
        code = <<
            local function handler(t)
                wesnoth.fire("kill",
                  { animate = "no", fire_event = t.event })
            end
            wesnoth.register_wml_action("remove", handler)
        >>
    [/lua]
Now you have a [remove] tag.
silene
Posts: 1109
Joined: August 28th, 2004, 10:02 pm

Re: 'kill'= misleading name

Post by silene »

LightFighter wrote:Now you have a [remove] tag.
You have lost a bit of data in the process, so it would probably remove all the units from the map. And by default, there are no death animations, so there is a simpler way to get a [remove] tag:

Code: Select all

wesnoth.register_wml_action("remove", function(cfg) wesnoth.fire("kill", cfg) end)
If you also want to modify [kill] so that it always performs death animation and events, forget the previous code and use instead: (1.8-style syntax)

Code: Select all

local old_kill = wesnoth.register_wml_action("kill", function(cfg)
    local cfg = cfg.__literal
    cfg.animate = true
    cfg.fire_event = true
    old_kill(cfg)
end)
wesnoth.register_wml_action("remove", old_kill)
You will get two tags [remove] and [kill] with clearer names. Just make sure not to put the [lua] tag outside your campaign, or you will break every single scenario out there.
Post Reply