Files
2026-06-01 12:46:52 +02:00

178 lines
5.1 KiB
Lua

function get_module_name()
return "creature_levelscript"
end
function set_creature_current_level( creaturehandle , level )
current_level = gcv(get_creature_handle(creaturehandle),"level")
if current_level <= level then
if level <= 60 then
set_creature_value(get_creature_handle(creaturehandle),"level", level)
elseif level > 60 and level < 115 and current_level < 60 then
set_creature_value(get_creature_handle(creaturehandle),"level", 60)
creature_evodepth(creaturehandle)
set_creature_value(get_creature_handle(creaturehandle),"level", level)
elseif level > 60 and level < 115 and current_level == 60 then
creature_evodepth(creaturehandle)
set_creature_value(get_creature_handle(creaturehandle),"level", level)
elseif level > 60 and level < 115 and current_level > 60 then
set_creature_value(get_creature_handle(creaturehandle),"level", level)
elseif level > 114 and current_level < 60 then
set_creature_value(get_creature_handle(creaturehandle),"level", 60)
creature_evodepth(creaturehandle)
set_creature_value(get_creature_handle(creaturehandle),"level", 115)
creature_evodepth(creaturehandle)
set_creature_value(get_creature_handle(creaturehandle),"level", level)
elseif level > 114 and current_level == 60 then
creature_evodepth(creaturehandle)
set_creature_value(get_creature_handle(creaturehandle),"level", 115)
creature_evodepth(creaturehandle)
set_creature_value(get_creature_handle(creaturehandle),"level", level)
elseif level > 114 and current_level > 60 and current_level < 115 then
set_creature_value(get_creature_handle(creaturehandle),"level", 115)
creature_evodepth(creaturehandle)
set_creature_value(get_creature_handle(creaturehandle),"level", level)
elseif level > 114 and current_level > 114 then
creature_evodepth(creaturehandle)
set_creature_value(get_creature_handle(creaturehandle),"level", level)
end
else
--cprint("Your creature can not delevel this way!")
end
end
function creature_evodepth(handle)
local creature_evolution_depth, lv, id, temp
creature_evolution_depth = get_creature_value( get_creature_handle(handle), "evolution_depth" )
id = get_creature_value( get_creature_handle(handle), "job" )
lv = get_creature_value( get_creature_handle(handle), "level" )
if creature_evolution_depth == 1 then
set_creature_value(get_creature_handle(handle), "ev_1_ID", id)
set_creature_value(get_creature_handle(handle), "ev_1_level", lv)
elseif creature_evolution_depth == 2 then
set_creature_value(get_creature_handle(handle), "ev_2_ID", id)
set_creature_value(get_creature_handle(handle), "ev_2_level", lv)
else
--temp = "Error:CS1497:" .. handle ..":".. id ..":".. creature_evolution_depth ..":".. lv
--message( temp )
end
creature_evolution(get_creature_handle(handle))
end
--[[
creature_evolution
Parameters: (handle)
Usage: set the next evolution level for a creature with given handle. Returns Returns 1 if succeed.
set_creature_value
Parameters: (handle, type, value)
Usage: sets a value for one of members of StructSummon for specified creature.
Returns nil.
See laso: get_creature_handle() function
1st Slot = 0
2nd slot = 1 etc
]]--
function all_pet_evolution()
player_level = gv("lv")
-- if player_level > 150 then player_level = 150 end -- Lock to 150 max
if get_env("auth.server_idx") == 50 then
player_level = gv("lv")
end
for i = 0, 5 do
handle = 0
handle = get_creature_handle( i )
if handle ~= 0 and handle ~= nil then
set_creature_current_level( i , player_level )
end
end
-- fix_pet_lv()
end
function fix_pet_lv()
--learn_creature_all_skill()
player_level = gv("lv")
for i = 0, 5 do
handle = 0
handle = get_creature_handle( i )
if handle ~= 0 and handle ~= nil then
-- if player_level <= 150 and gcv( handle, "lv" ) <= 150 then
scv( handle, "lv", player_level , gv("name") )
-- end
end
end
end
--[[
creature_evolution
Parameters: (handle)
Usage: set the next evolution level for a creature with given handle. Returns Returns 1 if succeed.
set_creature_value
Parameters: (handle, type, value)
Usage: sets a value for one of members of StructSummon for specified creature.
Returns nil.
See laso: get_creature_handle() function
1st Slot = 0
2nd slot = 1 etc
]]--
function LevelCreature2()
local handle, lv,creature_evolution_depth, id
for i = 0, 5 do
handle = 0
handle = get_creature_handle( i )
-- Check if Evo 1
if get_creature_value( handle , "evolution_depth" ) == 1 then
set_creature_value(handle, "level", 60)
id = get_creature_value( handle, "job" )
set_creature_value(handle, "ev_1_ID", id)
set_creature_value(handle, "ev_1_level", 60)
creature_evolution(handle)
end
-- Check if Evo 2
if get_creature_value( handle , "evolution_depth" ) == 2 then
set_creature_value(handle, "level", 115)
id = get_creature_value( handle, "job" )
set_creature_value(handle, "ev_2_ID", id)
set_creature_value(handle, "ev_2_level", 115)
creature_evolution(handle)
end
end
end