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 

download the files from Files - up to date

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 description.ext add this into line 24

Spoiler

#include "dialog\Experience_bar.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_experience`  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

 

download the files that are up to date on git hub

Files - up to date

 

 

Edited by Medusa
github link added
  • Like 3
Link to comment
Share on other sites

  • 4 weeks later...
  • 5 months later...
On 12/17/2022 at 2:11 PM, CrazyCowboy8565 said:

I am getting the following error https://imgur.com/a/6HbFPP7

There is no file called this in the files I have been given.

@Medusa

I would make sure that you installed everything correctly specifically on the mission side with the dialog. If everything is installed correctly I will take a try to do a fresh install on my side.  The only thing that could possibly use that file is button for the y menu, maybe try removing that and trying again.

Link to comment
Share on other sites

  • 1 month later...
On 2/18/2023 at 5:31 AM, RavenRAMIREZ said:

Good morning;
I allow myself to contact you because your script: https://www.altisliferpg.com/topic/13832-experience-system-v2/
does contain your zip, however the file CustomControlClasses.hpp is missing in the file: experience_v2.zip\exp\Missionfolder\dialog can you put it?
Thank you.

Im sorry for some reason I am not able to update the files to fix the possible error, I haven't been able to test it but I believe the error is this. in the exp download there are 2 files, Experience_bar.hpp and experienceMenu.hpp these need to be moved to the dialog folder in the root of the mission folder. Sorry about this and ill put this in the main post as well 

Link to comment
Share on other sites

17 hours ago, NIGO said:

I'm not sure if I'm doing anything wrong, but the level and exp or all of the data is not saved to the database at all.

few things that you will wanna check do you have the Medusa_Handler.hpp being called in your cfgRemoteExec.hpp, if so then make sure you have your server files in order IE make sure that in your config.cpp functions are being declared and your DB is loaded up correctly. if your still having issues feel free to add me on steam and I can talk to you directly. https://steamcommunity.com/id/meanpark

Link to comment
Share on other sites

  • 1 month later...
On 04/03/2023 at 04:31, Medusa said:

algumas coisas que você vai querer verificar se você tem o Medusa_Handler.hpp sendo chamado em seu cfgRemoteExec.hpp, se sim, certifique-se de ter seus arquivos de servidor em ordem, ou seja, certifique-se de que em suas funções config.cpp estão sendo declaradas e seu banco de dados está carregado corretamente. se ainda tiver problemas, sinta-se à vontade para me adicionar no Steam e posso falar diretamente com você. https://steamcommunity.com/id/meanpark

hi i have same problme missing dialog\CustomControlClasses.hpp not found i dont understand how to fix that

Link to comment
Share on other sites

16 hours ago, Puma Power.PT said:

hi i have same problme missing dialog\CustomControlClasses.hpp not found i dont understand how to fix that

You can create a new file called CustomControlClasses.hpp and enter this and save it. 

 

#ifndef HG_CustomControlClassesh
#define HG_CustomControlClassesh 1
//Create a header guard to prevent duplicate include.

#endif

 

Link to comment
Share on other sites

2 minutes ago, Drunken Cheetah said:

You can create a new file called CustomControlClasses.hpp and enter this and save it. 

 

#ifndef HG_CustomControlClassesh
#define HG_CustomControlClassesh 1
//Create a header guard to prevent duplicate include.

#endif

 

already make that ,and i rename  the folder in life server  is wrong and the 3 files inside too

rename the experince too experience,

but continou not working broken Y menu and actions win button

Link to comment
Share on other sites

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.