Jump to content
theocrowley24

Need help with a XP system...

Recommended Posts

I'm a complete noob when it comes to Arma 3 scripting and am in the process of attempting to learn it. I want to make a basic multiplayer PvP mission, one of the basic features is a Leveling system where you earn a certain amount of XP when you kill an enemy player. I'd guess that I need to have a variable holding the players xp and have some code on each player slot with an event handler which adds 100xp to the xp variable when they are killed. However I have no clue whatsoever on how this would look like in the Arma 3 programming language.

 

Any help is very much appreciated!

Share this post


Link to post
Share on other sites

First Bookmark this:  https://community.bistudio.com/wiki/Category:Scripting_Commands_Arma_3  Heck, make it your home page.

 

Second, ignore MP for now and learn things in the editor first.

 

Third, look into getVariable and setVariable and addEventHandler commands.  Get those working with AI in the editor first, then delve into the bubbling acid pit that is multiplayer scripting.

  • Like 3

Share this post


Link to post
Share on other sites

There is a little example mission in this post that could help.

  • Like 1

Share this post


Link to post
Share on other sites

There is a little example mission in this post that could help.

 

At first I was tempted to complain that a 10MB demo mission is a bit extreme.. then I listed to actionTheme and realized how wrong I was.  That's not extreme.. it's eXtreme!!  

 

(lots of good stuff in that mission, thanks for sharing!)

Share this post


Link to post
Share on other sites

im using this, youll have to change it  bit to be used for pvp, ie killing people on th same team.....

 

init.sqf

killcounter = 0

and the main script...

 

killcounter.sqf

if (isDedicated) exitWith {};
while {true} do {
    {
        if (!(_x getVariable ["isTreated", false])) then {
            _x setVariable ["side", side _x];
            _x addEventHandler ["Killed", {
                params ["_killed", "_killer"];
                _sideKilled = _killed getVariable "side";
                _sideKiller = playerSide;
                if (_sideKilled == _sidekiller) then {   
                player globalChat "Friendly Fire!";
                    killcount = 0;
                } else {
                    killcount = killcount + 1;
                };
            }];
            _x setVariable ["isTreated", true];
        };
    } forEach allUnits;
};

Share this post


Link to post
Share on other sites

 

im using this, youll have to change it  bit to be used for pvp, ie killing people on th same team.....

 

init.sqf

killcounter = 0

and the main script...

 

killcounter.sqf

if (isDedicated) exitWith {};
while {true} do {
    {
        if (!(_x getVariable ["isTreated", false])) then {
            _x setVariable ["side", side _x];
            _x addEventHandler ["Killed", {
                params ["_killed", "_killer"];
                _sideKilled = _killed getVariable "side";
                _sideKiller = playerSide;
                if (_sideKilled == _sidekiller) then {   
                player globalChat "Friendly Fire!";
                    killcount = 0;
                } else {
                    killcount = killcount + 1;
                };
            }];
            _x setVariable ["isTreated", true];
        };
    } forEach allUnits;
};

Oh this will helps loads cheers!

Share this post


Link to post
Share on other sites

Oh this will helps loads cheers!

 

updated it a bit more, should work better.

if (isDedicated) exitWith {};
while {true} do {
    {
        if (!(_x getVariable ["isTreated", false])) then {
            _x setVariable ["side", side _x];
            _x addEventHandler ["Killed", {
                params ["_killed", "_killer"];
                _sideKilled = _killed getVariable "side";
                _sideKiller = playerSide;
				if ((_sideKilled == _sidekiller) && (alive player)) then {   
                player globalChat "Friendly Fire!";
					killcount = 0
                };
				if ((_sideKilled == _sidekiller) && (!alive player)) then {   
                player globalChat "R.I.P";
                    killcount = 0;
                }else{ 
                    killcount = killcount + 1;
                };
            }];
            _x setVariable ["isTreated", true];
        };
    } forEach allUnits;
};

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×