Fulqrum Publishing Home   |   Register   |   Today Posts   |   Members   |   UserCP   |   Calendar   |   Search   |   FAQ

Go Back   Official Fulqrum Publishing forum > Fulqrum Publishing > IL-2 Sturmovik: Cliffs of Dover > FMB, Mission & Campaign builder Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 10-01-2011, 11:32 AM
Gromic's Avatar
Gromic Gromic is offline
Approved Member
 
Join Date: Aug 2010
Posts: 77
Default Hud output depending on side choosen

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
Reply With Quote
  #2  
Old 10-01-2011, 12:17 PM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

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.
Reply With Quote
  #3  
Old 10-01-2011, 01:46 PM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

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?
Thank you for all the help you provide on scripts.

Last edited by Ataros; 10-01-2011 at 01:48 PM.
Reply With Quote
  #4  
Old 10-01-2011, 02:17 PM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

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.
Reply With Quote
  #5  
Old 10-01-2011, 05:55 PM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

Quote:
Originally Posted by FG28_Kodiak View Post
for your localized messages you can use
sendChatMessageTo(-1, GetLocalizedMessage("ru", "hello"), null);
Does "ru" here mean that the message will be sent only to owners of a RU version?

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;
}
Isn't "hello" a key that corresponds to both "Привет!" and "Hello!" ?
Reply With Quote
  #6  
Old 10-01-2011, 06:22 PM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

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);
        }
Will integrate this in my script tomoro, now its time to relax


@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() });
    }
}
german is "de" (tested myself)
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.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:10 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 2007 Fulqrum Publishing. All rights reserved.