• [Tutorial] Comment faire un traitement a double items dans la 4.0


    Bonjour/Bonsoir mon nom es Ac1D_R41N et je vais vous montrer aujourd’hui comment avoir un Traitement double dans la 4.0.

    Je tien a preciser que je les seulement modifier et non creer je me suis baser sur l’auteur de celui de la 3.1.4.8:http://www.altisliferpg.com/topic/2583-tutorial-how-to-process-2-items-crafting/

    Premiere chose a faire aller dans \votremission\core\actions et ouvrez fn_processActions.sqf

    Maintenant remplacer tout par ceci:

    #include <macro.h>  
    /*  
    File: fn_processAction.sqf  
    Author: Bryan "Tonic" Boardwine  
    edited by theInfinit (to process 2 Item to a combination)  
    ajust for 4.0 by AC1D_R4iN  
    Description:  
    Master handling for processing an item.  
    */  
    private["_vendor","_type","_itemInfo","_oldItem","_oldItem2","_newItem","_cost","_upp","_hasLicense","_itemName","_itemNameo1","_itemNameo2","_oldVal","_oldVal2","_ui","_progress","_pgText","_cP","_error1","_error2", "_min", "_license","_randp","_artefact"];  
    _vendor = [_this,0,ObjNull,[ObjNull]] call BIS_fnc_param;  
    _type = [_this,3,"",[""]] call BIS_fnc_param;  
    //Error check  
    if(isNull _vendor OR _type == "" OR (player distance _vendor > 10)) exitWith {};  
    
    _error1 = false; // used below check the comment there   
    _error2 = false;  
    _min = 0;  
    //unprocessed item,processed item, cost if no license,Text to display (I.e Processing  (percent) …"  
    
    _itemInfo = switch (_type) do  
    {  
    case "oil": {_license = _type;["oil_unprocessed","oil_processed",1200,(localize "STR_Process_Oil"), false];};  
    case "diamond": {_license = _type;["diamond_uncut","diamond_cut",1350,(localize "STR_Process_Diamond"), false];};  
    case "heroin": {_license = _type;["heroin_unprocessed","heroin_processed",4000,(localize "STR_Process_Heroin"), false];};  
    case "copper": {_license = _type;["copper_unrefined","copper_refined",750,(localize "STR_Process_Copper"), false];};  
    case "iron": {_license = _type;["iron_unrefined","iron_refined",1120,(localize "STR_Process_Iron"), false];};  
    case "sand": {_license = _type;["sand","glass",650,(localize "STR_Process_Sand"), false];};  
    case "salt": {_license = _type;["salt_unrefined","salt_refined",450,(localize "STR_Process_Salt"), false];};  
    case "cocaine": {_license = _type;["cocaine_unprocessed","cocaine_processed",3000,(localize "STR_Process_Cocaine"), false];};  
    case "marijuana": {_license = _type;["cannabis","marijuana",2000,(localize "STR_Process_Marijuana"), false];};  
    case "cement": {_license = _type;["rock","cement",350,(localize "STR_Process_Cement"), false];};  
    default {[];};  
    };  
    
    //Error checking  
    if(count _itemInfo == 0) exitWith {};  
    
    //Setup vars.  
    _oldItem = _itemInfo select 0;  
    _newItem = _itemInfo select 1;  
    _cost = _itemInfo select 2;  
    _upp = _itemInfo select 3;  
    _2var = _itemInfo select 4;  
    if(_2var) then { _oldItem2 = _itemInfo select 5;};    
    
    if(_vendor in [coke_processor,heroin_processor]) then {  
    _hasLicense = true;  
    } else {  
    _hasLicense = LICENSE_VALUE(_license,"civ");  
    };  
    
    _itemName = ITEM_NAME(_newItem);  
    _itemNameo1 = ITEM_NAME(_oldItem);  
    _oldVal = ITEM_VALUE(_oldItem);  
    _min = _oldVal;  
    //2vars  
    if(_2var) then { _oldVal2 = ITEM_VALUE(_oldItem2); };   
    
    if(_2var) then {  
    if(_oldVal >= _oldVal2) then {_min = _oldVal2} else {_min = _oldVal};  
    _itemNameo2 = ITEM_NAME(_oldItem2);  
    };  
    
    _cost = _cost * _min;  
    //Some more checks  
    if(_min == 0) exitWith {};  
    
    //Setup our progress bar.  
    disableSerialization;  
    5 cutRsc ["life_progress","PLAIN"];  
    _ui = uiNameSpace getVariable "life_progress";  
    _progress = _ui displayCtrl 38201;  
    _pgText = _ui displayCtrl 38202;  
    _pgText ctrlSetText format["%2 (1%1)...","%",_upp];  
    _progress progressSetPosition 0.01;  
    _cP = 0.01;  
    
    life_is_processing = true;  
    
    if(_hasLicense) then  
    {  
    while{true} do  
    
    {  
    sleep  0.3;  
    _cP = _cP + 0.02;  
    _progress progressSetPosition _cP;  
    _pgText ctrlSetText format["%3 (%1%2)...",round(_cP * 100),"%",_upp];  
    if(_cP >= 1) exitWith {};  
    if(player distance _vendor > 10) exitWith {};  
    
    };  
    
    if(player distance _vendor > 10) exitWith {hint localize "STR_Process_Stay"; 5 cutText ["","PLAIN"]; life_is_processing = false;};  
    
    if(!([false,_oldItem,_min] call life_fnc_handleInv)) exitWith {5 cutText ["","PLAIN"]; life_is_processing = false;};  
    //2vars  
    if(_2var) then   
    {  
    
    ([false,_oldItem2,_min] call life_fnc_handleInv);  
    5 cutText ["","PLAIN"];  
    
    titleText[format["Vous avez transforme %1 et %2 en %3.",_itemNameo1,_itemNameo2,_itemName],"PLAIN"];  
    } else  
    {  
    
    5 cutText ["","PLAIN"];  
    titleText[format["Vous avez transforme %1 en %2.",_itemNameo1,_itemName],"PLAIN"];  
    };  
    if(!([true,_newItem,_min] call life_fnc_handleInv)) exitWith {5 cutText ["","PLAIN"]; [true,_oldItem,_min] call life_fnc_handleInv; life_is_processing = false;};  
    life_is_processing = false;  
    
    }  
    else  
    {  
    if(life_cash < _cost) exitWith {hint format["You need $%1 to process without a license!",[_cost] call life_fnc_numberText]; 5 cutText ["","PLAIN"]; life_is_processing = false;};  
    
    while{true} do  
    {  
    sleep  0.9;  
    _cP = _cP + 0.02;  
    _progress progressSetPosition _cP;  
    _pgText ctrlSetText format["%3 (%1%2)...",round(_cP * 100),"%",_upp];  
    if(_cP >= 1) exitWith {};  
    if(player distance _vendor > 10) exitWith {};  
    };  
    
    if(player distance _vendor > 10) exitWith {hint "You need to stay within 10m to process."; 5 cutText ["","PLAIN"]; life_is_processing = false;};  
    
    if(life_cash < _cost) exitWith {hint format["You need $%1 to process  without a license!",[_cost] call life_fnc_numberText]; 5 cutText ["","PLAIN"]; life_is_processing = false;};  
    
    if(!([false,_oldItem,_min] call life_fnc_handleInv)) exitWith {5 cutText ["","PLAIN"]; life_is_processing = false;};  
    //2vars  
    if(_2var) then   
    {   
    ([false,_oldItem2,_min] call life_fnc_handleInv);  
    5 cutText ["","PLAIN"];  
    titleText[format["Vous avez transforme %1 et %2 en %3 pour %4$.",_itemNameo1,_itemNameo2,_itemName,[_cost] call life_fnc_numberText],"PLAIN"];  
    } else  
    {  
    
    5 cutText ["","PLAIN"];  
    titleText[format["Vous avez transforme %1 en %2 pour %3$.",_itemNameo1,_itemName,[_cost] call life_fnc_numberText],"PLAIN"];  
    };  
    if(!([true,_newItem,_min] call life_fnc_handleInv)) exitWith {5 cutText ["","PLAIN"]; [true,_oldItem,_min] call life_fnc_handleInv; life_is_processing = false;};  
    life_cash = life_cash - _cost;  
    
    life_is_processing = false;  
    }; ```
    
    Deuxième chose a faire c'est la suivante dans le même dossier ouvrez votre macro.h et remplacer la ligne ci-dessous:
    
    

    #define ITEM_NAME(varName) M_CONFIG(getText,“VirtualItems”,varName,“displayName”)

    
    Par celle-ci:
    
    

    #define ITEM_NAME(varName) localize M_CONFIG(getText,“VirtualItems”,varName,“displayName”)

    
    En quoi consiste le changement du macro.h ? il va servir a donner le nom véritable de l'objet qui ce trouve dans votre stringtable.xml et non la variable de l'objet.
    
    Voici un Exemple avec l'héroine:
    
    Sans la modification:
    
    

    Vous avez transformer heroin_unprocessed en heroin_processed.```

    Et maintenant avec la modification:

    Vous avez transformer Héroine non Traiter en Héroine raffiner.  
    

    Voila, Merci et bonne fin de soirée/journée

    Si vous avez des commentaires hésiter pas :)

  • Tu n’as pas besoin de modifier le macro.h.

    Tu as seulement besoin d’utiliser le “localize”.

    Exemple:

    titleText[format[localize "STR_Process_Processed3",localize _itemNameo1,localize _itemNameo2,localize _itemName],"PLAIN"];  
    

    Optimisation!

    Si on utilise le script tel que tu nous le propose et qu’on souhaites faire ex: de la bière.

    Qu’est-ce qui va se passer rendu à la mise en bouteille ton script va faire semblant de traiter car tu utilise “>=”.

    Si on n’a pas de bouteilles de verre.

    Car “Bouteille de verre” + “Bière Fermentée” = Bouteille de Bière

    Il va ignorer l’item 1 à cause du “>”.

    Dans ton script:

    if(_2var) then {  
    if(_oldVal >= _oldVal2) then {_min = _oldVal2} else {_min = _oldVal};  
    _itemNameo2 = ITEM_NAME(_oldItem2);  
    };  
    

    Pour éviter ça et envoyer un message au joueur de rééquilibrer ses articles utilise ça:

    if(_2var) then {  
    if(_oldVal != _oldVal2) then {_error1 = true;} else {_min = _oldVal};  
    _itemNameo2 = ITEM_NAME(_oldItem2);  
    };  
    
    if(_error1) exitWith{hint "Svp utiliser une quantité égale pour les 2 articles!"};  
    

    Sinon pour le reste bravo !

    text alternatif

  • Et tant qu’à passer sur ce sujet.

    Voici le script pour Altis Life 4.4.

    Prenez mon fichier comme exemple:

    #include "..\..\script_macros.hpp"  
    /*  
    	File: fn_processAction.sqf  
    	Author: Bryan "Tonic" Boardwine  
    
    	Description:  
    	Master handling for processing an item.  
    */  
    private["_vendor","_type","_itemInfo","_oldItem","_oldItem2","_newItem","_cost","_upp","_hasLicense","_itemName","_itemNameo1","_itemNameo2","_oldVal","_oldVal2","_ui","_progress","_pgText","_cP","_error1","_error2","_min","_license"];  
    _vendor = [_this,0,ObjNull,[ObjNull]] call BIS_fnc_param;  
    _type = [_this,3,"",[""]] call BIS_fnc_param;  
    //Error check  
    if(isNull _vendor OR EQUAL(_type,"") OR (player distance _vendor > 10)) exitWith {};  
    _error1 = false;   
    _error2 = false;  
    _min = 0;  
    
    //unprocessed item,processed item, cost if no license,Text to display (I.e Processing  (percent) …"  
    _itemInfo = switch (_type) do {  
    
    	// Simple Processus  
    	case "oil": {["oil_unprocessed","oil_processed",1200,(localize "STR_Process_Oil"),false];};  
    	case "diamond": {["diamond_uncut","diamond_cut",1350,(localize "STR_Process_Diamond"),false];};  
    	case "heroin": {["heroin_unprocessed","heroin_processed",1750,(localize "STR_Process_Heroin"),false];};  
    	case "opium": {["heroin_unprocessed","opium_processed",1750,(localize "STR_Process_Opium"),false];};	  
    	case "copper": {["copper_unrefined","copper_refined",750,(localize "STR_Process_Copper"),false];};  
    	case "iron": {["iron_unrefined","iron_refined",1120,(localize "STR_Process_Iron"),false];};  
    	case "sand": {["sand","glass",650,(localize "STR_Process_Sand"),false];};  
    	case "salt": {["salt_unrefined","salt_refined",450,(localize "STR_Process_Salt"),false];};  
    	case "sugar": {["sugar_unrefined","sugar_refined",450,(localize "STR_Process_Sugar"),false];};	  
    	case "cocaine": {["cocaine_unprocessed","cocaine_processed",1500,(localize "STR_Process_Cocaine"),false];};  
    	case "crack": {["cocaine_processed","crack_processed",1500,(localize "STR_Process_Crack"),false];};	  
    	case "marijuana": {["cannabis","marijuana",500,(localize "STR_Process_Marijuana"),false];};  
    	case "medmarijuana": {["cannabis","medmarijuana",500,(localize "STR_Process_MedMarijuana"),false];};  
    	case "cement": {["rock","cement",350,(localize "STR_Process_Cement"),false];};	  
    
    	// Multi Processus  
    	case "beer": {["hops","beer",1500,(localize "STR_Process_Beer"),true,"yeast"];};  
    	case "bottledbeer": {["beer","bottledbeer",500,(localize "STR_Process_Bottledbeer"),true,"bottles"]};  
    
    	case "moonshine": {["cornmeal","moonshine",250,(localize "STR_Process_Moonshine"),true,"yeast"]};  
    	case "bottledshine": {["moonshine","bottledshine",500,(localize "STR_Process_Bottledshine"),true,"bottles"]};  
    
    	case "vodka": {["sugar_unrefined","vodka",1500,(localize "STR_Process_Vodka"),true,"yeast"];};  
    	case "bottledvodka": {["vodka","bottledvodka",500,(localize "STR_Process_Bottledvodka"),true,"bottles"]};  
    
    	case "whiskey": {["rye","whiskey",1000,(localize "STR_Process_Whiskey"),true,"yeast"];};	  
    	case "bottledwhiskey": {["whiskey","bottledwhiskey",500,(localize "STR_Process_Bottledwhiskey"),true,"bottles"]};  
    
    	case "wine": {["grape","wine",1500,(localize "STR_Process_Wine"),true,"yeast"];};  
    	case "bottledwine": {["wine","bottledwine",500,(localize "STR_Process_Bottledwine"),true,"bottles"]};  
    
    	default {[];};  
    };  
    
    //Error checking  
    if(EQUAL(count _itemInfo,0)) exitWith {};  
    
    //Setup vars.  
    _oldItem = SEL(_itemInfo,0);  
    _newItem = SEL(_itemInfo,1);  
    _cost = SEL(_itemInfo,2);  
    _upp = SEL(_itemInfo,3);  
    _2var = SEL(_itemInfo,4);  
    if(_2var) then {_oldItem2 = SEL(_itemInfo,5);};  
    
    if(_vendor in [mari_processor,coke_processor,heroin_processor]) then {  
    	_hasLicense = true;  
    } else {  
    	_hasLicense = LICENSE_VALUE(_type,"civ");	  
    };  
    
    _itemName = M_CONFIG(getText,"VirtualItems",_newItem,"displayName");  
    _itemNameo1 = M_CONFIG(getText,"VirtualItems",_oldItem,"displayName");  
    _oldVal = ITEM_VALUE(_oldItem);  
    _min = _oldVal;  
    
    //2vars  
    if(_2var) then { _oldVal2 = ITEM_VALUE(_oldItem2);};   
    
    if(_2var) then {  
    	if(_oldVal != _oldVal2) then {_error1 = true;} else {_min = _oldVal};  
    	_itemNameo2 = M_CONFIG(getText,"VirtualItems",_oldItem2,"displayName");  
    };  
    
    if(_error1) exitWith{hint "Svp utiliser une quantité égale pour les 2 articles!"};  
    
    _cost = _cost * _min;  
    //Some more checks  
    if(EQUAL(_oldVal,0)) exitWith {};  
    
    //Setup our progress bar.  
    disableSerialization;  
    5 cutRsc ["life_progress","PLAIN"];  
    _ui = GVAR_UINS "life_progress";  
    _progress = _ui displayCtrl 38201;  
    _pgText = _ui displayCtrl 38202;  
    _pgText ctrlSetText format["%2 (1%1)...","%",_upp];  
    _progress progressSetPosition 0.01;  
    _cP = 0.01;  
    
    life_is_processing = true;  
    
    if(_hasLicense) then {  
    	while{true} do {  
    		sleep  0.3;  
    		_cP = _cP + 0.02;  
    		_progress progressSetPosition _cP;  
    		_pgText ctrlSetText format["%3 (%1%2)...",round(_cP * 100),"%",_upp];  
    		if(_cP >= 1) exitWith {};  
    		if(player distance _vendor > 10) exitWith {};  
    	};  
    
    	if(player distance _vendor > 10) exitWith {hint localize "STR_Process_Stay"; 5 cutText ["","PLAIN"]; life_is_processing = false;};  
    	if(!([false,_oldItem,_min] call life_fnc_handleInv)) exitWith {5 cutText ["","PLAIN"]; life_is_processing = false;};	  
    
    	//2vars			  
    	if(_2var) then {  
    		([false,_oldItem2,_min] call life_fnc_handleInv);  
    		5 cutText ["","PLAIN"];  
    		titleText[format[localize "STR_Process_Processed3",localize _itemNameo1,localize _itemNameo2,localize _itemName],"PLAIN"];  
    
    	} else   
    	{	  
    
    		5 cutText ["","PLAIN"];  
    		titleText[format[localize "STR_Process_Processed",localize _itemNameo1,localize _itemName],"PLAIN"];  
    	};  
    
    	if(!([true,_newItem,_min] call life_fnc_handleInv)) exitWith {5 cutText ["","PLAIN"]; [true,_oldItem,_min] call life_fnc_handleInv; life_is_processing = false;};    
    	life_is_processing = false;  
    
    	} else   
    	{  
    
    	if(CASH < _cost) exitWith {hint format[localize "STR_Process_License",[_cost] call life_fnc_numberText]; 5 cutText ["","PLAIN"]; life_is_processing = false;};  
    
    	while{true} do {  
    		sleep  0.9;  
    		_cP = _cP + 0.02;  
    		_progress progressSetPosition _cP;  
    		_pgText ctrlSetText format["%3 (%1%2)...",round(_cP * 100),"%",_upp];  
    		if(_cP >= 1) exitWith {};  
    		if(player distance _vendor > 10) exitWith {};  
    	};  
    
    	if(player distance _vendor > 10) exitWith {hint localize "STR_Process_Stay"; 5 cutText ["","PLAIN"]; life_is_processing = false;};  
    	if(CASH < _cost) exitWith {hint format[localize "STR_Process_License",[_cost] call life_fnc_numberText]; 5 cutText ["","PLAIN"]; life_is_processing = false;};  
    	if(!([false,_oldItem,_min] call life_fnc_handleInv)) exitWith {5 cutText ["","PLAIN"]; life_is_processing = false;};  
    
    	//2vars  
    	if(_2var) then {  
    		([false,_oldItem2,_min] call life_fnc_handleInv);  
    		5 cutText ["","PLAIN"];  
    		titleText[format[localize "STR_Process_Processed4",localize _itemNameo1,localize _itemNameo2,localize _itemName,[_cost] call life_fnc_numberText],"PLAIN"];  
    	} else   
    	{  
    
    		5 cutText ["","PLAIN"];  
    		titleText[format[localize "STR_Process_Processed2",localize _itemNameo1,localize _itemName,[_cost] call life_fnc_numberText],"PLAIN"];  
    
    	};  
    
    	if(!([true,_newItem,_min] call life_fnc_handleInv)) exitWith {5 cutText ["","PLAIN"]; [true,_oldItem,_min] call life_fnc_handleInv; life_is_processing = false;};  
    
    	SUB(CASH,_cost);  
    	life_is_processing = false;  
    };	  
    

    Dans Stringtable.xml éditer ou créer:

        <Key ID="STR_Process_Processed">  
          <Original>Vous avez traité %1 en %2.</Original>  
        </Key>  
    
        <Key ID="STR_Process_Processed2">  
          <Original>Vous avez traité %1 en %2 pour %3$.</Original>  
        </Key>  
    
        <Key ID="STR_Process_Processed3">  
          <Original>Vous avez traité %1 et %2 en %3.</Original>  
        </Key>  
    
        <Key ID="STR_Process_Processed4">  
          <Original>Vous avez traité %1 et %2 en %3 pour %4$.</Original>  
        </Key>  
    

    Enjoy !

    text alternatif

  • Bonjour, quel type de script faut il utilisé pour le PNJ ? Je suis en 4.4

    ayant mis ca, il ne m’affiche que le prix de la licence ( a l’infini meme apres l’avoir acheté )

    	this enableSimulation false;  this allowDamage false;  this addAction[localize"STR_Process_Bottledpastis",life_fnc_processAction,"Bottledpastis",0,false,false,"",' ("life_inv_anisp","life_inv_glass") > 0 && !life_is_processing'];  this addAction[format["%1 ($%2)",localize (getText(missionConfigFile >> "Licenses" >> "Bottledpastis" >> "displayName")), [(getNumber(missionConfigFile >> "Licenses" >> "Bottledpastis" >> "price"))] call life_fnc_numberText],life_fnc_buyLicense,"Bottledpastis",0,false,false,"",' !license_civ_meth && playerSide == civilian ']  
    

    Merci d’avance :)

  • Salut, je suis en 4.3 et j’ai un petit problème. Quand je traite l’élément a double items tous marche sauf qu’il ne supprime qu’un élément dans mon inventaire. Voici mon fn_processActions.sqf

    #include "..\..\script_macros.hpp"  
    /*  
    	File: fn_processAction.sqf  
    	Author: Bryan "Tonic" Boardwine  
    
    	Description:  
    	Master handling for processing an item.  
    */  
    private["_vendor","_type","_itemInfo","_oldItem","_newItem","_cost","_upp","_hasLicense","_itemName","_oldVal","_ui","_progress","_pgText","_cP"];  
    _vendor = [_this,0,ObjNull,[ObjNull]] call BIS_fnc_param;  
    _type = [_this,3,"",[""]] call BIS_fnc_param;  
    //Error check  
    if(isNull _vendor OR EQUAL(_type,"") OR (player distance _vendor > 10)) exitWith {};  
    
    //unprocessed item,processed item, cost if no license,Text to display (I.e Processing  (percent) …"  
    _itemInfo = switch (_type) do {  
    	case "oil": {["oil_unprocessed","oil_processed",1200,(localize "STR_Process_Oil")];};  
    	case "diamond": {["diamond_uncut","diamond_cut",1350,(localize "STR_Process_Diamond")];};  
    	case "heroin": {["heroin_unprocessed","heroin_processed",1750,(localize "STR_Process_Heroin")];};  
    	case "copper": {["copper_unrefined","copper_refined",750,(localize "STR_Process_Copper")];};  
    	case "iron": {["iron_unrefined","iron_refined",1120,(localize "STR_Process_Iron")];};  
    	case "sand": {["sand","glass",650,(localize "STR_Process_Sand")];};  
    	case "salt": {["salt_unrefined","salt_refined",450,(localize "STR_Process_Salt")];};  
    	case "cocaine": {["cocaine_unprocessed","cocaine_processed",1500,(localize "STR_Process_Cocaine")];};  
    	case "marijuana": {["cannabis","marijuana",500,(localize "STR_Process_Marijuana")];};  
    	case "cement": {["rock","cement",350,(localize "STR_Process_Cement")];};  
    	case "meth": {["kitmeth","poudrehydroxyde",2500,"Traitement de la Meth",false];};  
            case "meth1": {["poudrehydroxyde","crystalmeth",2500,"Traitement de la Poudre Hydroxyde",false];};  
            case "meth2": {["crystalmeth","crystalmethpur",2500,"Purification Cristal de Meth",false];};  
    	case "cigarette": {["tabac","cigarette",1000,"Roulage de la cigarette",true, "papier"];};  
    	case "cigare": {["tabac","cigare", 3000, "Roulage des Cigares",true, "papier_cigare"];};  
    	case "batterie": {["acide","batterie", 3000, "Transformation de l'Acide",false];};  
    	case "ecran": {["glass","ecran", 3000, "Création d'écran de Téléphone",false];};  
    	case "telephone": {["batterie","telephone", 3000, "Assembler le Téléphone",true, "ecran"];};  
    	default {[];};  
    };  
    
    //Error checking  
    if(EQUAL(count _itemInfo,0)) exitWith {};  
    
    //Setup vars.  
    _oldItem = SEL(_itemInfo,0);  
    _newItem = SEL(_itemInfo,1);  
    _cost = SEL(_itemInfo,2);  
    _upp = SEL(_itemInfo,3);  
    _2var = [_itemInfo,4,false] call BIS_fnc_param;  
    _byproduct = [_itemInfo,6,"nil",[""]] call BIS_fnc_param;  
    if(!(_byproduct isEqualTo "nil")) then {  
    	_byproductName = M_CONFIG(getText,"VirtualItems",_byproduct,"displayName");  
    	_byproductMulti = [_itemInfo,7,0] call BIS_fnc_param;  
    };  
    
    if(_vendor in [mari_processor,coke_processor,heroin_processor]) then {  
    	_hasLicense = true;  
    } else {  
    	_hasLicense = LICENSE_VALUE(_type,"civ");  
    };  
    
    if(_type in ["meth","meth1","meth2"]) then {  
        _hasLicense = LICENSE_VALUE("meth","civ");  
    };  
    
    if(_type in ["ecran","batterie","telephone"]) then {  
        _hasLicense = LICENSE_VALUE("telephone","civ");  
    };  
    
    _itemName = M_CONFIG(getText,"VirtualItems",_newItem,"displayName");  
    _oldItemName = M_CONFIG(getText,"VirtualItems",_oldItem,"displayName");  
    _oldItemWeight = M_CONFIG(getNumber,"VirtualItems",_oldItem,"weight");  
    _newItemWeight = M_CONFIG(getNumber,"VirtualItems",_newItem,"weight");  
    _oldVal = ITEM_VALUE(_oldItem);  
    
    _cost = _cost * _oldVal;  
    //Some more checks  
    if(EQUAL(_oldVal,0)) exitWith {};  
    
    //Setup our progress bar.  
    disableSerialization;  
    5 cutRsc ["life_progress","PLAIN"];  
    _ui = GVAR_UINS "life_progress";  
    _progress = _ui displayCtrl 38201;  
    _pgText = _ui displayCtrl 38202;  
    _pgText ctrlSetText format["%2 (1%1)...","%",_upp];  
    _progress progressSetPosition 0.01;  
    _cP = 0.01;  
    
    life_is_processing = true;  
    
    if(_hasLicense) then {  
    	while{true} do {  
    		sleep  0.3;  
    		_cP = _cP + 0.01;  
    		_progress progressSetPosition _cP;  
    		_pgText ctrlSetText format["%3 (%1%2)...",round(_cP * 100),"%",_upp];  
    		if(_cP >= 1) exitWith {};  
    		if(player distance _vendor > 10) exitWith {};  
    	};  
    
    	if(player distance _vendor > 10) exitWith {hint localize "STR_Process_Stay"; 5 cutText ["","PLAIN"]; life_is_processing = false;};  
    	if(!([false,_oldItem,_oldVal] call life_fnc_handleInv)) exitWith {5 cutText ["","PLAIN"]; life_is_processing = false;};  
    	if(!([true,_newItem,_oldVal] call life_fnc_handleInv)) exitWith {5 cutText ["","PLAIN"]; [true,_oldItem,_oldVal] call life_fnc_handleInv; life_is_processing = false;};  
    	5 cutText ["","PLAIN"];  
    	titleText[format[localize "STR_Process_Processed",_oldVal,localize _itemName],"PLAIN"];  
    	life_is_processing = false;  
    } else {  
    	if(CASH < _cost) exitWith {hint format[localize "STR_Process_License",[_cost] call life_fnc_numberText]; 5 cutText ["","PLAIN"]; life_is_processing = false;};  
    
    	while{true} do {  
    		sleep  0.9;  
    		_cP = _cP + 0.01;  
    		_progress progressSetPosition _cP;  
    		_pgText ctrlSetText format["%3 (%1%2)...",round(_cP * 100),"%",_upp];  
    		if(_cP >= 1) exitWith {};  
    		if(player distance _vendor > 10) exitWith {};  
    	};  
    
    	if(player distance _vendor > 10) exitWith {hint localize "STR_Process_Stay"; 5 cutText ["","PLAIN"]; life_is_processing = false;};  
    	if(CASH < _cost) exitWith {hint format[localize "STR_Process_License",[_cost] call life_fnc_numberText]; 5 cutText ["","PLAIN"]; life_is_processing = false;};  
    	if(!([false,_oldItem,_oldVal] call life_fnc_handleInv)) exitWith {5 cutText ["","PLAIN"]; life_is_processing = false;};  
    	if(!([true,_newItem,_oldVal] call life_fnc_handleInv)) exitWith {5 cutText ["","PLAIN"]; [true,_oldItem,_oldVal] call life_fnc_handleInv; life_is_processing = false;};  
    	5 cutText ["","PLAIN"];  
    	titleText[format[localize "STR_Process_Processed2",_oldVal,localize _itemName,[_cost] call life_fnc_numberText],"PLAIN"];  
    	SUB(CASH,_cost);  
    	life_is_processing = false;  
    };  
    

    Merci d’avance !

  • @Charlie Requiem

    Ton ficher processAction.sqf ne correspond pas a celui du tuto, dans le tien tu déclares

    _2var = [_itemInfo,4,false] call BIS_fnc_param;  
    

    Mais tu ne t’en sert jamais après pour checker cette condition et supprimer en conséquence l’inventaire comme ceci

    //2vars  
    	if(_2var) then {  
    		([false,_oldItem2,_min] call life_fnc_handleInv);  
    
    

    Tu devrais reprendre le tuto :)

    Demain j'arrete !

    Retrouve moi sur GitHub

    > Celui qui veut monter tout en haut du cocotier
    > doit d'abord s'assurer d'avoir le cul propre.

  • @inoDB

    Merci pour ton commentaire je vais reprendre le tuto et je te dis !

  • J’ai réussi merci !

  • Yopp superbe tuto ! Et ducoup pour l’init du panneau du traitement, quel est-il svp ?

  • Salut @AC1D_R41NSuper TuTo

    il fonctionne mais quand je vais traiter avec ou sans licence le traitement est très long et ca me coute 1025 $ à la fin !

Messages 10Vues 2815
Se connecter pour répondre