Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bb_hqmessage =
- {
- params ["_unit", "_txt", "_snd", "_time"];
- _unit setRandomLip true;
- _strtxt = "";
- _ar = toArray _txt;
- _rows = 1;
- _lines = [];
- if (count _ar > 20) then
- {
- _dummy = [];
- {
- _dummy pushback _x;
- if (count _dummy > 20 && _x isEqualTo 32) then
- {
- _strtxt = _strtxt + "<t color=#000000 size=1 shadow=1 shadowColor='#000000' align='center' font='PuristaMedium'>" + toString _dummy + "</t><br/>";
- _lines pushback ("<t color=#000000 size=1 shadow=1 shadowColor='#000000' align='center' font='PuristaMedium'>" + toString _dummy + "</t><br/>");
- _dummy = [];
- _rows = _rows + 1;
- } else
- {
- if (_forEachIndex == (count _ar)-1) then
- {
- _strtxt = _strtxt + "<t color=#000000 size=1 shadow=1 shadowColor='#000000' align='center' font='PuristaMedium'>" + toString _dummy + "</t><br/>";
- _lines pushback ("<t color=#000000 size=1 shadow=1 shadowColor='#000000' align='center' font='PuristaMedium'>" + toString _dummy + "</t><br/>");
- _dummy = [];
- _rows = _rows + 1;
- };
- };
- } foreach _ar
- } else
- {
- _strtxt = "<t color=#000000 size=1 shadow=1 shadowColor='#000000' align='center' font='PuristaMedium'>" + _txt + "</t>";
- };
- if (!isNil {uiNameSPace getVariable "bb_hqmessage"}) then
- {
- {
- ctrlDelete _x
- } foreach ((uiNameSPace getVariable "bb_hqmessage") select 0);
- terminate bb_hqmessage_script;
- camDestroy ((uiNameSPace getVariable "bb_hqmessage") select 1);
- };
- playsound _snd;
- _ctrls = [];
- _bg = findDisplay 46 ctrlCreate ["RscBackground", -1];
- _ctrls pushback _bg;
- _bg ctrlSetPosition [safeZoneX, safeZoneY, safeZoneW*0.15 + (safeZoneW*0.01)*2, safeZoneH*0.15 + (safeZoneW/safeZoneH * safeZoneW*0.01)*2 + ((safeZoneH*0.15 + (safeZoneW/safeZoneH * safeZoneW*0.01)*2)/8*_rows)];
- _bg ctrlSetBackgroundColor [0,0,0,0.4];
- _bg ctrlCommit 0;
- _screen = findDisplay 46 ctrlCreate ["RscPicture", -1];
- _ctrls pushback _screen;
- _screen ctrlSetPosition [safeZoneX + safeZoneW*0.01, safeZoneY + safeZoneW/safeZoneH * safeZoneW*0.01, safeZoneW*0.15, safeZoneH*0.15];
- _screen ctrlCommit 0;
- _message = findDisplay 46 ctrlCreate ["RscStructuredText", -1];
- _ctrls pushback _message;
- _message ctrlSetPosition [safeZoneX, safeZoneY + (safeZoneH*0.15 + (safeZoneW/safeZoneH * safeZoneW*0.01)*2), safeZoneW*0.15 + (safeZoneW*0.01)*2, ((safeZoneH*0.15 + (safeZoneW/safeZoneH * safeZoneW*0.01)*2)/8*_rows)];
- _message ctrlCommit 0;
- _cam = "camera" camcreate [0,0,0];
- _cam setPos (_unit modelToWorldVisual ((_unit selectionPosition ["head", "Memory"]) vectorAdd [0,0.2,0.1]));
- _cam setVectorDirAndUp [(_unit modelToWorldVisual ((_unit selectionPosition ["head", "Memory"]) vectorAdd [0,0.2,0])) vectorFromTo (_unit modelToWorldVisual (_unit selectionPosition ["head", "Memory"])), vectorUp _unit];
- _cam cameraEffect ["Internal", "Back", str time];
- _screen ctrlSetText "#(argb,512,512,1)r2t(" + (str time) + ",1)";
- uiNameSpace setVariable ["bb_hqmessage", [_ctrls, _cam]];
- bb_hqmessage_script = [_time, _unit, _lines, _message] spawn
- {
- params ["_time", "_unit", "_lines", "_message"];
- _txt = "";
- _time = _time/(count _lines);
- {
- _txt = _txt + _x;
- _message ctrlSetStructuredText parseText _txt;
- _message ctrlCommit 0;
- sleep _time;
- } foreach _lines;
- sleep 3;
- {
- ctrlDelete _x
- } foreach ((uiNameSPace getVariable "bb_hqmessage") select 0);
- camDestroy ((uiNameSPace getVariable "bb_hqmessage") select 1);
- _unit setRandomLip false;
- };
- };
- [bb_general, "Alright guys. The Director will be driving through the cemetery shortly. Get into position for Ambush. Remember he'll be in a black SUV.", "", 10] call bb_hqmessage;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement