Jump to content

Experience system v2


Medusa
 Share

Recommended Posts

I wanted to state that I haven't worked on this for a while and I don't think that I will work on this much more unless people ask for it. I will work on bugs if anyone points them out to me but I don't have that much more enthusiasm to work on this anymore. This is a version 2 for the experience system that I put out a while ago and I feel that it is much better that the first one that I put out. The features are: 

A experience and level up system that is saved by the database with experience points, levels and level ups saved to the database. 

A new menu thanks to @Drunken Cheetah 

A new algorithm that allows the server developer to add and remove perks without having to rest the database that is super easy to do! 

set conditions on perks to make things more interesting such you need to be a certain cop level or a certain level to get the perk. 

a small debug addition to make things easier to debug on the developer side.

a new way to give out experience that prevents bugs. 

A cleaner looking database to give developers an easier time

 

Installation: Please back up everything before moving forward!

In mission file 

in Functions.hpp insert 

Spoiler
    class experiencesystem {
        file = "core\custom\experiencesystem";
        class dataexperience {};
        class experienceinit {};
        class firstjoin {};
        class giveexperience {};
        class saveexperience {};
        class experienceReceived {};
        class Experience_menu {};
        class upgrade_experience {};
        class experience_menu_change {};
        class queueexp {};
    };

in init.sqf at line 123 insert 

Spoiler
call life_fnc_experienceinit;

in cfgRemoteExec.hpp on line 19 insert 

Spoiler
#include "core\custom\Medusa_Handler.hpp"

 

in MasterHandler.hpp add this 

Spoiler
#include "experienceMenu.hpp"
#include "Experience_bar.hpp"

in Config_Master.hpp on the bottom add 

Spoiler
#include "Config_Experience.hpp"

and in the cofig file in the main mission directory drop from the downloads Config_Experience.hpp  

optional if you want to have this on your vanilla y menu 

place on line 279 of player_inv.hpp

Spoiler
        class Experience_button: Life_RscButtonMenu {
            idc = 2035;
            text = "Experience Menu";
            onButtonClick = "createDialog ""Experience_Menu"";";
            x = 0.42 + (6.25 / 19.8) + (1 / 250 / (safezoneW / safezoneH));
            y = 0.805;
            w = (6.25 / 40);
            h = (1 / 25);
        }

Drop in Missionfolder from downloads into your mission folder 

 

Server files 

in config.cpp insert 

Spoiler
        class Experience {
            file = "\life_server\Functions\Experience";
            class fetchexperience {};
            class firstexperience {};
            class saveexperienceserver {};  
        }

 and drop in server files from downloads 

 

The last thing you need to do is put in the data base with this code 

Spoiler

CREATE TABLE IF NOT EXISTS `experience` (
    `uid`            INT NOT NULL AUTO_INCREMENT,
    `pid`            VARCHAR(17) NOT NULL,
    `name`           VARCHAR(30) NOT NULL,
    `exp_experince`  INT NOT NULL DEFAULT 0,
    `exp_level`      INT NOT NULL DEFAULT 0,
    `exp_perks`      TEXT NOT NULL,
    `exp_points`     INT NOT NULL DEFAULT 0,
    
    
    PRIMARY KEY (`pid`),
    UNIQUE KEY `unique_uid` (`uid`),
    INDEX `index_name` (`pid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

 

That should be it. Please let me know if you find any bugs! 

 

Helpful commands 

[10, "test"] spawn life_fnc_queueexp; give exp
[] spawn {sleep 2; createDialog "Experience_Menu";} call menu 

Like I said please let me know if you have any bugs I will try to fix them! 

Hope yall enjoy! 

20220613203619_1.jpg

20220613203635_1.jpg

exp.zip

Config_Experience.hpp

Edited by Medusa
mistake
  • Like 2
Link to comment
Share on other sites

  • 4 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.