Advertisement
Guest User

Untitled

a guest
May 26th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.67 KB | None | 0 0
  1. bb_hqmessage =
  2. {
  3. params ["_unit", "_txt", "_snd", "_time"];
  4.  
  5. _unit setRandomLip true;
  6. _strtxt = "";
  7. _ar = toArray _txt;
  8.  
  9. _rows = 1;
  10.  
  11. _lines = [];
  12. if (count _ar > 20) then
  13. {
  14. _dummy = [];
  15. {
  16. _dummy pushback _x;
  17. if (count _dummy > 20 && _x isEqualTo 32) then
  18. {
  19. _strtxt = _strtxt + "<t color=#000000 size=1 shadow=1 shadowColor='#000000' align='center' font='PuristaMedium'>" + toString _dummy + "</t><br/>";
  20. _lines pushback ("<t color=#000000 size=1 shadow=1 shadowColor='#000000' align='center' font='PuristaMedium'>" + toString _dummy + "</t><br/>");
  21. _dummy = [];
  22. _rows = _rows + 1;
  23. } else
  24. {
  25. if (_forEachIndex == (count _ar)-1) then
  26. {
  27. _strtxt = _strtxt + "<t color=#000000 size=1 shadow=1 shadowColor='#000000' align='center' font='PuristaMedium'>" + toString _dummy + "</t><br/>";
  28. _lines pushback ("<t color=#000000 size=1 shadow=1 shadowColor='#000000' align='center' font='PuristaMedium'>" + toString _dummy + "</t><br/>");
  29. _dummy = [];
  30. _rows = _rows + 1;
  31. };
  32. };
  33. } foreach _ar
  34. } else
  35. {
  36. _strtxt = "<t color=#000000 size=1 shadow=1 shadowColor='#000000' align='center' font='PuristaMedium'>" + _txt + "</t>";
  37. };
  38.  
  39. if (!isNil {uiNameSPace getVariable "bb_hqmessage"}) then
  40. {
  41. {
  42. ctrlDelete _x
  43. } foreach ((uiNameSPace getVariable "bb_hqmessage") select 0);
  44. terminate bb_hqmessage_script;
  45. camDestroy ((uiNameSPace getVariable "bb_hqmessage") select 1);
  46. };
  47.  
  48. playsound _snd;
  49.  
  50. _ctrls = [];
  51. _bg = findDisplay 46 ctrlCreate ["RscBackground", -1];
  52. _ctrls pushback _bg;
  53. _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)];
  54. _bg ctrlSetBackgroundColor [0,0,0,0.4];
  55. _bg ctrlCommit 0;
  56.  
  57. _screen = findDisplay 46 ctrlCreate ["RscPicture", -1];
  58. _ctrls pushback _screen;
  59. _screen ctrlSetPosition [safeZoneX + safeZoneW*0.01, safeZoneY + safeZoneW/safeZoneH * safeZoneW*0.01, safeZoneW*0.15, safeZoneH*0.15];
  60. _screen ctrlCommit 0;
  61.  
  62. _message = findDisplay 46 ctrlCreate ["RscStructuredText", -1];
  63. _ctrls pushback _message;
  64. _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)];
  65. _message ctrlCommit 0;
  66.  
  67. _cam = "camera" camcreate [0,0,0];
  68. _cam setPos (_unit modelToWorldVisual ((_unit selectionPosition ["head", "Memory"]) vectorAdd [0,0.2,0.1]));
  69.  
  70. _cam setVectorDirAndUp [(_unit modelToWorldVisual ((_unit selectionPosition ["head", "Memory"]) vectorAdd [0,0.2,0])) vectorFromTo (_unit modelToWorldVisual (_unit selectionPosition ["head", "Memory"])), vectorUp _unit];
  71.  
  72. _cam cameraEffect ["Internal", "Back", str time];
  73. _screen ctrlSetText "#(argb,512,512,1)r2t(" + (str time) + ",1)";
  74.  
  75. uiNameSpace setVariable ["bb_hqmessage", [_ctrls, _cam]];
  76.  
  77. bb_hqmessage_script = [_time, _unit, _lines, _message] spawn
  78. {
  79. params ["_time", "_unit", "_lines", "_message"];
  80.  
  81. _txt = "";
  82. _time = _time/(count _lines);
  83. {
  84. _txt = _txt + _x;
  85. _message ctrlSetStructuredText parseText _txt;
  86. _message ctrlCommit 0;
  87. sleep _time;
  88. } foreach _lines;
  89. sleep 3;
  90.  
  91. {
  92. ctrlDelete _x
  93. } foreach ((uiNameSPace getVariable "bb_hqmessage") select 0);
  94. camDestroy ((uiNameSPace getVariable "bb_hqmessage") select 1);
  95.  
  96. _unit setRandomLip false;
  97. };
  98. };
  99.  
  100.  
  101.  
  102. [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