uen / Leveling-System

Leveling system in gLua (For DarkRP)
Other
35 stars 22 forks source link

How to enable Dynamic XP gain? #71

Closed Stanstar22 closed 6 years ago

Stanstar22 commented 7 years ago

I can't figure out how to set dynamic XP gain, with all sorts of settings changed on my config, it still does not work. (Yes I am setting my level to 1 then killing a level 100 to test it).

Here's my config:

/////////////////////////
// Configuration file  //
/////////////////////////

LevelSystemConfiguration = {} // Ignore
Printers = {} // Ignore

LevelSystemConfiguration.EnableHUD = true // Is the HUD enabled?
LevelSystemConfiguration.LevelColor = Color(255,255,255,255) // The color of the "Level: 1" HUD element. White looks best. (This setting is nullified if you have the prestige system)
LevelSystemConfiguration.XPTextColor = Color(255,255,255,255) // The color of the XP percentage HUD element.
LevelSystemConfiguration.LevelBarColor = {6,116,255} // The color of the XP bar. (Sorry this one is different. It is still {R,G,B})
LevelSystemConfiguration.LevelTextPos = {1.5, 180.0} // The position of the LevelText. Y starts from bottom. Fiddle with it
LevelSystemConfiguration.DisplayLevel = true // Show player levels when you look at them

LevelSystemConfiguration.GreenJobBars = true // Are the green bars at the bottom of jobs enabled? KEEP THIS TRUE!
LevelSystemConfiguration.GreenAllBars = true // Are the green bars at the bottom of everything but jobs enabled? Recommended(true)

LevelSystemConfiguration.KillModule = true // Give XP + Money for kills! // Next 2 settings control this.
LevelSystemConfiguration.Friendly = false // Only take away money / give XP if the killer is a lower level/same level than the victim. (Recommended:true)
LevelSystemConfiguration.TakeAwayMoneyAmount = 0 // How much money to take away from players when they are killed and add to the killer. You can change this to 0 if none. The XP amount is dynamic.

LevelSystemConfiguration.NPCXP = true // Give XP when an NPC is killed?
LevelSystemConfiguration.NPCXPAmount = 10 // Amount of XP to give when an NPC is killed

LevelSystemConfiguration.TimerModule = true // Give XP to everybody every howeverlong
LevelSystemConfiguration.Timertime = 100 // How much time (in seconds) until everybody gets given XP
LevelSystemConfiguration.TimerXPAmount = 100 // How much XP to give each time it goes off
LevelSystemConfiguration.YourServerName = "on the server" // The notifcation text ish. "You got 100XP for playing on the server."

LevelSystemConfiguration.XPMult = 1.5 // How hard it is to level up. 2 would require twice as much XP, ect.
LevelSystemConfiguration.MaxLevel = 150 // The max level
LevelSystemConfiguration.ContinueXP = false // If remaining XP continues over to next levels. I recommend this to be false. Seriously. What if a level 1 gets 99999999 XP somehow? He is level 99 so quickly.

//Printer settings
LevelSystemConfiguration.PrinterSound = true // Give the printers sounds?
LevelSystemConfiguration.PrinterMaxP = 4 // How many times a printer can print before stopping. Change this to 0 if you want infine.
LevelSystemConfiguration.PrinterMax = 4 // How many printers of a certain type a player can own at any one time
LevelSystemConfiguration.PrinterOverheat = false // Can printers overheat?
LevelSystemConfiguration.PrinterTime = 120 // How long it takes printers to print
LevelSystemConfiguration.KeepThisToTrue = true // Can players collect from printers that are 5 levels above their level? (Recommended: false)
LevelSystemConfiguration.Epilepsy = true // If printers flash different colors when they have money in them.

/*Template Code/*
local Printer= {} // Leave this line
Printer.Name = 'Your Printer Name'
Printer.Type = 'yourprintername' // A UNIQUE identifier STRING, can be anything. NO SPACES! The player does not see this.
Printer.Category = 'printers' // The category of the printer (See http://wiki.darkrp.com/index.php/DarkRP:Categories)
Printer.XPPerPrint = 10 // How much XP to give a player every time they print.
Printer.MoneyPerPrint = 50 // How much money to give a player every time they print.
Printer.Color = Color(255,255,255,255) // The color of the printer. Setting it to (255,255,255,255) will make it the normal prop color.
Printer.Model = 'models/props_lab/reciever01b.mdl' // The model of the printer. To find the path of a model, right click it in the spawn menu and click "Copy to Clipboard"
Printer.Prestige = 0 // The prestige you have to be to buy the printer. Only works with the prestige DLC.
Printer.Allowed = {} // Same as DarkRP .allowed
table.insert(Printers,Printer) // Leave this line
*/

// Default printers:

// Ignore everything under this line.

hook.Add("loadCustomDarkRPItems", "manolis:MVLevels:CustomLoad", function()

    for k,v in pairs(Printers) do
        local Errors = {}
        if not type(v.Name) == 'string' then table.insert(Errors, 'The name of a printer is INVALID!') end
        if not type(v.Type) == 'string' then table.insert(Errors, 'The type of a printer is INVALID!') end
        if not type(v.XPPerPrint) == 'number' then table.insert(Errors, 'The XP of a printer is INVALID!') end
        if not type(v.MoneyPerPrint) == 'number' then table.insert(Errors, 'The money of a printer is INVALID!') end
        if not type(v.Color) == 'table' then table.insert(Errors, 'The color of a printer is INVALID!') end
        if not type(v.Model) == 'string' then table.insert(Errors, 'The model of a printer is INVALID!') end
        if not type(v.Price) == 'number' then table.insert(Errors, 'The price of a printer is INVALID!') end
        if not type(v.Category) == 'string' then v.Category='' end
        if not type(v.Level) == 'number' then table.insert(Errors, 'The level of a printer is INVALID!') end
        local ErrorCount = 0
        for k,v in pairs(Errors) do
            error(v)
            ErrorCount = ErrorCount + 1
        end

        if not(ErrorCount==0) then return false end

        local t = {
            ent = "vrondakis_printer",
            model = v.Model,
            category = v.Category,
            price = v.Price,
            prestige = (v.Prestige or 0),
            printer = true,
            level = v.Level,
            max = LevelSystemConfiguration.PrinterMax,
            cmd = 'buyvrondakis'..v.Type..'printer',
            allowed = v.Allowed,
            vrondakisName = v.Name,
            vrondakisType = v.Type,
            vrondakisXPPerPrint = v.XPPerPrint,
            vrondakisMoneyPerPrint = v.MoneyPerPrint,
            vrondakisColor = v.Color,
            vrondakisModel = v.Model,
            customCheck = (v.CustomCheck or function() return true end),
            vrondakisOverheat = LevelSystemConfiguration.PrinterOverheat,
            PrinterMaxP = LevelSystemConfiguration.PrinterMaxP,
            vrondakisPrinterTime = LevelSystemConfiguration.PrinterTime,
            vrondakisIsBuyerRetarded = LevelSystemConfiguration.KeepThisToTrue,
            vrondakisEpileptic = LevelSystemConfiguration.Epilepsy
        }

        if(v.DParams) then
            for k,v in pairs(v.DParams) do
                t[k] = v    
            end
        end

        DarkRP.createEntity(v.Name,t)

    end

end)

DarkRP.registerDarkRPVar("xp", net.WriteDouble, net.ReadDouble)
DarkRP.registerDarkRPVar("level", net.WriteDouble, net.ReadDouble)
DarkRP.registerDarkRPVar("prestige", net.WriteDouble, net.ReadDouble)
uen commented 7 years ago

Maybe only show what you changed instead of your entire config file

On 29 Sep 2017 05:19, "Stanstar22" notifications@github.com wrote:

I can't figure out how to set dynamic XP gain, with all sorts of settings changed on my config, it still does not work. (Yes I am setting my level to 1 then killing a level 100 to test it).

Here's my config: `///////////////////////// // Configuration file // /////////////////////////

LevelSystemConfiguration = {} // Ignore Printers = {} // Ignore

LevelSystemConfiguration.EnableHUD = true // Is the HUD enabled? LevelSystemConfiguration.LevelColor = Color(255,255,255,255) // The color of the "Level: 1" HUD element. White looks best. (This setting is nullified if you have the prestige system) LevelSystemConfiguration.XPTextColor = Color(255,255,255,255) // The color of the XP percentage HUD element. LevelSystemConfiguration.LevelBarColor = {6,116,255} // The color of the XP bar. (Sorry this one is different. It is still {R,G,B}) LevelSystemConfiguration.LevelTextPos = {1.5, 180.0} // The position of the LevelText. Y starts from bottom. Fiddle with it LevelSystemConfiguration.DisplayLevel = true // Show player levels when you look at them

LevelSystemConfiguration.GreenJobBars = true // Are the green bars at the bottom of jobs enabled? KEEP THIS TRUE! LevelSystemConfiguration.GreenAllBars = true // Are the green bars at the bottom of everything but jobs enabled? Recommended(true)

LevelSystemConfiguration.KillModule = true // Give XP + Money for kills! // Next 2 settings control this. LevelSystemConfiguration.Friendly = false // Only take away money / give XP if the killer is a lower level/same level than the victim. (Recommended:true) LevelSystemConfiguration.TakeAwayMoneyAmount = 0 // How much money to take away from players when they are killed and add to the killer. You can change this to 0 if none. The XP amount is dynamic.

LevelSystemConfiguration.NPCXP = true // Give XP when an NPC is killed? LevelSystemConfiguration.NPCXPAmount = 10 // Amount of XP to give when an NPC is killed

LevelSystemConfiguration.TimerModule = true // Give XP to everybody every howeverlong LevelSystemConfiguration.Timertime = 100 // How much time (in seconds) until everybody gets given XP LevelSystemConfiguration.TimerXPAmount = 100 // How much XP to give each time it goes off LevelSystemConfiguration.YourServerName = "on the server" // The notifcation text ish. "You got 100XP for playing on the server."

LevelSystemConfiguration.XPMult = 1.5 // How hard it is to level up. 2 would require twice as much XP, ect. LevelSystemConfiguration.MaxLevel = 150 // The max level LevelSystemConfiguration.ContinueXP = false // If remaining XP continues over to next levels. I recommend this to be false. Seriously. What if a level 1 gets 99999999 XP somehow? He is level 99 so quickly.

//Printer settings LevelSystemConfiguration.PrinterSound = true // Give the printers sounds? LevelSystemConfiguration.PrinterMaxP = 4 // How many times a printer can print before stopping. Change this to 0 if you want infine. LevelSystemConfiguration.PrinterMax = 4 // How many printers of a certain type a player can own at any one time LevelSystemConfiguration.PrinterOverheat = false // Can printers overheat? LevelSystemConfiguration.PrinterTime = 120 // How long it takes printers to print LevelSystemConfiguration.KeepThisToTrue = true // Can players collect from printers that are 5 levels above their level? (Recommended: false) LevelSystemConfiguration.Epilepsy = true // If printers flash different colors when they have money in them.

/Template Code/ local Printer= {} // Leave this line Printer.Name = 'Your Printer Name' Printer.Type = 'yourprintername' // A UNIQUE identifier STRING, can be anything. NO SPACES! The player does not see this. Printer.Category = 'printers' // The category of the printer (See http://wiki.darkrp.com/index.php/DarkRP:Categories) Printer.XPPerPrint = 10 // How much XP to give a player every time they print. Printer.MoneyPerPrint = 50 // How much money to give a player every time they print. Printer.Color = Color(255,255,255,255) // The color of the printer. Setting it to (255,255,255,255) will make it the normal prop color. Printer.Model = 'models/props_lab/reciever01b.mdl' // The model of the printer. To find the path of a model, right click it in the spawn menu and click "Copy to Clipboard" Printer.Prestige = 0 // The prestige you have to be to buy the printer. Only works with the prestige DLC. Printer.Allowed = {} // Same as DarkRP .allowed table.insert(Printers,Printer) // Leave this line */

// Default printers:

// Ignore everything under this line.

hook.Add("loadCustomDarkRPItems", "manolis:MVLevels:CustomLoad", function()

for k,v in pairs(Printers) do local Errors = {} if not type(v.Name) == 'string' then table.insert(Errors, 'The name of a printer is INVALID!') end if not type(v.Type) == 'string' then table.insert(Errors, 'The type of a printer is INVALID!') end if not type(v.XPPerPrint) == 'number' then table.insert(Errors, 'The XP of a printer is INVALID!') end if not type(v.MoneyPerPrint) == 'number' then table.insert(Errors, 'The money of a printer is INVALID!') end if not type(v.Color) == 'table' then table.insert(Errors, 'The color of a printer is INVALID!') end if not type(v.Model) == 'string' then table.insert(Errors, 'The model of a printer is INVALID!') end if not type(v.Price) == 'number' then table.insert(Errors, 'The price of a printer is INVALID!') end if not type(v.Category) == 'string' then v.Category='' end if not type(v.Level) == 'number' then table.insert(Errors, 'The level of a printer is INVALID!') end local ErrorCount = 0 for k,v in pairs(Errors) do error(v) ErrorCount = ErrorCount + 1 end

if not(ErrorCount==0) then return false end

local t = { ent = "vrondakis_printer", model = v.Model, category = v.Category, price = v.Price, prestige = (v.Prestige or 0), printer = true, level = v.Level, max = LevelSystemConfiguration.PrinterMax, cmd = 'buyvrondakis'..v.Type..'printer', allowed = v.Allowed, vrondakisName = v.Name, vrondakisType = v.Type, vrondakisXPPerPrint = v.XPPerPrint, vrondakisMoneyPerPrint = v.MoneyPerPrint, vrondakisColor = v.Color, vrondakisModel = v.Model, customCheck = (v.CustomCheck or function() return true end), vrondakisOverheat = LevelSystemConfiguration.PrinterOverheat, PrinterMaxP = LevelSystemConfiguration.PrinterMaxP, vrondakisPrinterTime = LevelSystemConfiguration.PrinterTime, vrondakisIsBuyerRetarded = LevelSystemConfiguration.KeepThisToTrue, vrondakisEpileptic = LevelSystemConfiguration.Epilepsy }

if(v.DParams) then for k,v in pairs(v.DParams) do t[k] = v
end end

DarkRP.createEntity(v.Name,t)

end

end)

DarkRP.registerDarkRPVar("xp", net.WriteDouble, net.ReadDouble) DarkRP.registerDarkRPVar("level", net.WriteDouble, net.ReadDouble) DarkRP.registerDarkRPVar("prestige", net.WriteDouble, net.ReadDouble)`

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/vrondakis/Leveling-System/issues/71, or mute the thread https://github.com/notifications/unsubscribe-auth/ADxNa51gICBXVZqCYoOMK4xcbR-yk2Okks5snG_igaJpZM4PoLoo .

Stanstar22 commented 7 years ago

I've removed the printers since I do not need them and these are the parts that I have changed:

LevelSystemConfiguration.KillModule = true // Give XP + Money for kills! // Next 2 settings control this.
LevelSystemConfiguration.Friendly = false // Only take away money / give XP if the killer is a lower level/same level than the victim. (Recommended:true)
LevelSystemConfiguration.TakeAwayMoneyAmount = 0 // How much money to take away from players when they are killed and add to the killer. You can change this to 0 if none. The XP amount is dynamic.

LevelSystemConfiguration.TimerModule = true // Give XP to everybody every howeverlong
LevelSystemConfiguration.Timertime = 100 // How much time (in seconds) until everybody gets given XP
LevelSystemConfiguration.TimerXPAmount = 100 // How much XP to give each time it goes off
LevelSystemConfiguration.YourServerName = "on the server" // The notifcation text ish. "You got 100XP for playing on the server."

LevelSystemConfiguration.XPMult = 1.5 // How hard it is to level up. 2 would require twice as much XP, ect.
LevelSystemConfiguration.MaxLevel = 150 // The max level
LevelSystemConfiguration.ContinueXP = false // If remaining XP continues over to next levels. I recommend this to be false. Seriously. What if a level 1 gets 99999999 XP somehow? He is level 99 so quickly.
uen commented 7 years ago

What is "dynamic XP gain"

On 29 Sep 2017 15:13, "Stanstar22" notifications@github.com wrote:

I've removed the printers since I do not need them and these are the parts that I have changed:

LevelSystemConfiguration.KillModule = true // Give XP + Money for kills! // Next 2 settings control this. LevelSystemConfiguration.Friendly = false // Only take away money / give XP if the killer is a lower level/same level than the victim. (Recommended:true) LevelSystemConfiguration.TakeAwayMoneyAmount = 0 // How much money to take away from players when they are killed and add to the killer. You can change this to 0 if none. The XP amount is dynamic.

LevelSystemConfiguration.TimerModule = true // Give XP to everybody every howeverlong LevelSystemConfiguration.Timertime = 100 // How much time (in seconds) until everybody gets given XP LevelSystemConfiguration.TimerXPAmount = 100 // How much XP to give each time it goes off LevelSystemConfiguration.YourServerName = "on the server" // The notifcation text ish. "You got 100XP for playing on the server."

LevelSystemConfiguration.XPMult = 1.5 // How hard it is to level up. 2 would require twice as much XP, ect. LevelSystemConfiguration.MaxLevel = 150 // The max level LevelSystemConfiguration.ContinueXP = false // If remaining XP continues over to next levels. I recommend this to be false. Seriously. What if a level 1 gets 99999999 XP somehow? He is level 99 so quickly.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/vrondakis/Leveling-System/issues/71#issuecomment-333137716, or mute the thread https://github.com/notifications/unsubscribe-auth/ADxNa4pTft4Cq1adUCETdUA4faQhZuLAks5snPsMgaJpZM4PoLoo .

Stanstar22 commented 7 years ago

Is it not where if a lower level killed a higher level players, they will get more XP dependant of the level of both users?

uen commented 7 years ago

That already happens by default?

On 29 Sep 2017 16:42, "Stanstar22" notifications@github.com wrote:

Is it not where if a lower level killed a higher level players, they will get more XP dependant of the level of both users?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/vrondakis/Leveling-System/issues/71#issuecomment-333162150, or mute the thread https://github.com/notifications/unsubscribe-auth/ADxNa8QZEZWO3gt_FQUV0Cn1HxNXuALuks5snQ_mgaJpZM4PoLoo .

Stanstar22 commented 7 years ago

Not for me at least, tried it with ULX bots and real players, I set my level to 1 and still only 1000xp per kill not matter on what level we are.

Even with this as true it does not work LevelSystemConfiguration.Friendly = false // Only take away money / give XP if the killer is a lower level/same level than the victim. (Recommended:true)