![]() |
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 |
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 }); |
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 |
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); |
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); |
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()) @all can you please test your language Version with: Code:
using System; 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 ;) |
|
Quote:
Tested Russian is "ru" ps. The only thing which is not included now is separate messages to bombers and to fighters. IIRC there are 2 types of bombers: Bomber and DiveBomber. Are there several types of fighters too? Is HeavyFighter belong to Fighter type or it is a separate type? |
Possible are:
AircraftType.DiveBomber AircraftType.Bomber AircraftType.AmphibiousPlane AircraftType.TorpedoBomber AircraftType.Transport AircraftType.BNZFighter AircraftType.Fighter AircraftType.Glider AircraftType.HeavyFighter AircraftType.JaBo AircraftType.SailPlane AircraftType.Scout AircraftType.Sturmovik AircraftType.TNBFighter AircraftType.UNKNOWN So the only way is to test all playable planes with GamePlay.gpLogServer(null, "AircraftType: {0}", new object[] {(actor as AiAircraft).Type()}); Example 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, "AircraftType: {0}", new object[] {(actor as AiAircraft).Type()}); } } and so test which type a plane can be and then divide it into groups. |
oh wow! Thanks guys.
I'll give it a try and let you know how it worked out. Be advised that it may take some time 'cause I'm new to this stuff. It's like learning to ride a bike - might break a few bones in the process. Thanks a million again! Cheers Gromic |
All times are GMT. The time now is 12:44 AM. |
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 2007 Fulqrum Publishing. All rights reserved.