Hey,
gibt es vielleicht eine Doku wie genau man den folgenden Code so einfügt, dass er auch funktioniert?
Daher einfach nur Copy Paste in etwa so aussieht:
Code
/*
* Author: br1zey/Ryu
* Special Thanks to ACE3 and Exile Team
* Draw progress bar and execute given function if succesful.
* Finish/Failure/Conditional are all passed [_args]
*
* Arguments:
* 0: NUMBER - Total Time (in game "time" seconds)
* 1: ARRAY - Arguments, passed to condition, fail and finish
* 2: CODE or STRING - On Finish: Code called or STRING raised as event.
* 3: CODE or STRING - On Failure: Code called or STRING raised as event.
* 4: STRING - (Optional) Localized Title
* 5: CODE - (Optional) Code to check each frame
* 6: ARRAY - (Optional) Animation to play , Animation playtime
*
*
* Return Value:
* Nothing
*
* Example:
*
* [5,[] {Hint "Finished!"}, {hint "Failure!"},"My Title", {true}, ["default",0]] spawn rl_fnc_progressBar
*
*/
private["_progress","_startTime","_sleepTime","_display","_label","_progressBarBackground","_progressBarMaxSize","_progressBar","_totalTime","_onFinish", "_onFail","_localizedTitle","_return","_condition","_lastAnimStart"];
disableSerialization;
params [
"_totalTime",
["_args",[]],
"_onFinish",
"_onFail",
["_localizedTitle", ""],
["_condition", {true}],
["_animArr",[],[["default",0]]]
];
_progress = 0;
_startTime = diag_tickTime;
_sleepTime = _totalTime / 100;
_defaultVehicle = (vehicle player);
//close all Dialogs
closeDialog 0;
("RLActionProgressLayer" call BIS_fnc_rscLayer) cutRsc ["RscRLActionProgress", "PLAIN", 1, false];
createDialog "ProgressBar_Dialog";
private _anim = (_animArr select 0);
private _animTime = (_animArr select 1);
if(_anim isEqualTo "default")then{
_anim = "AinvPknlMstpSnonWnonDnon_medic_1";
_animTime = 5.882;
};
if(! (_anim isEqualTo ""))then{
[player,_anim,true] remoteExecCall ["life_fnc_animSync",-2];
player switchMove _anim;
player playMoveNow _anim;
};
private _lastAnimStart = time;
_display = uiNamespace getVariable "RscRLActionProgress";
_label = _display displayCtrl 4002;
_label ctrlSetText format ["0% - %1",_localizedTitle];
_progressBarBackground = _display displayCtrl 4001;
_progressBarBackground ctrlSetBackgroundColor [0, 0, 0, 0.5];
_progressBarMaxSize = ctrlPosition _progressBarBackground;
_progressBar = _display displayCtrl 4000;
_progressBar ctrlSetPosition [_progressBarMaxSize select 0, _progressBarMaxSize select 1, 0, _progressBarMaxSize select 3-0.01];
_progressBar ctrlSetBackgroundColor [0, 0.5, 1, 1];
_progressBar ctrlCommit 0;
_progressBar ctrlSetPosition _progressBarMaxSize;
_progressBar ctrlCommit _totalTime;
try
{
while {_progress < 1} do{
if !(alive player) then{
throw false;
};
if !(dialog) then{
throw false;
};
if (!([_args,(time - _startTime),_totalTime] call _condition)) then {
throw false;
};
if(! (_anim isEqualTo "") && time >= (_lastAnimStart + _animTime))then{
[player,_anim,true] remoteExecCall ["life_fnc_animSync",-2];
player switchMove _anim;
player playMoveNow _anim;
};
uiSleep _sleepTime;
_progress = ((diag_tickTime - _startTime) / _totalTime) min 1;
_label ctrlSetText format["%1%2 - %3", round (_progress * 100), "%",_localizedTitle];
};
throw true;
}
catch
{
_progressBarColor = [];
if(_exception) then {
_args call _onFinish;
_return = true;
_progressBarColor = [0.7, 0.93, 0, 1];
}else{
_args call _onFail;
_return = false;
_progressBarColor = [0.91, 0, 0, 1];
};
_progressBar ctrlSetBackgroundColor _progressBarColor;
_progressBar ctrlSetPosition _progressBarMaxSize;
_progressBar ctrlCommit 0;
};
("RLActionProgressLayer" call BIS_fnc_rscLayer) cutFadeOut 2;
closeDialog 24025;
Alles anzeigen