Mizzu

live\client\scripts\message.cs

Aug 18th, 2013
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.21 KB | None | 0 0
  1. /*
  2. Fallen Empire: Legions
  3. Copyright (C) GarageGames.com, Inc.
  4. */
  5.  
  6. function Message::initialize( )
  7. {
  8. addMessageCallback("", defaultMessageCallback);
  9. }
  10.  
  11. function Message::deinitialize( )
  12. {
  13. deleteVariables("$MessageCallback*");
  14. }
  15.  
  16. function clientCmdServerMessage( %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13 )
  17. {
  18. %msgType = detag(%msgType);
  19. for (%i = 0; (%func = $MessageCallback["", %i]) !$= ""; %i++)
  20. call(%func, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13);
  21.  
  22. for (%i = 0; (%func = $MessageCallback[%msgType, %i]) !$= ""; %i++)
  23. call(%func, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13);
  24. }
  25.  
  26. function addMessageCallback( %msgType, %function )
  27. {
  28. for (%i = 0; (%func = $MessageCallback[%msgType, %i]) !$= ""; %i++)
  29. {
  30. if (%func $= %function)
  31. return;
  32. }
  33.  
  34. $MessageCallback[%msgType, %i] = %function;
  35. }
  36.  
  37. function defaultMessageCallback( %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9 )
  38. {
  39. if (%msgString $= "")
  40. return;
  41.  
  42. %message = detag(%msgString);
  43. %tag = getSubStr(%message, 0, 2);
  44. %message = getSubStr(%message, 2, 1000);
  45. %message = replaceTeamStrings(%message);
  46.  
  47. switch$ (%tag)
  48. {
  49. case "~c":
  50. if (%message !$= "")
  51. AddChatMessage(%message);
  52. case "~g":
  53. if (%message !$= "")
  54. AddGameMessage(%message);
  55. case "~s":
  56. if (%message !$= "")
  57. {
  58. sfxPlayOnce(AudioChat, %message);
  59. }
  60. }
  61. }
  62.  
  63. addMessageCallback("QuickChatMessage", handleMsgQuickChat);
  64. function handleMsgQuickChat( %msgType, %taggedOutput, %sender, %taggedMessage, %taggedVoice, %taggedSound) {
  65.  
  66. %voiceId = detag(%taggedVoice);
  67. %sound = detag(%taggedSound);
  68.  
  69. // play sounds based on settings
  70. if($Pref::Player::QuickChatSoundSetting == 1
  71. || ($Pref::Player::QuickChatSoundSetting == 2 && %teamOnly))
  72. {
  73. QuickChatManager.playMessageVoice(%sender, %voiceId, %sound);
  74. }
  75. }
  76.  
  77. addMessageCallback("MsgGameStart", handleMsgGameStart);
  78. function handleMsgGameStart( %msgType )
  79. {
  80. sfxPlayOnce(CtfGameStartEnd);
  81. }
  82.  
  83. addMessageCallback("MsgPlayerKilled", handleMsgPlayerKilled);
  84. function handleMsgPlayerKilled( %msgType )
  85. {
  86. $PlayerGotFlag = false;
  87. $PlayerIsAlive = false;
  88. stopOverdriveRinging();
  89. if ($spawnSelectEnabled)
  90. SpawnSelect.open();
  91. }
  92.  
  93. addMessageCallback("MsgPracticeStart", handleMsgPracticeStart);
  94. function handleMsgPracticeStart( %msgType )
  95. {
  96. clientCmdCenterPrint("\c4The Game Will Begin When There Are Enough Players", -1);
  97. }
  98.  
  99. addMessageCallback("MsgPracticeEnd", handleMsgEndPractice);
  100. function handleMsgEndPractice( %msgType )
  101. {
  102. clientCmdCenterPrint("", -1);
  103. }
  104.  
  105. addMessageCallback("MsgTimeRemaining", handleMsgTimeRemaining);
  106. function handleMsgTimeRemaining( %msgType, %msgString, %timeLeftMs, %timeLeft, %unit, %mode )
  107. {
  108. HudOverlay.setClockTimeRemaining(%timeLeftMs, %mode);
  109.  
  110. if (%timeLeft $= "" || %unit $= "")
  111. return;
  112.  
  113. %message = "";
  114. switch$ (%mode)
  115. {
  116. case "Pregame":
  117. %message = "Game Starts In "@%timeLeft SPC %unit;
  118. case "Game":
  119. %message = "Game Ends In "@%timeLeft SPC %unit;
  120. case "Overtime":
  121. %message = "Overtime Ends In "@%timeLeft SPC %unit;
  122. default:
  123. return;
  124. }
  125.  
  126. sfxPlayOnce(CtfLowTimeWarning);
  127. clientCmdTopPrint(%message, 2000, 1);
  128. }
  129.  
  130. function clientCmdReconnect()
  131. {
  132.  
  133. if(Serverconnection.getIP() !$= "127.0.0.1" && $Pref::Demos::Reconnect == 1)
  134. {
  135. schedule(1500,0,"reconnectLast");
  136. }
  137.  
  138. }
  139.  
  140. function reconnectLast()
  141. {
  142. if(Client::leaveServer())
  143. client::joinserver($ServerInfo::Address);
  144. //gameconnection.connect($lastAddress);
  145. }
  146.  
  147. addMessageCallback("MsgEnableRespawn", handleMsgEnableRespawn);
  148. function handleMsgEnableRespawn( %msgType )
  149. {
  150. clientCmdBottomPrint("Press FIRE to respawn", 2000, 1);
  151. }
  152.  
  153. addMessageCallback("MsgRespawned", handleMsgRespawned);
  154. function handleMsgRespawned( %msgType )
  155. {
  156. clientCmdBottomPrint("", 0, 1);
  157. $PlayerIsAlive = true;
  158. $PlayerGotFlag = false;
  159. }
  160.  
  161. addMessageCallback("MsgAnnounceTeamWinner", handleMsgAnnounceTeamWinner);
  162. function handleMsgAnnounceTeamWinner( %msgType, %msgString, %team0, %score0, %team1, %score1 )
  163. {
  164. %winner = "";
  165. %winnerScore = 0;
  166. %loserScore = 0;
  167.  
  168. sfxPlayOnce(CtfGameStartEnd);
  169. if (%score0 == %score1)
  170. {
  171. clientCmdTopPrint("Game Ended In A Tie At "@%score0, 2000);
  172. }
  173. else
  174. {
  175. if (%score0 > %score1)
  176. {
  177. %winner = %team0;
  178. %winnerScore = %score0;
  179. %loserScore = %score1;
  180. }
  181. else
  182. {
  183. %winner = %team1;
  184. %winnerScore = %score1;
  185. %loserScore = %score0;
  186. }
  187. clientCmdCenterPrint(%winner SPC "Won" SPC %winnerScore SPC "To" SPC %loserScore, -1);
  188. }
  189. }
  190.  
  191. addMessageCallback("MsgCtfOdGrab", handleMsgCtfOdGrab);
  192. function handleMsgCtfOdGrab( %msgType, %msgString, %team, %client, %flagTeam )
  193. {
  194. %client = replaceTeamStrings(detag(%client));
  195. %team = replaceTeamStrings(detag(%team));
  196.  
  197. if (%flagTeam == $CurrentTeam)
  198. sfxPlayOnce(CtfFriendlyFlagTakenSound);
  199. else
  200. sfxPlayonce(CtfEnemyFlagTakenSound);
  201. clientCmdTopPrint(%team@" Flag Was \cp\c5\OD Grabbed\co By "@%client, 2000, 1);
  202. }
  203.  
  204. addMessageCallback("MsgCtfLlamaGrab", handleMsgCtfLlamaGrab);
  205. function handleMsgCtfLlamaGrab( %msgType, %msgString, %team, %client, %speed, %flagTeam )
  206. {
  207. %client = replaceTeamStrings(detag(%client));
  208. %team = replaceTeamStrings(detag(%team));
  209.  
  210. if (%flagTeam == $CurrentTeam)
  211. sfxPlayOnce(CtfFriendlyFlagTakenSound);
  212. else
  213. sfxPlayonce(CtfEnemyFlagTakenSound);
  214. clientCmdTopPrint(%team@" Flag Was \cp\c5\Llama'd\co By "@%client, 2000, 1);
  215. }
  216.  
  217. addMessageCallback("MsgCtfFlagGrab", handleMsgCtfFlagGrab);
  218. function handleMsgCtfFlagGrab( %msgType, %msgString, %team, %client, %speed, %flagTeam )
  219. {
  220. %client = replaceTeamStrings(detag(%client));
  221. %team = replaceTeamStrings(detag(%team));
  222.  
  223. if (%flagTeam == $CurrentTeam)
  224. sfxPlayOnce(CtfFriendlyFlagTakenSound);
  225. else
  226. sfxPlayonce(CtfEnemyFlagTakenSound);
  227. clientCmdTopPrint(%team@" Flag Was \cp\c5\Grabbed\co By "@%client, 2000, 1);
  228. }
  229.  
  230. addMessageCallback("MsgCtfFlagCatch", handleMsgCtfFlagCatch);
  231. function handleMsgCtfFlagCatch( %msgType, %msgString, %team, %client, %speed, %flagTeam )
  232. {
  233. %client = replaceTeamStrings(detag(%client));
  234. %team = replaceTeamStrings(detag(%team));
  235.  
  236. if (%flagTeam == $CurrentTeam)
  237. sfxPlayOnce(CtfFriendlyFlagTakenSound);
  238. else
  239. sfxPlayonce(CtfEnemyFlagTakenSound);
  240. clientCmdTopPrint(%team@" Flag Was \cp\c5\Caught\co By "@%client, 2000, 1);
  241. }
  242.  
  243. addMessageCallback("MsgCtfFlagPickup", handleMsgCtfFlagPickup);
  244. function handleMsgCtfFlagPickup( %msgType, %msgString, %team, %client, %speed, %flagTeam )
  245. {
  246. %client = replaceTeamStrings(detag(%client));
  247. %team = replaceTeamStrings(detag(%team));
  248.  
  249. if (%flagTeam == $CurrentTeam)
  250. sfxPlayOnce(CtfFriendlyFlagTakenSound);
  251. else
  252. sfxPlayonce(CtfEnemyFlagTakenSound);
  253. clientCmdTopPrint(%team@" Flag Was \cp\c5\Picked Up\co By "@%client, 2000, 1);
  254. }
  255.  
  256. addMessageCallback("MsgCtfFlagThrow", handleMsgCtfFlagThrow);
  257. function handleMsgCtfFlagThrow( %msgType, %msgString, %team, %client, %held, %flagTeam )
  258. {
  259. %client = replaceTeamStrings(detag(%client));
  260. %team = replaceTeamStrings(detag(%team));
  261.  
  262. clientCmdTopPrint(%team@" Flag Was \cp\c5\Thrown\co By "@%client, 2000, 1);
  263. }
  264.  
  265. addMessageCallback("MsgCtfFlagDrop", handleMsgCtfFlagDrop);
  266. function handleMsgCtfFlagDrop( %msgType, %msgString, %team, %client, %held, %flagTeam )
  267. {
  268. %client = replaceTeamStrings(detag(%client));
  269. %team = replaceTeamStrings(detag(%team));
  270.  
  271. clientCmdTopPrint(%team@" Flag Was \cp\c5\Dropped\co By "@%client, 2000, 1);
  272. }
  273.  
  274. addMessageCallback("MsgCtfFlagReturn", handleMsgCtfFlagReturn);
  275. function handleMsgCtfFlagReturn( %msgType, %msgString, %team, %client, %speed, %height, %flagTeam )
  276. {
  277. %client = replaceTeamStrings(detag(%client));
  278. %team = replaceTeamStrings(detag(%team));
  279.  
  280. sfxPlayOnce(CtfFlagReturnedSound);
  281. if (%client !$= "0")
  282. clientCmdTopPrint(%team@" Flag Was \cp\c5\Returned\co By "@%client, 2000, 1);
  283. else
  284. clientCmdTopPrint(%team@" Flag Was Returned", 2000, 1);
  285. }
  286.  
  287. addMessageCallback("MsgCtfFlagCap", handleMsgCtfFlagCap);
  288. function handleMsgCtfFlagCap( %msgType, %msgString, %team, %client, %held, %flagTeam )
  289. {
  290. %client = replaceTeamStrings(detag(%client));
  291. %team = replaceTeamStrings(detag(%team));
  292.  
  293. sfxPlayOnce(CtfFlagCaptureSound);
  294. clientCmdTopPrint(%team@" Flag Was \cp\c5\Captured\co By "@%client, 2000, 1);
  295. }
  296.  
  297. /***********
  298. * RABBIT *
  299. ***********/
  300.  
  301. addMessageCallback("MsgRabbitFlagGrab", handleMsgRabbitFlagGrab);
  302. function handleMsgRabbitFlagGrab( %msgType, %msgString, %client, %speed, %flagTeam )
  303. {
  304. %client = replaceTeamStrings(detag(%client));
  305. %team = replaceTeamStrings(detag(%team));
  306.  
  307. sfxPlayOnce(CtfFlagTakenSound);
  308. clientCmdTopPrint("The Flag Was \cp\c5\Grabbed\co By "@%client, 2000, 1);
  309. }
  310.  
  311. addMessageCallback("MsgRabbitFlagCatch", handleMsgRabbitFlagCatch);
  312. function handleMsgRabbitFlagPickup( %msgType, %msgString, %client, %speed, %flagTeam )
  313. {
  314. %client = replaceTeamStrings(detag(%client));
  315. %team = replaceTeamStrings(detag(%team));
  316.  
  317. sfxPlayOnce(CtfFlagTakenSound);
  318. clientCmdTopPrint("The Flag Was \cp\c5\Caught\co By "@%client, 2000, 1);
  319. }
  320.  
  321. addMessageCallback("MsgRabbitFlagPickup", handleMsgRabbitFlagPickup);
  322. function handleMsgRabbitFlagPickup( %msgType, %msgString, %client, %speed, %flagTeam )
  323. {
  324. %client = replaceTeamStrings(detag(%client));
  325. %team = replaceTeamStrings(detag(%team));
  326.  
  327. sfxPlayOnce(CtfFlagTakenSound);
  328. clientCmdTopPrint("The Flag Was \cp\c5\Picked Up\co By "@%client, 2000, 1);
  329. }
  330.  
  331. addMessageCallback("MsgRabbitFlagThrow", handleMsgRabbitFlagThrow);
  332. function handleMsgRabbitFlagThrow( %msgType, %msgString, %client, %held, %flagTeam )
  333. {
  334. %client = replaceTeamStrings(detag(%client));
  335. %team = replaceTeamStrings(detag(%team));
  336.  
  337. clientCmdTopPrint("The Flag Was \cp\c5\Thrown\co By "@%client, 2000, 1);
  338. }
  339.  
  340. addMessageCallback("MsgRabbitFlagDrop", handleMsgRabbitFlagDrop);
  341. function handleMsgRabbitFlagDrop( %msgType, %msgString, %client, %held, %flagTeam )
  342. {
  343. %client = replaceTeamStrings(detag(%client));
  344. %team = replaceTeamStrings(detag(%team));
  345.  
  346. clientCmdTopPrint("The Flag Was \cp\c5\Dropped\co By "@%client, 2000, 1);
  347. }
  348.  
  349. addMessageCallback("MsgRabbitFlagReturn", handleMsgRabbitFlagReturn);
  350. function handleMsgRabbitFlagReturn( %msgType, %msgString, %client, %speed, %height, %flagTeam )
  351. {
  352. %client = replaceTeamStrings(detag(%client));
  353. %team = replaceTeamStrings(detag(%team));
  354.  
  355. sfxPlayOnce(CtfFlagReturnedSound);
  356. if (%client !$= "0")
  357. clientCmdTopPrint("The Flag Was \cp\c5\Returned\co", 2000, 1);
  358. else
  359. clientCmdTopPrint("The Flag Was Returned", 2000, 1);
  360. }
  361.  
  362. addMessageCallback("MsgRabbitFlagScore", handleMsgRabbitFlagScore);
  363. function handleMsgRabbitFlagScore( %msgType, %msgString, %client, %score )
  364. {
  365. %client = replaceTeamStrings(detag(%client));
  366. %team = replaceTeamStrings(detag(%team));
  367.  
  368. sfxPlayOnce(CtfFlagCaptureSound);
  369. clientCmdTopPrint(%client@" Has \cp\c5\A Score Of\co "@%score, 2000, 1);
  370. }
  371.  
  372. /************
  373. * HUNTERS *
  374. ************/
  375.  
  376. addMessageCallback("MsgAnnounceHuntersWinner", handleMsgAnnounceHuntersWinner);
  377. function handleMsgAnnounceHuntersWinner(%msgType, %msgString, %clientName, %score)
  378. {
  379. sfxPlayOnce(CtfGameStartEnd);
  380. %clientName = replaceTeamStrings(detag(%clientName));
  381. clientCmdCenterPrint(%clientName SPC "Won With" SPC %score SPC "Points", -1);
  382. }
  383.  
  384. function nexusRadiationWarning()
  385. {
  386. echo("nexusRadiationWarning");
  387. clientCmdBottomPrint("\cp\c2\DANGER: EXTREME RADIATION EXPOSURE\co", 500);
  388. $Hunters::NexusRadiationWarningSchedule = schedule(1000, 0, nexusRadiationWarning);
  389. }
  390.  
  391. addMessageCallback("HuntersStartNexusRadiationWarning", handleHuntersStartNexusRadiationWarning);
  392. function handleHuntersStartNexusRadiationWarning(%msgType, %msgString)
  393. {
  394. echo("handleHuntersStartNexusRadiationWarning");
  395. if (isEventPending($Hunters::NexusRadiationWarningSchedule))
  396. cancel($Hunters::NexusRadiationWarningSchedule);
  397. nexusRadiationWarning();
  398. }
  399.  
  400. addMessageCallback("HuntersStopNexusRadiationWarning", handleHuntersStopNexusRadiationWarning);
  401. function handleHuntersStopNexusRadiationWarning(%msgType, %msgString)
  402. {
  403. echo("handleHuntersStopNexusRadiationWarning");
  404. if (isEventPending($Hunters::NexusRadiationWarningSchedule))
  405. cancel($Hunters::NexusRadiationWarningSchedule);
  406. clientCmdBottomPrint("", -1);
  407. }
  408.  
  409. /************
  410. * CNC/FCNC *
  411. ************/
  412.  
  413. addMessageCallback("MsgPointCaptured", handleMsgPointCaptured);
  414. function handleMsgPointCaptured( %msgType, %msgString, %team, %client, %held, %flagTeam )
  415. {
  416. %client = replaceTeamStrings(detag(%client));
  417. %team = replaceTeamStrings(detag(%team));
  418.  
  419. sfxPlayOnce(CtfFlagCaptureSound);
  420. clientCmdTopPrint(" Point Was \cp\c5\Captured\co By "@%team, 2000, 1);
  421. }
  422.  
  423. addMessageCallback("MsgPointCaptureable", handleMsgPointCaptureable);
  424. function handleMsgPointCaptureable( %msgType, %msgString, %team, %client, %held, %flagTeam )
  425. {
  426. %client = replaceTeamStrings(detag(%client));
  427. %team = replaceTeamStrings(detag(%team));
  428.  
  429. sfxPlayOnce(CtfFlagCaptureSound);
  430. clientCmdTopPrint(%team SPC "main base is now captureable", 2000, 1);
  431. }
  432. /**************
  433. * TEAMRABBIT *
  434. **************/
  435.  
  436. addMessageCallback("MsgTRabbitFlagCatch", handleMsgTRabbitFlagCatch);
  437. function handleMsgTRabbitFlagCatch( %msgType, %msgString, %catcherClient, %passString, %passerClient )
  438. {
  439. %catcherClient = replaceTeamStrings(detag(%catcherClient));
  440. %passerClient = replaceTeamStrings(detag(%passerClient));
  441.  
  442. sfxPlayOnce(CtfFlagTakenSound);
  443. clientCmdCenterPrint(%catcherClient SPC "\c0caught a \c5" SPC %passString SPC "\c0from" SPC %passerClient, 3000, 1);
  444. }
  445.  
  446. addMessageCallback("MsgTRabbitFlagIntercept", handleMsgTRabbitFlagIntercept);
  447. function handleMsgTRabbitFlagIntercept( %msgType, %msgString, %catcherClient, %passString, %passerClient )
  448. {
  449. %catcherClient = replaceTeamStrings(detag(%catcherClient));
  450. %passerClient = replaceTeamStrings(detag(%passerClient));
  451.  
  452. sfxPlayOnce(CtfFlagTakenSound);
  453. clientCmdCenterPrint(%catcherClient SPC "\c0intercepted a \c5" SPC %passString SPC "\c0from" SPC %passerClient, 3000, 1);
  454. }
  455.  
  456. /************
  457. * SPAWNING *
  458. ************/
  459.  
  460. addMessageCallback("setSpawnSelectEnabled", handlesetSpawnSelectEnabled);
  461. function handlesetSpawnSelectEnabled( %msgType, %msgString, %spawnEnabled)
  462. {
  463. $spawnSelectEnabled = %spawnEnabled;
  464. }
  465.  
  466. function AddChatMessage(%message)
  467. {
  468. if(isObject($ChatReceiver) && isMethod($ChatReceiver.getClassName(), "addChatDisplayMessage"))
  469. {
  470. $ChatReceiver.addChatDisplayMessage($HudElement::CustomChatInterface, ChatTextProfile, %message, $ChatMessageGroup);
  471.  
  472. if($Pref::Player::ChatDisplayChatMessages)
  473. sfxPlayOnce(ChatMessageRecievedSound);
  474. }
  475. }
  476.  
  477.  
  478. function AddGameMessage(%message)
  479. {
  480. if(isObject($ChatReceiver) && isMethod($ChatReceiver.getClassName(), "addChatDisplayMessage"))
  481. {
  482. $ChatReceiver.addChatDisplayMessage($HudElement::CustomChatInterface, GameTextProfile, %message, $GameMessageGroup);
  483.  
  484. if($Pref::Player::ChatDisplayChatMessages)
  485. sfxPlayOnce(ChatMessageRecievedSound);
  486. }
  487. }
  488.  
  489. function clientCmdTopPrint( %message, %time, %lines )
  490. {
  491. %message = replaceTeamStrings(detag(%message));
  492. SetTopMessage(%message);
  493.  
  494. if (!$TopPrintActive)
  495. FadeInTopMessage();
  496. else
  497. cancel($TopPrintClearSchedule);
  498.  
  499. if (%time != -1)
  500. $TopPrintClearSchedule = schedule(%time, 0, FadeOutTopMessage);
  501. }
  502.  
  503. function clientCmdCenterPrint( %message, %time, %lines )
  504. {
  505. %message = replaceTeamStrings(detag(%message));
  506. SetCenterMessage(%message);
  507.  
  508. if (!$CenterPrintActive)
  509. FadeInCenterMessage();
  510. else
  511. cancel($CenterPrintClearSchedule);
  512.  
  513. if (%time != -1)
  514. $CenterPrintClearSchedule = schedule(%time, 0, FadeOutCenterMessage);
  515. }
  516.  
  517. function clientCmdBottomPrint( %message, %time, %lines )
  518. {
  519. %message = replaceTeamStrings(detag(%message));
  520. SetBottomMessage(%message);
  521.  
  522. if (!$BottomPrintActive)
  523. FadeInBottomMessage();
  524. else
  525. cancel($BottomPrintClearSchedule);
  526.  
  527. if (%time != -1)
  528. $BottomPrintClearSchedule = schedule(%time, 0, FadeOutBottomMessage);
  529. }
  530.  
  531. function clientCmdDescriptionPrint( %message, %time, %text2 )
  532. {
  533. %message = replaceTeamStrings(detag(%message));
  534. SetDescriptionMessage(%message);
  535.  
  536. if (!$DescriptionPrintActive)
  537. FadeInDescriptionMessage();
  538. else
  539. cancel($DescriptionPrintClearSchedule);
  540.  
  541. if (%time != -1)
  542. $DescriptionPrintClearSchedule = schedule(%time, 0, FadeOutDescriptionMessage);
  543.  
  544. //if(%text2 != 0)
  545. %message2 = replaceTeamStrings(detag(%text2));
  546. SetDescriptionLine2Message(%message2);
  547.  
  548. if (!$DescriptionLine2PrintActive)
  549. FadeInDescriptionLine2Message();
  550. else
  551. cancel($DescriptionLine2PrintClearSchedule);
  552.  
  553. if (%time != -1)
  554. $DescriptionLine2PrintClearSchedule = schedule(%time, 0, FadeOutDescriptionLine2Message);
  555. }
  556.  
  557. function SetTopMessage( %text )
  558. {
  559. HudOverlay.setHudElementText($HudElement::TopMessageText, %text, ImportantMessageProfile, true);
  560.  
  561. }
  562.  
  563. function FadeInTopMessage( )
  564. {
  565. $TopPrintActive = true;
  566. HudOverlay.AnimateHudElementAlpha($HudElement::TopMessageText, 255, 0.2);
  567.  
  568. }
  569.  
  570. function FadeOutTopMessage( )
  571. {
  572. $TopPrintActive = false;
  573. HudOverlay.AnimateHudElementAlpha($HudElement::TopMessageText, 0, 0.5);
  574.  
  575. }
  576.  
  577. function SetCenterMessage( %text )
  578. {
  579. HudOverlay.setHudElementText($HudElement::CenterMessageText, %text, ImportantMessageProfile, true);
  580. }
  581.  
  582. function FadeInCenterMessage( )
  583. {
  584. $CenterPrintActive = true;
  585. HudOverlay.AnimateHudElementAlpha($HudElement::CenterMessageText, 255, 0.2);
  586. }
  587.  
  588. function FadeOutCenterMessage( )
  589. {
  590. $CenterPrintActive = false;
  591. HudOverlay.AnimateHudElementAlpha($HudElement::CenterMessageText, 0, 0.5);
  592. }
  593.  
  594. function SetBottomMessage( %text )
  595. {
  596. HudOverlay.setHudElementText($HudElement::BottomMessageText, %text, ImportantMessageProfile, true);
  597. }
  598.  
  599. function SetDescriptionMessage( %text )
  600. {
  601. HudOverlay.setHudElementText($HudElement::DescriptionMessageText, %text, ImportantMessageProfile, true);
  602. }
  603.  
  604. function SetDescriptionLine2Message( %text )
  605. {
  606. HudOverlay.setHudElementText($HudElement::DescriptionLine2MessageText, %text2, ImportantMessageProfile, true);
  607. }
  608.  
  609.  
  610. function FadeInBottomMessage( )
  611. {
  612. $BottomPrintActive = true;
  613. HudOverlay.AnimateHudElementAlpha($HudElement::BottomMessageText, 255, 0.2);
  614. }
  615.  
  616. function FadeOutBottomMessage( )
  617. {
  618. $BottomPrintActive = false;
  619. HudOverlay.AnimateHudElementAlpha($HudElement::BottomMessageText, 0, 0.5);
  620. }
  621.  
  622. //cores tint effect
  623.  
  624. function clientCmdCoreEffectsGogo(%freq,%core)
  625. {
  626. switch$ (%core)
  627. {
  628. case "Regen":
  629. HudOverlay.setHudElementTexture($HudOverlay::coresTintOverlay,"client/gui/images/hud/coresOverlay/greenOverlay");
  630. case "Shield":
  631. HudOverlay.setHudElementTexture($HudOverlay::coresTintOverlay,"client/gui/images/hud/coresOverlay/blueOverlay");
  632. }
  633. HudOverlay.setHudElementBaseTextureSize($HudOverlay::coresTintOverlay, 2000, 2000);
  634. $coreTintOn = true;
  635. if(ServerConnection.isFirstPerson())
  636. {
  637. //$coreTintOn = true;
  638. FadeInCoresTint();
  639. }
  640.  
  641. }
  642. function clientCmdCoreEffectsNogo(%freq)
  643. {
  644. $coreTintOn = false;
  645. FadeOutCoresTint();
  646.  
  647. }
  648.  
  649. function FadeInCoresTint( )
  650. {
  651. $coresTint = true;
  652. HudOverlay.AnimateHudElementAlpha($HudOverlay::coresTintOverlay, 100, 0.3);
  653. }
  654.  
  655. function FadeOutCoresTint( )
  656. {
  657. $coresTint = false;
  658. HudOverlay.AnimateHudElementAlpha($HudOverlay::coresTintOverlay, 0, 0.3);
  659. }
  660.  
  661. ///////
  662.  
  663.  
  664. function SetDescriptionMessage( %text )
  665. {
  666. HudOverlay.setHudElementText($HudElement::DescriptionMessageText, %text, ImportantMessageProfile, true);
  667. }
  668.  
  669. function SetDescriptionLine2Message( %text )
  670. {
  671. HudOverlay.setHudElementText($HudElement::DescriptionLine2MessageText, %text, ImportantMessageProfile, true);
  672. }
  673.  
  674. function FadeInDescriptionMessage( )
  675. {
  676. $DescriptionPrintActive = true;
  677. HudOverlay.AnimateHudElementAlpha($HudElement::DescriptionMessageText, 255, 0.2);
  678. }
  679.  
  680. function FadeOutDescriptionMessage( )
  681. {
  682. $DescriptionPrintActive = false;
  683. HudOverlay.AnimateHudElementAlpha($HudElement::DescriptionMessageText, 0, 0.5);
  684. }
  685.  
  686. function SetDescriptionLine2Message( %text )
  687. {
  688. HudOverlay.setHudElementText($HudElement::DescriptionLine2MessageText, %text, ImportantMessageProfile, true);
  689. }
  690.  
  691. function FadeInDescriptionLine2Message( )
  692. {
  693. $DescriptionLine2PrintActive = true;
  694. HudOverlay.AnimateHudElementAlpha($HudElement::DescriptionLine2MessageText, 255, 0.2);
  695. }
  696.  
  697. function FadeOutDescriptionLine2Message( )
  698. {
  699. $DescriptionLine2PrintActive = false;
  700. HudOverlay.AnimateHudElementAlpha($HudElement::DescriptionLine2MessageText, 0, 0.5);
  701. }
Add Comment
Please, Sign In to add comment