Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- waitUntil {alive player};
- //Define UI ctrls
- #define UIlevel 1000
- #define UIprogress 1001
- #define UIprogressBar 1002
- #define UIcash 1003
- #define UIkills 1004
- player allowDamage true;
- player enableSimulation true;
- (_this select 0) enableStamina false;
- player hideObject false;
- enableSentences false;
- private _proXP = profileNamespace getVariable "pro_experience";
- if (isNil "_proXP") then
- {
- profileNamespace setVariable ["pro_experience", 0];
- _proXP = 0;
- };
- private _proCash = profileNamespace getVariable "pro_cash";
- if (isNil "_proCash") then
- {
- profileNamespace setVariable ["pro_cash", 0];
- _proCash = 0;
- };
- private _proKills = profileNamespace getVariable "pro_kills";
- if (isNil "_proKills") then
- {
- profileNamespace setVariable ["pro_kills", 0];
- _proKills = 0;
- };
- private _proLevel = profileNamespace getVariable "pro_level";
- if (isNil "_proLevel") then
- {
- profileNamespace setVariable ["pro_level", 0];
- _proLevel = 0;
- };
- _cash = switch (_proCash) do {
- case 0: {500};
- default {_proCash};
- };
- player setVariable ["cash", _cash, true];
- _level = switch (_proLevel) do {
- case 0: {1};
- default {_proLevel};
- };
- player setVariable ["level", _level, true];
- _myXP = switch (_proXP) do {
- case 0: {0};
- default {_proXP};
- };
- player setVariable ["experience", _myXP, true];
- _kills = switch (_proXP) do {
- case 0: {0};
- default {_proKills};
- };
- player setVariable ["kills", _kills, true];
- /*
- switch (side player) do {
- case west: {
- player setPos [2938.69,13107.5,0];
- //playSound "airplanes";
- };
- case east: {
- player setPos [2695.89,12334.4,0];
- //playSound "airplanes";
- };
- default {player setPos [0,0,0];};
- };
- */
- //Add event to player
- player addEventHandler [ "Killed", {
- //Get passed killed and killer
- _unit = _this select 0;
- _killer = _this select 1;
- //If we were killed by a player AND did not kill ourself
- if ( isPlayer _killer && !( _killer isEqualTo _unit ) ) then {
- //Is our killer an enemy
- _killedSide = ( getNumber ( configFile >> "CfgVehicles" >> typeOf _unit >> "side" ) ) call BIS_fnc_sideType;
- _isEnemy = _killedSide getFriend side _killer < 0.6;
- //Get killers stats
- _currentCash = _killer getVariable [ "cash", 0 ];
- _currentExperience = _killer getVariable [ "experience", 0 ];
- _currentKills = _killer getVariable [ "kills", 0 ];
- //If killer was an enemy
- if ( _isEnemy ) then {
- //Increase their stats
- _killer setVariable [ "cash", ( _currentCash + 500 ) , true ];
- _killer setVariable [ "experience", ( _currentExperience + 200 ) , true ];
- _killer setVariable [ "kills", ( _currentKills + 1 ) , true ];
- }else{
- //Decrease their stats
- _killer setVariable [ "cash", ( _currentCash - 100 ) max 0 , true ];
- _killer setVariable [ "experience", ( _currentExperience - 200 ) max 0 , true ];
- };
- //Call updateStats on killers client
- [ [], "fnc_updateStats", _killer ] call BIS_fnc_MP;
- };
- }];
- //Function to update stats
- fnc_updateStats = {
- //Get current experience
- _exp = player getVariable [ "experience", 0 ];
- _myLvl = player getVariable [ "level", 0 ];
- _tmpExp = _exp;
- _level = 0;
- _oldLevel = _myLvl;
- //Max value of level 1
- _expForNextLevel = 100;
- //Work out new level
- while { _tmpExp >= _expForNextLevel } do {
- _level = _level + 1;
- _tmpExp = _tmpExp - _expForNextLevel;
- //Every level needs twice as much exp as the level before
- _expForNextLevel = _expForNextLevel * 2;
- };
- //Set players level, minimum it can be is 0
- _myLvl = _level max 0;
- //If we increased in level
- if ( _level > _oldLevel ) then {
- //Inform player of level increase
- hint format [ " LEVEL UP \nNow Level %1", _myLvl ];
- [ [], "fnc_levelUpRewards", player ] call BIS_fnc_MP;
- };
- //Get progress to next level
- _progress = linearConversion [ 0, _expForNextLevel, _tmpExp, 0, 1 ];
- //Get player stats
- _cash = player getVariable [ "cash", 0 ];
- _kills = player getVariable [ "kills", 0 ];
- player setVariable [ "level", _myLvl, true ];
- profileNamespace setVariable [ "pro_level", _myLvl];
- profileNamespace setVariable [ "pro_experience", _tmpExp];
- profileNamespace setVariable [ "pro_cash", _cash];
- profileNamespace setVariable [ "pro_kills", _kills];
- saveProfileNamespace;
- //Update UI with stats
- (uiNamespace getVariable "UIplayerInfo" displayCtrl UIlevel ) ctrlSetText ( format [ "Level : %1", _myLvl ] );
- (uiNamespace getVariable "UIplayerInfo" displayCtrl UIprogress ) ctrlSetText ( format [ "XP : %1/%2", _tmpExp, _expForNextLevel ] );
- (uiNamespace getVariable "UIplayerInfo" displayCtrl UIprogressBar ) progressSetPosition _progress;
- (uiNamespace getVariable "UIplayerInfo" displayCtrl UIcash ) ctrlSetText ( format [ "Money : $%1", _cash ] );
- (uiNamespace getVariable "UIplayerInfo" displayCtrl UIkills ) ctrlSetText ( format [ "Kills : %1", _kills ] );
- };
- fnc_showLevelUp = {
- _myLvl = player getVariable [ "level", 0 ];
- _cashUp = player getVariable [ "cashGain", 0];
- if (_myLvl > 1) then {
- _lvlText = format [ " LEVEL UP!<br /> Now Level %1", _myLvl ];
- ["<t color='#B8AB67' size = '.4'>" + _lvlText + "</t>",safezoneX + 0.3 * safezoneW,safezoneY,4,1,0,789] call bis_fnc_dynamicText;
- };
- if (_cashUp > 0) then {
- _cashText = format [ " $%1", _cashUp];
- ["<t color='#B8AB67' size = '.4'>" + _cashText + "</t>",safezoneX + 0.25 * safezoneW,safezoneY,4,1,0,789] call bis_fnc_dynamicText;
- };
- };
- fnc_showCashGain = {
- _cashUp = player getVariable [ "cashGain", 0];
- if (_cashUp > 0) then {
- _cashText = format [ " $%1", _cashUp];
- ["<t color='#B8AB67' size = '.4'>" + _cashText + "</t>",safezoneX + 0.25 * safezoneW,safezoneY,4,1,0,789] call bis_fnc_dynamicText;
- _killer setVariable [ "cashGain",0, true ];
- };
- };
- fnc_levelUpRewards = {
- private [ "_currentWeapon", "_cfg", "_compatibleMags", "_myLvl" ];
- _myLvl = player getVariable [ "level", 0 ];
- _currentWeapon = primaryWeapon player;
- _cfg = configFile >> "CfgWeapons" >> _currentWeapon;
- _compatibleMags = [];
- {
- if ( _x == "this" ) then {
- _compatibleMags = _compatibleMags + getArray( _cfg >> "magazines" );
- }else{
- _compatibleMags = _compatibleMags + getArray( _cfg >> _x >> "magazines" );
- };
- }forEach getArray( _cfg >> "muzzles" );
- _mainMag = _compatibleMags select 0;
- _currentPack = backpack player;
- if ((player canAdd "optic_ACO") && (_myLvl ==1)) then {
- [ [], "neb_fnc_core_levelRewards", player ] call BIS_fnc_MP;
- player addPrimaryWeaponItem 'optic_ACO';
- hint "";
- };
- if ((player canAdd [_mainMag, 2]) && (_myLvl ==2)) then {
- player addMagazine 'HandGrenade';
- player addMagazine _mainMag;
- };
- if ((player canAdd [_mainMag, 3]) && (_myLvl ==3)) then {
- player addMagazine 'HandGrenade';
- player addMagazines [_mainMag, 2];
- if (_currentPack == "") then {
- switch (playerSide) do {
- case west: {
- player addBackpack "B_AssaultPack_tna_F";
- };
- case east: {
- player addBackpack "B_FieldPack_ghex_F"
- };
- };
- };
- };
- if ((player canAdd [_mainMag, 4]) && (_myLvl ==4)) then {
- player addMagazine 'HandGrenade';
- player addMagazines [_mainMag, 3];
- };
- if ((player canAdd [_mainMag, 5]) && (_myLvl ==5)) then {
- player addMagazine 'HandGrenade';
- player addMagazines [_mainMag, 4];
- switch (playerSide) do {
- case west: {
- execVM "Classes\AI\bluRifleMan.sqf";
- };
- case east: {
- };
- };
- };
- if ((player canAdd [_mainMag, 5]) && (_myLvl ==6)) then {
- player addMagazine 'HandGrenade';
- player addMagazines [_mainMag, 4];
- };
- if ((player canAdd [_mainMag, 5]) && (_myLvl ==7)) then {
- player addMagazine 'HandGrenade';
- player addMagazines [_mainMag, 4];
- switch (playerSide) do {
- case west: {
- execVM "Classes\AI\bluRifleMan.sqf";
- };
- case east: {
- };
- };
- };
- if ((player canAdd [_mainMag, 5]) && (_myLvl ==8)) then {
- player addMagazine 'HandGrenade';
- player addMagazines [_mainMag, 4];
- };
- if ((player canAdd [_mainMag, 5]) && (_myLvl ==9)) then {
- player addMagazine 'HandGrenade';
- player addMagazines [_mainMag, 4];
- switch (playerSide) do {
- case west: {
- execVM "Classes\AI\bluRifleMan.sqf";
- };
- case east: {
- };
- };
- };
- if ((player canAdd [_mainMag, 5]) && (_myLvl ==10)) then {
- player addMagazine 'HandGrenade';
- player addMagazines [_mainMag, 4];
- };
- };
- fnc_endTimer = {
- END_TIME = 30; //When mission should end in seconds.
- if (isServer) then {
- [] spawn
- {
- ELAPSED_TIME = 0;
- START_TIME = diag_tickTime;
- while {ELAPSED_TIME < END_TIME} do
- {
- ELAPSED_TIME = diag_tickTime - START_TIME;
- publicVariable "ELAPSED_TIME";
- sleep 1;
- };
- };
- };
- if!(isDedicated) then
- {
- [] spawn
- {
- while{ELAPSED_TIME < END_TIME } do
- {
- _time = END_TIME - ELAPSED_TIME;
- _finish_time_minutes = floor(_time / 60);
- _finish_time_seconds = floor(_time) - (60 * _finish_time_minutes);
- if(_finish_time_seconds < 10) then
- {
- _finish_time_seconds = format ["0%1", _finish_time_seconds];
- };
- if(_finish_time_minutes < 10) then
- {
- _finish_time_minutes = format ["0%1", _finish_time_minutes];
- };
- _formatted_time = format ["%1:%2", _finish_time_minutes, _finish_time_seconds];
- hintSilent format ["Time left:\n%1", _formatted_time];
- sleep 1;
- };
- };
- };
- };
- fnc_addSprintSuitA = {
- player forceAddUniform "U_O_Protagonist_VR";
- [ [], "NEB_fnc_isSpecialSuit", player ] call BIS_fnc_MP;
- };
- fnc_addSprintSuitB = {
- player forceAddUniform "U_B_Protagonist_VR";
- [ [], "NEB_fnc_isSpecialSuit", player ] call BIS_fnc_MP;
- };
- fnc_addSprintSuitC = {
- player forceAddUniform "U_I_Protagonist_VR";
- [ [], "NEB_fnc_isSpecialSuit", player ] call BIS_fnc_MP;
- };
- fnc_redSuit = {
- player forceAddUniform "U_O_Soldier_VR";
- [ [], "NEB_fnc_isSpecialSuit", player ] call BIS_fnc_MP;
- };
- fnc_bluSuit = {
- player forceAddUniform "U_B_Soldier_VR";
- [ [], "NEB_fnc_isSpecialSuit", player ] call BIS_fnc_MP;
- };
- fnc_bubEffect = {
- params[ "_objNetID" ];
- _unit = objectFromNetId _objNetID;
- _unit setVariable[ "bubEffect", true ]; //local object variable
- if ( local _unit ) then {
- _unit allowDamage false; //AL and EG
- };
- _unit setAnimSpeedCoef 2;//Unsure of locality needs testing
- _unit switchMove "AmovPercMstpSnonWnonDnon_EaseIn"; //AG and EL
- _unit setAnimSpeedCoef 0; //Unsure of locality needs testing
- while ( _unit getVariable[ "bubEffect", false ] ) do {
- drop [ //EL
- ["\A3\data_f\ParticleEffects\Universal\Universal",16,13,7,0],"","BillBoard",
- 1,1,[0,0.25,1],[0,0,0],
- random pi*2,1.277,1,0,
- [3],
- [[1,0,0,.5],[1,0,0,.5]],
- [10000],
- 0,0,"","",
- _unit,0,
- false,-1
- ];
- playSound "electricshock"; //EL
- _unit switchMove "AmovPercMstpSnonWnonDnon_Ease"; //AG and EL
- sleep 0.25; //This is the equivilent of you action per tick 6/24 = 0.25 seconds
- };
- };
- fnc_bubFinish = {
- params[ "_objNetID" ];
- _unit = objectFromNetId _objNetID;
- //Stop the particle loop
- _unit setVariable[ "bubEffect", false ];
- if ( local _unit ) then {
- //allowDamage is AL( arguments local ) EG( effects global )
- //So only where the unit is local( argument )
- //the Effects will be seen on all machine( effect global )
- _unit allowDamage true; //AL and EG
- };
- _unit setAnimSpeedCoef 1; //Unsure of locality needs testing
- _unit switchMove ""; //AG and EL
- };
- fnc_suitAbilities = {
- _skillA = [
- /* 0 object */ player,
- /* 1 action title */ "Sprint 1",
- /* 2 idle icon */ "images\sprinticonA.paa",
- /* 3 progress icon */ "images\sprinticonA.paa",
- /* 4 condition to show */ "player getvariable [ 'Sprint', false ]",
- /* 5 condition for action */ "true",
- /* 6 code executed on start */ {player setAnimSpeedCoef 1},
- /* 7 code executed per tick */ {
- _progress = param[ 4 ]; //max progress is always 24
- player setAnimSpeedCoef ( linearConversion[ 0, 24, _progress, 1.5, 2 ] );
- },
- /* 8 code executed on completion */ {player setAnimSpeedCoef 1},
- /* 9 code executed on interruption */ {player setAnimSpeedCoef 1},
- /* 10 arguments */ ["Sprint"],
- /* 11 action duration */ 6,
- /* 12 priority */ 0,
- /* 13 remove on completion */ false,
- /* 14 show unconscious */ false
- ] call bis_fnc_holdActionAdd;
- _skillB = [
- /* 0 object */ player,
- /* 1 action title */ "Sprint 2",
- /* 2 idle icon */ "images\sprinticonA.paa",
- /* 3 progress icon */ "images\sprinticonA.paa",
- /* 4 condition to show */ "player getvariable [ 'Sprint2', false ]",
- /* 5 condition for action */ "true",
- /* 6 code executed on start */ {player setAnimSpeedCoef 1.50},
- /* 7 code executed per tick */ {
- _progress = param[ 4 ]; //max progress is always 24
- player setAnimSpeedCoef ( linearConversion[ 0, 32, _progress, 1.5, 4 ] );
- },
- /* 8 code executed on completion */ {player setAnimSpeedCoef 1},
- /* 9 code executed on interruption */ {player setAnimSpeedCoef 1},
- /* 10 arguments */ ["Sprint"],
- /* 11 action duration */ 6,
- /* 12 priority */ 0,
- /* 13 remove on completion */ false,
- /* 14 show unconscious */ false
- ] call bis_fnc_holdActionAdd;
- _skillC = [
- /* 0 object */ player,
- /* 1 action title */ "Sprint 3",
- /* 2 idle icon */ "images\sprinticonA.paa",
- /* 3 progress icon */ "images\sprinticonA.paa",
- /* 4 condition to show */ "player getvariable [ 'Sprint3', false ]",
- /* 5 condition for action */ "true",
- /* 6 code executed on start */ {player setAnimSpeedCoef 1.70},
- /* 7 code executed per tick */ {
- _progress = param[ 4 ]; //max progress is always 24
- player setAnimSpeedCoef ( linearConversion[ 1.7, 32, _progress, 1.5, 6 ] );
- },
- /* 8 code executed on completion */ {player setAnimSpeedCoef 1},
- /* 9 code executed on interruption */ {player setAnimSpeedCoef 1},
- /* 10 arguments */ ["Sprint"],
- /* 11 action duration */ 12,
- /* 12 priority */ 0,
- /* 13 remove on completion */ false,
- /* 14 show unconscious */ false
- ] call bis_fnc_holdActionAdd;
- _skillD = [
- /* 0 object */ player,
- /* 1 action title */ "Lightning",
- /* 2 idle icon */ "images\blinkicon.paa",
- /* 3 progress icon */ "images\blinkicon.paa",
- /* 4 condition to show */ "player getvariable [ 'Lightning', false ]",
- /* 5 condition for action */ "true",
- /* 6 code executed on start */ {["Suit", "Preparing Lightning"] call BIS_fnc_showSubtitle},
- /* 7 code executed per tick */ {hint "Lightning Charging"},
- /* 8 code executed on completion */ {[] call neb_fnc_core_strikeLightning;},
- /* 9 code executed on interruption */ {hint ""},
- /* 10 arguments */ ["Lightning"],
- /* 11 action duration */ 3,
- /* 12 priority */ 0,
- /* 13 remove on completion */ false,
- /* 14 show unconscious */ false
- ] call bis_fnc_holdActionAdd;
- _skillE = [
- player, // 0 object
- "Bubble", // 1 action title
- "images\blinkicon.paa", // 2 idle icon
- "images\blinkicon.paa", // 3 progress icon
- "player getvariable [ 'Bubble', false ]", // 4 condition to show
- "true", // 5 condition for action
- // 6 code executed on start
- {
- //Create a unique name for the jip queue
- [ netId player ] remoteExec [ "fnc_bubEffect", 0, format[ "%1_bub", netId player ] ];
- },
- // 7 code executed per ACTION tick ( Range 0 - 24 ), tick duration = action duration / MAX tick 24
- {},
- // 8 code executed on completion
- {
- //No JIP
- [ netId player ] remoteExec [ "fnc_bubFinish", 0 ];
- //Remove start from JIP queue
- remoteExec [ "", format[ "%1_bub", netId player ] ]
- },
- // 9 code executed on interruption
- {
- //No JIP
- [ netId player ] remoteExec [ "fnc_bubFinish", 0 ];
- //Remove start from JIP queue
- remoteExec [ "", format[ "%1_bub", netId player ] ]
- },
- [], // 10 arguments
- 6, // 11 action duration
- 0, // 12 priority
- false, // 13 remove on completion
- false // 14 show unconscious
- ] call BIS_fnc_holdActionAdd;
- //player setVariable ["skillA", _skillA];
- // player setVariable ["skillB", _skillB];
- //player setVariable ["skillC", _skillC];
- // player setVariable ["skillD", _skillD];
- };
- player addEventHandler [ "Take", {
- [] call NEB_fnc_isSpecialSuit;
- }];
- player addEventHandler [ "Put", {
- [] call NEB_fnc_isSpecialSuit;
- }];
- NEB_fnc_isSpecialSuit = {
- private [ "_suitIndex" ];
- _specialSuits = [ "U_O_Protagonist_VR", "U_B_Protagonist_VR", "U_I_Protagonist_VR", "U_C_Driver_1_black", "U_C_Driver_1_white" ];
- _isWearing = uniform player in _specialSuits;
- if ( _isWearing ) then {
- _suitIndex = _specialSuits find uniform player;
- };
- _wasWearing = { _x }count ( player getVariable [ "hasSpecialSuit", [ false, false, false, false, false ] ] ) > 0;
- if ( _wasWearing && !_isWearing ) then {
- player setVariable [ "hasSpecialSuit", [ false, false, false, false, false ] ];
- [ -1 ] call NEB_fnc_suitChanged;
- hint format [ "%1 took off Special Suit", name player ];
- };
- if ( _isWearing ) then {
- _flags = player getVariable [ "hasSpecialSuit", [ false, false, false, false, false ] ];
- {
- if ( _forEachIndex isEqualTo _suitIndex ) then {
- if !( _x ) then {
- hint format [ "%1 put on Special Suit", name player ];
- _flags set [ _forEachIndex, true ];
- [ _suitIndex ] call NEB_fnc_suitChanged;
- };
- }else{
- _flags set [ _forEachIndex, false ];
- };
- }forEach _flags;
- player setVariable [ "hasSpecialSuit", _flags ];
- };
- };
- [] call NEB_fnc_isSpecialSuit;
- NEB_fnc_suitChanged = {
- private[ "_newAbilities" ];
- params[ "_suitIndex" ];
- _allAbilities = [ "Sprint", "Sprint2", "Sprint3", "Lightning", "Bubble" ];
- _suitAbilities = [
- [ "Sprint" ],
- [ "Sprint2" ],
- [ "Sprint3" ],
- [ "Sprint3", "Lightning" ],
- [ "Sprint3", "Bubble" ]
- ];
- if ( _suitIndex > -1 ) then {
- _newAbilities = _suitAbilities select _suitIndex;
- }else{
- _newAbilities = [];
- };
- {
- if ( _x in _newAbilities ) then {
- player setVariable[ _x, true ];
- }else{
- player setVariable[ _x, false ];
- };
- }forEach _allAbilities;
- };
- [] spawn neb_fnc_core_openChute;
- //Starting UI stats and groups
- ( [ "playerInfo" ] call BIS_fnc_rscLayer ) cutRsc [ "playerInfo", "PLAIN", 1, false ];
- [] call fnc_updateStats;
- //[] call neb_fnc_core_startingStats;
- ["InitializePlayer", [player]] call BIS_fnc_dynamicGroups;
- [player] call neb_fnc_core_disableStamina;
- NEB_fnc_getPlayerLevel = {
- player getVariable [ "level", 0 ];
- };
- NEB_fnc_getPlayerCash = {
- player getVariable [ "cash", 0 ];
- };
- [] spawn neb_fnc_core_addPlayerIcons;
- 0 = ["players","ai"] call neb_fnc_core_playerMarkers;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement