[RELASE/SCRIPT] Quick Change Class.

08/30/2023 23:41 yosiemelo#1
hey,
I was playing with the scripts a bit as always and I decided to share with you a script to change the character class with one click.
it can be helpful for new developers who want to quickly test classes, but it can also help existing developers learn lua, I used a lot of good techniques and tried to keep the code very clean. (NOT LIKE GALALAB.)

So draw conclusions from this, if you want I can post such scripts more often.
If even one person learns something from this, it was worth releasing.

Greetings to all of you, (except for those trash who DDOS better servers, fuck you)



Code:
function job()
    dlg_title("@263603")
    dlg_text("@91002369")
    dlg_menu('@1338',  'Job_menu_1("Gaia")' )
    dlg_menu("@1355", 'Job_menu_1("Deva")' )
    dlg_menu("@1371", 'Job_menu_1("Asura")' )
    dlg_menu("@90010002", "")
    dlg_show()
end


function Job_menu_1(race)
dlg_title("@263603")
dlg_text("@91002409")

local class = {
    Gaia = {120,121,122,123,124},
    Deva = {220,221,222,223,224},
    Asura = {320,321,322,323,324}
}

local function display_jobs(race)
    for _, job in pairs(class[race]) do
        dlg_menu("@".. 10000 + job , "job1("..job..")")
    end
end

display_jobs(race)

dlg_menu("@90010003", "job()")
dlg_menu("@90010002", "")
dlg_show()
end



function job1(_job)
local classes = {}
classes[320] = {301,310,320}	--Slayer
classes[321] = {301,311,321}	--Deadeye
classes[322] = {302,312,322}	--Voidmage
classes[323] = {302,313,323}	--Corruptor
classes[324] = {303,314,324}	--Overlord

classes[120] = {101,110,120}	--Berserker
classes[121] = {101,111,121}	--Marksman
classes[122] = {102,112,122}	--Druid
classes[123] = {102,113,123}	--War Kahuna
classes[124] = {103,114,124}	--Beast Master

classes[220] = {201,210,220}	--Templar
classes[221] = {201,211,221}	--Mercenary
classes[222] = {202,212,222}	--Cardinal
classes[223] = {202,213,223}	--Oracle
classes[224] = {203,214,224}	--Master Breeder

local function change_class(class)
    local classNumbers = classes[class]
    if classNumbers then
        for _, job in ipairs(classNumbers) do
            learn_all_skill()
            Run_JobChange_common("@"..10000 + job, job)
        end
    else
        private_notice("Invalid class number: " .. tostring(class))
    end
end

reset_skilltree(0)
reset_job(0)
learn_all_skill()

change_class(_job)

sv("lv", 164)
--sv("free_statpoints", 3000)
end
08/30/2023 23:44 yosiemelo#2
PS:

I know that the naming of variables is not at a high level here, but that's because I didn't know how I wanted to write it at the beginning haha
08/30/2023 23:48 Sh4doxie#3
Such a good release, keep goin! :yes: