Advertisement
Brenner650

@FuMS\addons\FuMS\HC\MsnCtrl\SpawnSpawnNotifications.sqf

Sep 22nd, 2018
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.13 KB | None | 0 0
  1. // SpawnNotifications.sqf
  2. // Horbin
  3. // 1/4/15
  4. // INPUTS: Mission Marker data, Mission notifications, mission status
  5. // OUTPUTS: None
  6. //RadioChatter = compile preprocessFileLineNumbers "HC\Encounters\Functions\RadioChatter.sqf";
  7. private ["_markers","_notifications","_msnStatus","_mkr1","_mkr2","_eCenter","_notify","_showMap","_delay",
  8. "_msnSuccessText","_msnStartText","_msnFailureText","_ogjstr","_msnText","_options","_winDelay","_loseDelay",
  9. "_radionotify","_radiochannel","_radiorange","_missionNameOverride","_msnStatus_status"];
  10. _markers = _this select 0;
  11. _notifications = _this select 1;
  12. _msnStatus = _this select 2;
  13. _mkr1 = _this select 3;
  14. _mkr2 = _this select 4;
  15. _eCenter = _this select 5;
  16. _missionNameOverride = _this select 6;
  17. _options = _notifications select 0;
  18. _msnStartText = _notifications select 1;
  19. _msnSuccessText =_notifications select 2;
  20. _msnFailureText = _notifications select 3;
  21. _radionotify = _options select 0;
  22. _delay = 0;
  23. _msnText = "";
  24.  
  25. _msnStatus_status = _msnStatus select 0;
  26.  
  27. _radiochannel = _options select 1;
  28. if (isNil "_radiochannel") then {_radiochannel = "ALL";};
  29.  
  30. _radiorange = _options select 2;
  31. _notify = _options select 3;
  32. _showMap = _options select 4;
  33. _winDelay = _options select 5;
  34. _loseDelay = _options select 6;
  35. if (isNil "_winDelay") then {_winDelay = 0;};
  36. if (isNil "_loseDelay") then {_loseDelay = 0;};
  37. switch (_msnStatus_status) do
  38. {
  39. case "STATIC":
  40. {
  41. _msnText = _msnStartText;
  42. _delay = 0;
  43. };
  44. case "WIN":
  45. {
  46. _msnText = _msnSuccessText;
  47. _delay = _winDelay;
  48. };
  49. case "LOSE":
  50. {
  51. _msnText = _msnFailureText;
  52. _delay = _loseDelay;
  53. };
  54. };
  55. // Notify the world of the event, if desired
  56. /*
  57. if (_radionotify) then
  58. {
  59. if (!isnil "_msnText") then
  60. {
  61. // right now, do not care if radio msg heard!
  62. if (count _msnText > 0 ) then // something in file to transmit.
  63. {
  64. [_msnText select 2, _radiochannel, _radiorange, _eCenter] call FuMS_fnc_HC_AI_RC_RadioChatter;
  65. };
  66. };
  67. }; */
  68. if (_notify) then
  69. {
  70. if (!isnil "_msnText") then
  71. {
  72. _ogjstr = "";
  73. if (count _msnText >0) then {_ogjstr = format ["<t align='center' size='2.0' color='#f29420'>%1</t>",_msnText select 0];};
  74. if (count _msnText >1) then {_ogjstr = format ["%1<br /><t size='1.10' color='#f22b20'>%2</t>",_ogjstr,_msnText select 1];};
  75. _ogjstr = format ["%1<br />__________", _ogjstr];
  76. if (count _msnText >2) then {_ogjstr = format["%1<br /><t size='1.25' color='#ffff00'>%2</t>",_ogjstr, _msnText select 2];};
  77. FuMS_GlobalHint = _ogjstr;
  78. publicVariable "FuMS_GlobalHint";
  79. format["%1: %2",toUpper (_msnText select 0),(_msnText select 2)] remoteExecCall ["systemChat",-2]; // 1.0.4 notification fix
  80. };
  81. };
  82. if (_showMap) then
  83. {
  84. if (_msnStatus_status == "WIN" or _msnStatus_status == "LOSE") then
  85. {
  86. if (_msnStatus_status == "WIN") then {_mkr1 setMarkerColor "ColorGreen";}
  87. else {_mkr1 setMarkerColor "ColorBlack";};
  88. //publicVariable _mkr1;
  89. //leave green circle up for 'delay' secs, then remove markers
  90. //diag_log format ["##Spawn Notification: _msnStatus:%1 _delay:%2", _msnStatus, _delay];
  91. sleep _delay;
  92. _mkr1 setMarkerAlpha 0;
  93. _mkr2 setMarkerAlpha 0;
  94. _mkr2 setMarkerText "";
  95. publicVariable _mkr1;
  96. publicVariable _mkr2;
  97.  
  98. ["Markers",_mkr1] call FuMS_fnc_HC_Util_HC_RemoveObject;
  99. ["Markers",_mkr2] call FuMS_fnc_HC_Util_HC_RemoveObject;
  100.  
  101. };
  102. if (_msnStatus_status == "STATIC") then
  103. {
  104. // diag_log format ["##%1 starting at %2##", _mkr1, _eCenter];
  105. //AI Operational Area
  106. _mkr1 setMarkerPos _eCenter;
  107. //_mkr1 setMarkerType (_markers select 1);
  108. _mkr1 setMarkerShape (_markers select 2);
  109. _mkr1 setMarkerSize [_markers select 5, _markers select 5];
  110. _mkr1 setMarkerColor (_markers select 3);
  111. _mkr1 setMarkerAlpha 1;
  112. _mkr1 setMarkerBrush (_markers select 4);
  113. //_mkr1 setMarkerText (_markers select 0);
  114. publicVariable _mkr1;
  115.  
  116. _mkr2 setMarkerPos _eCenter;
  117. _mkr2 setMarkerAlpha 1;
  118. _mkr2 setMarkerType (_markers select 1);
  119.  
  120. if ( count _missionNameOverride > 0) then
  121. {
  122. // diag_log format ["##SpawnNotifications : override mission %2 name to %1",_missionNameOverride, _markers select 0];
  123. _mkr2 setMarkerText format[" %1",_missionNameOverride];
  124. }
  125. else { _mkr2 setMarkerText format[" %1",(_markers select 0)];};
  126. _mkr2 setMarkerColor (_markers select 3);
  127. publicVariable _mkr2;
  128. ["Markers",_mkr1] call FuMS_fnc_HC_Util_HC_AddObject;
  129. ["Markers",_mkr2] call FuMS_fnc_HC_Util_HC_AddObject;
  130.  
  131. };
  132. }else {_delay;}; // delay here if no map marker was used!
  133. // Note: This delay will suspend mission cleanup of AI, buildings, and ai occupied vehicles until it the delay expires.
  134. // below return value no longer utilized!
  135. //_delay
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement