Jump to content

Recommended Posts

Mettre du nitro 

Adapter pour la version 3.1.4.8 (La dernière de itsyuka)

Pour commencer on va créée l'item "nitro" :

Vous aller dans le fichier fn_VarHandle.sqf pour y rajoutez  dans la case 0 dans le switch

case 0:
{
switch (_mode) do
{
	case 0:
	{
		switch (_var) do
		{
			case "nitro": {"life_inv_nitro"};
		};
	};

Maintenant vous aller juste en bas dans case 1

case 1:
	{
		switch (_var) do
		{
			case "life_inv_nitro": {"nitro"};
		};
	};
};

Voila maintenant l'items créer on va le configurer pour ça il faut aller dans le fichier Config_Master.hpp

puis aller dans la class VirtuelItems 

//Virtual Items
class VirtualItems {
	VITEMMACRO(nitro,"Nitro",nitro,5,1500,0,-1,false,-1,"")
}; 

Voila vous rajouter ça puis vous pouvez configurer le poids le prix ... 

et pour terminer la config il faut aller dans le fichier fn_useItem.sqf

Vous rajouter ça a la fin avant Default   

case (EQUAL(_item,"nitro")): {
		if(vehicle player != player) exitWith {hint "Nitro Activer"};
		[] spawn life_fnc_nitroUse;
		else {
			hint format ["Il faut etre dans un vehicule pour utiliser %1",player ]
		}
}; 

Puis vous allez dans le fichier de configuration des touches fn_KeyHandler.sqf

vous rajouter ça ou vous voulez de façon logique bien sur ^^ 

//N Touche Nitro 
	case 49: 
		if([false,"nitro",1] call life_fnc_handleInv) then
		{
			[] spawn life_fnc_nitroUse;	
		}
	}

Pour finir vous créer un fichier fn_nitroUse.sqf dans \Altis-Life-master\extDB-Build\Altis_Life.Altis\core\items

/*fn_nitroUse.sqf
Adapter pour altis life par HamzaDams
By: Hellop 2008
Copyright: Released to the Public Domain.  It would be cool if you gave me credit in your mission if you use it.
Purpose: Simulate Nitrous Oxide speed-boost for vehicles.  Sets global variable on client computer, cli_nitroLock 
so that the nitro can't be engaged more than once at at time.

Pre: 1. Global var: cli_nitroLock = true;
2. Player's vehicle has an action menu item enabled that runs this script. e.g. in the initline of a car/tank:
this addEventHandler ["getin", {
if ((_this select 1) == "driver") then {
actionIDNitro = _this select 0 addAction ["Nitro", "client\action\fn_nitroUse.sqf"];  
}; 
}]; 
this addEventHandler ["getout", {_this select 0 removeAction actionIDNitro;}]; 

Post: cli_nitroLock is set to true;

Testing: 5 min. reverse doesn't work.  Would be nice if it worked dynamically from vehicle weight/maxspeed.
Air Vehicles not tested.
*/

private ["_obj", "_vel", "_tmrInterval", "_dir", "_maxSpeed"];

_actionID = _this select 2; 
_obj = vehicle player;
//Tanks and stuff get less nitro.
_tmrInterval = .1;
_maxSpeed = 120;
_speedMultiplier = .4; //2 is good for cars, too much for tanks
_nitroDuration = 5;

if ((typeOf _obj) isKindOf "Car")  then {
_tmrInterval = .02;
_maxSpeed = 180;
_speedMultiplier = 1.5; 
};

if ((typeOf _obj) isKindOf "Air") then {
_tmrInterval = .02;
_maxSpeed = 500;  //What is best val here?
_speedMultiplier = .3; 
};

if ((typeOf _obj) isKindOf "Motorcycle") then {
_tmrInterval = .02;
_maxSpeed = 140;  //What is best val here?
_speedMultiplier = .2; 
};


//Initialize vars;
_vel = 0;
_velX = 0;
_velY = 0;
_velZ =0;
_dir = 0;
_sinDir = 0;
_cosDir = 0;
_previousVel = velocity _obj;
_previousSpeed = speed _obj;
_curSpeed = 0;
if ((speed _obj) <= 3) then {
player sideChat format ["Vous devez être en mouvement pour activer Nitro."];
}
else {    
if (cli_nitroLock) then { 
cli_nitroLock = false;
player sideChat format ["Nitro engagé."];
//player globalchat format["Time: %1, Vehicle Type: %2, MaxSpeed: %3", time, typeOf _obj, _maxSpeed]; 
_startTime = time;
_tmpSpeedMultiplier = _speedMultiplier;
while {(time - _startTime) < _nitroDuration} do { 
sleep _tmrInterval;
_vel = velocity _obj;
_curSpeed = (speed _obj);
if (((abs _curSpeed) - (abs _previousSpeed)) > 30) then {_vel = _previousVel};  //To prevent getting thrown far in collisions
_velX = _vel select 0;
_velY = _vel select 1;
_velZ = _vel select 2;
_dir = getdir _obj;
//player globalChat format ["Speed: %1", speed _obj];
if ((speed _obj) > _maxSpeed) then {_tmpSpeedMultiplier = 0} else {_tmpSpeedMultiplier = _speedMultiplier}; 
_sinDir = _tmpSpeedMultiplier*(sin _dir);
_cosDir = _tmpSpeedMultiplier*(cos _dir);
_obj setvelocity [_velX + _sinDir, _velY + _cosDir, _velZ -.1]; //Keep Z vector moving with gravity
_previousSpeed = _curSpeed;
_previousVel = _vel; 
};
cli_nitroLock = true;
player sideChat format ["Test Nitro Fait ! Vel: %1. Dir: %2, Speed: %3", velocity _obj, direction _obj, speed _obj];
};
};

Voila j’espère ça marchera pour tout le monde et que j'ai été le plus claire ^^ Faite moi des retour

Edited by hamzadams
  • Upvote 1
Link to post
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.

Loading...
×
×
  • Create New...