Update of bug #18695 (project wesnoth):

                 Release:            trunk r51228 => 1.9.9, trunk r51228    

    _______________________________________________________

Follow-up Comment #9:

I can attest to this bug occurring in a similar fashion with Wesnoth 1.9.9;
my custom WML tag [s9_area_spawns] implemented in a specific scenario as
follows becomes invalid after reloading from any turn save/autosave.

stderr:


Invalid WML found: [s9_area_spawns] not supported


The tag implementation:


    [event]
        name=preload
        first_time_only=no

        [lua]
            code = <<
                function spawn_loyal_player_unit(type_id, loc_x, loc_y)
                    -- Inelegant, I know, but put_unit() invokes a code path
                    -- where animate= doesn't have a meaning.
                    wesnoth.fire("unit", {
                        x = loc_x,
                        y = loc_y,
                        side = 1,
                        type = type_id,
                        upkeep = "loyal",
                        animate = true,
                    })
                end

                function wesnoth.wml_actions.s9_area_spawns(cfg)
                    local num_skels = cfg.skeletons or 1
                    local num_ghosts = cfg.ghosts or 1
                    local locs = wesnoth.get_locations(cfg)

                    for i = 1, num_skels do
                        if #locs == 0 then
                            return
                        end
                        local r = safe_random(string.format("1..%d", #locs))
                        local x, y = locs[r][1], locs[r][2]
                        spawn_loyal_player_unit("Skeleton", x, y)
                        table.remove(locs, r)
                    end

                    for i = 1, num_ghosts do
                        if #locs == 0 then
                            return
                        end
                        local r = safe_random(string.format("1..%d", #locs))
                        local x, y = locs[r][1], locs[r][2]
                        spawn_loyal_player_unit("Ghost", x, y)
                        table.remove(locs, r)
                    end
                end
            >>
        [/lua]
    [/event]


An example use case:


        [s9_area_spawns]
            x=34-41
            y=29-31
            [not]
                [filter]
                [/filter]
            [/not]
            [not]
                terrain=Q*,X*,*^X*
            [/not]
            {QUANTITY skeletons 3 2 2}
            {QUANTITY ghosts    1 1 1}
        [/s9_area_spawns]


    _______________________________________________________

Reply to this item at:

  <http://gna.org/bugs/?18695>

_______________________________________________
  Message sent via/by Gna!
  http://gna.org/


_______________________________________________
Wesnoth-bugs mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-bugs

Reply via email to