Skip to content

prcScript

Ben Hall edited this page Aug 27, 2019 · 8 revisions

prcScript provides a custom Lua environment to edit files.

example code:

Param.open_dir = "Path/To/Ultimate/Root"
Param.save_dir = "mods" -- can specify absolute or relative paths

local start = clock()

do
    local root = Param:open("fighter/common/param/fighter_param.prc")
    local t = root:by_label("fighter_param_table"):to_table()

    local mods = {
        mario = {
            scale = 2,
            jostle_weight = 0,
        },
        pikachu = {
            scale = 0.1,
            jump_count_max = 3,
            landing_attack_air_frame_n = 1
        }
    }

    local sublen = #"fighter_kind_" + 1
    for _, p in ipairs(t) do
        -- note: requires param labels to be loaded (use '-l ParamLabels.csv')
        local kind = p:by_label("fighter_kind").value
        local name = string.sub(kind, sublen)

        if mods[name] then
            for param_name, value in pairs(mods[name]) do
                p:by_label(param_name).value = value
            end
        end
    end

    Param:save(root) -- saves to "mods/fighter/common/param/fighter_param.prc"
end

print("elapsed: "..clock() - start)
Clone this wiki locally