Jump to content
  • 0

humanity


juandayz

Question

Im working in a new script and need to know if

anyone knows how is the code to add/remove humanity if player do some action.

heres the script.. in blue whers players must be gain humanity

Spoiler

private ["_playerPos","_nearmiss","_inventory","_LastUsedTime","_Time","_hastoolb"];

call gear_ui_init;
_playerPos = getPosATL player;
_nearmiss = count nearestObjects [_playerPos, ["touringcar"], 3] > 0;
_random = round(random(4));
_LastUsedTime = 180;
_Time = time - lastuse;
_inventory = items player;
_hastoolb = "ItemToolbox" in _inventory;


if(_Time < _LastUsedTime) exitWith {
    cutText [format["waith anothers %1 seconds !",(round(_Time - _LastUsedTime))], "PLAIN DOWN"];
};

if !(_hastoolb) exitWith {
cutText [format["Needs a toolbox to help this people."], "PLAIN DOWN"];
};

if (_nearmiss && _hastoolb) then {
    lastuse = time;
    sleep 1;
    player playActionNow "Medic";
    player removeWeapon "ItemToolbox";
    sleep 3;
    cutText [format["vehicle fixed you get more humanity"], "PLAIN DOWN"];

    GAIN HUMANITY
  
 
    sleep 10;
    deleteVehicle _303 ;
    
    };

 

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0
Spoiler


		_humanity = player getVariable["humanity",0];
		
		_humanity = _humanity + 10;
		player setVariable["humanity",_humanity,true];

 

or if you want to have a little bit of fun with it:

Spoiler


		_humanity = player getVariable["humanity",0];
		
		if ((_humanity) >= 2500) then {
			_humanity = _humanity + 10;
			player setVariable["humanity",_humanity,true];
		};
		if ((_humanity) < 2500) then {
		_humanity = _humanity -10;
		player setVariable["humanity",_humanity,true];
		};

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Discord

×
×
  • Create New...