Servus Leute.
Hier mal eine fn_processAction von mir. Ihr habt eine Zeit Pro Item + Abfrage für einen Skill von Maverick.
Ja mehr gibt es da nicht zu sagen
Bei Verbesserungen bitte melden.
Kann auch leider keine Commands in das Script machen oder schritt für schritt Anleitung weil ich einiges verändert habe.
Hier ein Config Beispiel
Spoiler anzeigen
Die Zeit ist hier die Zeit Pro Item in Sekunden. Das heißt Pro Item benötigt ihr hier 8 Sekunden.
fn_processAction.sqf
Spoiler anzeigen
Code
#include "..\..\script_macros.hpp"
/*
File: fn_processAction.sqf
Author: Bryan "Tonic" Boardwine
Modified : NiiRoZz
rewriten by Risk
Description:
Master handling for processing an item.
NiiRoZz : Added multiprocess
*/
params[
["_vendor", objNull, [objNull]],
"",
"",
["_type", "", [""]]
];
//Error check
if (isNull _vendor || _type isEqualTo "" || (player distance _vendor > 10)) exitWith {};
life_action_inUse = true; //Lock out other actions during processing.
private _materialsRequired = M_CONFIG(getArray, "ProcessAction", _type, "MaterialsReq");
private _materialsGiven = M_CONFIG(getArray, "ProcessAction", _type, "MaterialsGive");
private _processTime = M_CONFIG(getNumber, "ProcessAction", _type, "time");
private _neededLicense = M_CONFIG(getText, "ProcessAction", _type, "benoetigteLizenz");
private _text = M_CONFIG(getText, "ProcessAction", _type, "Text");
//private _xpToAdd = M_CONFIG(getNumber, "ProcessAction", _type, "XPtoAdd");
private _noLicenseCost = M_CONFIG(getNumber, "ProcessAction", _type, "noLicenseCost");
_processTime = _processTime - missionNamespace["mav_ttm_var_processMultiplier",0];
if(isLocalized _text) then{
_text = localize _text;
}else{
diag_log format["::::processAction - %1[TYPE:%2] wurde nicht localized", _text, _type];
diag_log format["::::processAction - %1[TYPE:%2] wurde nicht localized", _text, _type];
diag_log format["::::processAction - %1[TYPE:%2] wurde nicht localized", _text, _type];
};
private _itemInfo = [_materialsRequired, _materialsGiven, format ["%1", _text]];
if (count _itemInfo isEqualTo 0) exitWith {
life_action_inUse = false;
};
//Setup vars.
_itemInfo params[
"_oldItem",
"_newItem",
"_upp"
];
_exit = false;
if (count _oldItem isEqualTo 0) exitWith {
life_action_inUse = false;
};
if !(getText(missionConfigFile >> "ProcessAction" >> _type >> "skill") isEqualTo "NONE" OR [life_currentExpPerks, getText(missionConfigFile >> "ProcessAction" >> _type >> "skill")] call mav_ttm_fnc_hasPerk) exitWith{
hint format["Du benötigst den %1 Skill um hier zu verarbeiten!", getText(missionConfigFile >> "Maverick_TTM" >> "perks" >> getText(missionConfigFile >> "ProcessAction" >> _type >> "skill") >> "displayName")];
life_action_inUse = false;
life_is_processing = false;
};
private _totalConversions = [];
{
_var = ITEM_VALUE(_x select 0);
if (_var isEqualTo 0) exitWith {
_exit = true;
};
if (_var < (_x select 1)) exitWith {
_exit = true;
};
_totalConversions pushBack(floor(_var / (_x select 1)));
} forEach _oldItem;
//private _xpToAddEnd = format["ItemProcessed_%1", _xpToAdd];
if (_exit) exitWith {
life_is_processing = false;
hint "Es gibt nicht's (nicht's mehr) zum verarbeiten!";
life_action_inUse = false;
};
private _hasLicense = false;
_hasLicense = LICENSE_VALUE(_neededLicense, "civ");
private _minimumConversions = _totalConversions call BIS_fnc_lowestNum;
private _oldItemWeight = 0;
{
_weight = ([_x select 0] call life_fnc_itemWeight) * (_x select 1);
_oldItemWeight = _oldItemWeight + _weight;
}count _oldItem;
_newItemWeight = 0;
{
_weight = ([_x select 0] call life_fnc_itemWeight) * (_x select 1);
_newItemWeight = _newItemWeight + _weight;
} count _newItem;
_exit = false;
if (_newItemWeight > _oldItemWeight) then {
_netChange = _newItemWeight - _oldItemWeight;
_freeSpace = life_maxWeight - life_carryWeight;
if (_freeSpace < _netChange) exitWith {
_exit = true;
};
private _estConversions = floor(_freeSpace / _netChange);
if (_estConversions < _minimumConversions) then {
_minimumConversions = _estConversions;
};
};
if (!_hasLicense) then {
private _licenseText = M_CONFIG(getText, "Licenses", _neededLicense, "displayName");
private _action = [
format["Dir fehlt die %1, willst du trotzdem verarbeiten? Es würde dich %2 %3 kosten.", localize _licenseText, _noLicenseCost, (localize "STR_Item_Money")],
format["%1", _text],
localize "STR_Global_Yes",
localize "STR_Global_No"
] call BIS_fnc_guiMessage;
if (_action) then {
if (CASH < _noLicenseCost) then {
hint "Du hast leider nicht genug Geld dabei!";
_exit = true;
}else{
CASH = CASH - _noLicenseCost;
_hasLicense = true;
};
}else{
_exit = true;
};
};
if (_exit) exitWith {
life_is_processing = false;
life_action_inUse = false;
};
//Setup our progress bar.
disableSerialization;
"progressBar" cutRsc ["life_progress", "PLAIN", 2, false];
private _ui = uiNamespace getVariable "life_progress";
private _progress = _ui displayCtrl 38201;
private _pgText = _ui displayCtrl 38202;
_pgText ctrlSetText format["%1", _upp];
_progress progressSetPosition 0.01;
private _cP = 0.01;
_dauerInSek = 0;
private _processRuns = 0;
{
_dauerInSek = (_x select 1) * _minimumConversions;
} count _newItem;
_dauerInSek = _dauerInSek * _processTime;
private _anzahlPausen = _dauerInSek / 0.1;
private _fortschrittProIntervall = 1.10 / _anzahlPausen;
if _hasLicense then {
life_is_processing = true;
};
if (!life_is_processing) exitWith {
hint "verarbeiten abgebrochen!";
"progressBar" cutText ["", "PLAIN"];
life_is_processing = false;
life_action_inUse = false;
};
for "_i" from 0 to 1 step 0 do {
uiSleep 0.1;
_cP = _cP + _fortschrittProIntervall;
_progress progressSetPosition _cP;
_pgText ctrlSetText format["%1", _upp];
if (_cP >= 1) exitWith {};
if (player distance _vendor > 10) exitWith {
hint localize "STR_Process_Stay";
"progressBar" cutText ["", "PLAIN"];
life_is_processing = false;
life_action_inUse = false;
};
};
if (player distance _vendor > 10) exitWith {
hint localize "STR_Process_Stay";
"progressBar" cutText ["", "PLAIN"];
life_is_processing = false;
life_action_inUse = false;
};
{
[false,(_x select 0),((_x select 1)*(_minimumConversions))] call life_fnc_handleInv;
} count _oldItem;
{
[true,(_x select 0),((_x select 1)*(_minimumConversions))] call life_fnc_handleInv;
} count _newItem;
"progressBar" cutText ["", "PLAIN"];
player playMoveNow "Stand";
life_is_processing = false;
life_action_inUse = false;
//[_xpToAddEnd] spawn mav_ttm_fnc_addExp;
Alles anzeigen
Wenn ihr script Ideen habt lasst es mich wissen. Ich werde diese dann immer im Stream mit euch umsetzten.