![]() |
|
#1
|
||||
|
||||
![]()
Hi chaps,
just a quick and dirty question. Is it possible to generate output text using GamePlay.gpHUDLogCenter depending on the side you are flying on (multiplayer mission). Example: If you fly red and a submission starts, red pilots would see a message ie. "64 Squadron patroling west of Rye" whereas a blue pilot would read "Enemy formation spotted west of Rye". Something along that line. Cheers Gromic
__________________
I5-750 @ 3,8GHz / MSI P55-GD65 / MSI GTX570 Twin Frozr II / 4x2GB G.Skill 1600MHz / Corsair TX650 PSU / RAID 0 2x640GB WD Black W7 Pro x64 SP1 / MS FFB2 +Saitek X45 / Freetrack + NP Clip Pro + PS3 Eye / Samsung BX2450 24" HDMI LED |
#2
|
|||
|
|||
![]()
yes its possible, i've made two methods for this case:
See Code at http://forum.1cpublishing.eu/showpos...8&postcount=41 usage: sendScreenMessageTo(1, "test to red", null); sendScreenMessageTo(2, "test to blue", null); sendChatMessageTo(1,"test to red", null); sendChatMessageTo(2,"test to blue", null); to give additional Information for null you can use "new object[]{ object}) example: int redpoints = 20; sendScreenMessageTo(1, "Red has {0} Points", new object[]{ redpoints }); Last edited by FG28_Kodiak; 10-12-2011 at 11:27 AM. |
#3
|
|||
|
|||
![]()
Thank you very much for examples, Kodiak. I have a few questions before I can actually use it.
What is ArmyAll? Why don't you use it in the 1st example? Does this parameter exist in the game engine or I just type it in instead of 1 or 2? Why don't I just type "null" or say "-1" instead? Can army be = 0 i.e. a message to those who did not select an army yet. How can Localized messages http://forum.1cpublishing.eu/showthread.php?t=26444 be integrated into these scripts? I do not what international players to read Cyrillic text as well so can it be e.g. Code:
if (ru version) Russian text else English text? Last edited by Ataros; 10-01-2011 at 01:48 PM. |
#4
|
|||
|
|||
![]()
Oh sorry ArmyAll is -1, just copy the methods from a script i made and forgotten to change this.
normally i use const int ArmyAll = -1; const int ArmyRed = 1; const int ArmyBlue = 2; at the beginning of my scripts. have corrected the script so if you want send a Message to All you can use sendChatMessageTo(-1, "Test To All", null); sendScreenMessageTo(-1, "Test To All", null); for your localized messages you can use sendChatMessageTo(-1, GetLocalizedMessage("ru", "Hello"), null); Last edited by FG28_Kodiak; 10-01-2011 at 02:59 PM. |
#5
|
|||
|
|||
![]() Quote:
But what to do if I want to send same message to everyone but in 2 languages? Will this do? Code:
sendChatMessageTo(-1, GetLocalizedMessage( , "hello"), null); private string GetLocalizedMessage(string lang, string key) { switch(key) { case "hello": { if lang = "ru" { return "Привет!"; } else { return "Hello!"; } } break; } return String.Empty; } |
#6
|
|||
|
|||
![]()
No your GetLocalizedMessage does nothing else then "translate" the hello in the language you specify.
There is a way to send a message to a player in his language. The Player object contends a method called LanguageName() so for remoteplayer you can use: Code:
foreach (Player pl in GamePlay.gpRemotePlayers()) { if (pl.LanguageName().Equals("de")) { GamePlay.gpHUDLogCenter(new Player[]{pl}, "Hallo", null); } else if (pl.LanguageName().Equals("ru")) { GamePlay.gpHUDLogCenter(new Player[] { pl }, "Привет!", null); } else GamePlay.gpHUDLogCenter(new Player[] { pl }, "Hello", null); } ![]() @all can you please test your language Version with: Code:
using System; using System.Collections; using System.Collections.Generic; using maddox.game; using maddox.game.world; public class Mission : AMission { public override void OnPlaceEnter(Player player, AiActor actor, int placeIndex) { base.OnPlaceEnter(player, actor, placeIndex); GamePlay.gpLogServer(null, "\n\nYour language: {0}\n\n", new object[] { player.LanguageName() }); } } english is "en" (not tested) russian is "ru" (not tested) so can anyone with this language version check this for me? But i think the best is to add a option to private void sendChatMessageTo(int army, string playerlanguage, string msg, object[] parms) so it will be possible to use sendChatMessageTo(1, "en", "Hello", null); so it will send it only to the red players with english language version. Tomorow ![]() Last edited by FG28_Kodiak; 10-01-2011 at 06:44 PM. |
![]() |
|
|