Official Fulqrum Publishing forum

Official Fulqrum Publishing forum (http://forum.fulqrumpublishing.com/index.php)
-   FMB, Mission & Campaign builder Discussions (http://forum.fulqrumpublishing.com/forumdisplay.php?f=203)
-   -   Hud output depending on side choosen (http://forum.fulqrumpublishing.com/showthread.php?t=26623)

Gromic 10-01-2011 11:32 AM

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

FG28_Kodiak 10-01-2011 12:17 PM

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 });

Ataros 10-01-2011 01:46 PM

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.

FG28_Kodiak 10-01-2011 02:17 PM

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);

Ataros 10-01-2011 05:55 PM

Quote:

Originally Posted by FG28_Kodiak (Post 342768)
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!" ?

FG28_Kodiak 10-01-2011 06:22 PM

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 ;)

FG28_Kodiak 10-02-2011 04:21 AM

So integrate player language:

latest version:
http://forum.1cpublishing.eu/showpos...8&postcount=41

Ataros 10-02-2011 09:14 AM

Quote:

Originally Posted by FG28_Kodiak (Post 342820)
There is a way to send a message to a player in his language.
The Player object contends a method called LanguageName()

Thank you so much! This is the piece I was missing.

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?

FG28_Kodiak 10-02-2011 09:51 AM

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.

Gromic 10-02-2011 11:28 AM

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

Gromic 10-03-2011 09:17 AM

Hi chaps,

figured I'd crash and burn on my first attempt. I'd like to mention the fact that I have virtually no experience with C# and am more or less learning this stuff via copy and paste :mad::grin:

Kodiak, I dropped your script from post#2 (trying to keep it simple) into one of my missions, pressed compile and was greeted with numerous error messages that I can't wrap my head around atm. It is the only script within the mission.

-----------------------------------------------------------------------
c:\Users\Gromic\Documents\1C SoftClub\il-2 sturmovik cliffs of dover\missions\Multi\Dogfight\BOB\BOB1.cs(1,13): error CS1518: Klasse, Delegat, Enumeration, Schnittstelle oder Struktur erwartet.

c:\Users\Gromic\Documents\1C SoftClub\il-2 sturmovik cliffs of dover\missions\Multi\Dogfight\BOB\BOB1.cs(1,67): error CS1001: Bezeichner erwartet

c:\Users\Gromic\Documents\1C SoftClub\il-2 sturmovik cliffs of dover\missions\Multi\Dogfight\BOB\BOB1.cs(1,69): error CS1518: Klasse, Delegat, Enumeration, Schnittstelle oder Struktur erwartet.

c:\Users\Gromic\Documents\1C SoftClub\il-2 sturmovik cliffs of dover\missions\Multi\Dogfight\BOB\BOB1.cs(14,44): error CS1518: Klasse, Delegat, Enumeration, Schnittstelle oder Struktur erwartet.

c:\Users\Gromic\Documents\1C SoftClub\il-2 sturmovik cliffs of dover\missions\Multi\Dogfight\BOB\BOB1.cs(22,13): error CS1022: Typ- oder Namespacedefinition oder Dateiende erwartet.
-----------------------------------------------------------------------

I figured that the initial script was in raw form so I ammended line 9 from:
GamePlay.gpHUDLogCenter(null, msg, parms);

to

GamePlay.gpHUDLogCenter("en", "msg red", null );

Help!

And let me be so kind as to say in advance, thank you for all that you, and others, have done with scripting. Especially with the lack of documentation from 1C.

Cheers

Gromic

FG28_Kodiak 10-03-2011 09:28 AM

Seems you have set a wrong or missing Bracket. Can you show me your complete code please.

Deutsche Fehlermeldungen mir deucht ich hab nen Landsmann (oder Umgebung) vor mir ;)


GamePlay.gpHUDLogCenter("en", "msg red", null );
couldn't work
gpHUDLogCenter needs in this case a array of players as first argument (or null - null meens send message to all)




Added a example script

Gromic 10-03-2011 11:04 AM

Moin Kodiak ;)

This is the code I was using. It's yours from post 2 of this thread.

Code:

    private void sendScreenMessageTo(int army, string msg, object[] parms)
    {
        if (army != -1)
        {
            //Singleplayer (for Testing)
            if (GamePlay.gpRemotePlayers() == null || GamePlay.gpRemotePlayers().Length <= 0)
            {
                if (GamePlay.gpPlayer() != null && GamePlay.gpPlayer().Army() == army)
                    GamePlay.gpHUDLogCenter(null, msg, parms);

            }
            else // Multiplayer
            {
                List<Player> Players = new List<Player>();

                foreach (Player p in GamePlay.gpRemotePlayers())
                {
                    if (p.Army() == army)
                        Players.Add(p);
                }
                GamePlay.gpHUDLogCenter(Players.ToArray(), msg, parms);
            }
        }
        else GamePlay.gpHUDLogCenter(null, msg, parms);
    }


    private void sendChatMessageTo(int army, string msg, object[] parms)
    {
        if (army != -1)
        {
            //Singleplayer (for Testing)
            if (GamePlay.gpRemotePlayers() == null || GamePlay.gpRemotePlayers().Length <= 0)
            {
                if (GamePlay.gpPlayer() != null && GamePlay.gpPlayer().Army() == army)
                    GamePlay.gpLogServer(null, msg, parms);

            }
            else // Multiplayer
            {
                List<Player> Players = new List<Player>();

                foreach (Player p in GamePlay.gpRemotePlayers())
                {
                    if (p.Army() == army)
                        Players.Add(p);
                }
                GamePlay.gpLogServer(Players.ToArray(), msg, parms);
            }
        }
        else GamePlay.gpLogServer(null, msg, parms);
    }

I don't see any missing brackets but then my eyes aren't what they used to be. Thanks for the example script. I'll check it out as soon as I can.

P.S. Landsmann ist richtig. Dürfte vermutlich nicht mal so weit von dir sein da "Bayern" auch bei mir im Perso steht. Nähe Aschaffenburg. Schöne Grüße und danke für alles was du bisher für die Community getan hast!

FG28_Kodiak 10-03-2011 11:11 AM

Ah ok now i know the error:
These lines you copy are useless, without

using System;
using System.Collections;
using System.Collections.Generic;
using maddox.game;
using maddox.game.world;


public class Mission : AMission
{

// place the code here




}

Gromic 10-03-2011 08:35 PM

Right, now I really look foolish. I'd forgotten to add the librarys.

We've got a chap in our squad that works with C# professionally and he sacrificed some time and helped me with a script, using the ones that you've so kindly donated as a basis to go on.

He's come up with a script that works perfectly. We have it running on our dedicated server. Here's an excerpt from one of our sub-missions.

Code:

using System.Collections.Generic;
using maddox.game;
using maddox.game.world;

public class Mission : AMission
{
    private const int All = -1;
    private const int Allies = 1;
    private const int Axis = 2;

    public override void OnPlaceEnter(Player player, AiActor actor, int placeIndex)
    {
        base.OnPlaceEnter(player, actor, placeIndex);

        SendScreenMessageTo(All, "Welcome Everyone");
        SendScreenMessageTo(Axis, "Lucie-Anton: good hunting over the channel. Weather reports clear skys with mild cloudbase at 1500 meters.");
        SendScreenMessageTo(Allies, "Sector control reports 79 squadron on inbound leg to patrol SE Dover area. Over.");
    }

    private void SendScreenMessageTo(int army, string message)
    {
        if (army == All)
        {
            GamePlay.gpHUDLogCenter(message);
        }
        else
        {
            //Singleplayer (for Testing)
            if (GamePlay.gpRemotePlayers() == null ||
                GamePlay.gpRemotePlayers().Length <= 0)
            {
                if (GamePlay.gpPlayer() != null &&
                    GamePlay.gpPlayer().Army() == army)
                {
                    GamePlay.gpHUDLogCenter(message);
                }
            }
            else // Multiplayer
            {
                var playersInArmy = new List<Player>();

                foreach (var player in GamePlay.gpRemotePlayers())
                {
                    if (player.Army() == army)
                    {
                        playersInArmy.Add(player);
                    }
                }
               
                GamePlay.gpHUDLogCenter(playersInArmy.ToArray(), message);
            }
        }
    }

    private void SendChatMessageTo(int army, string message)
    {
        if (army == All)
        {
            GamePlay.gpLogServer(null, message, null);
        }
        else
        {
            //Singleplayer (for Testing)
            if (GamePlay.gpRemotePlayers() == null ||
                GamePlay.gpRemotePlayers().Length <= 0)
            {
                if (GamePlay.gpPlayer() != null &&
                    GamePlay.gpPlayer().Army() == army)
                {
                    GamePlay.gpLogServer(null, message, null);
                }

            }
            else // Multiplayer
            {
                var playersInArmy = new List<Player>();

                foreach (var player in GamePlay.gpRemotePlayers())
                {
                    if (player.Army() == army)
                    {
                        playersInArmy.Add(player);
                    }
                }

                GamePlay.gpLogServer(playersInArmy.ToArray(), message, null);
            }
        }
    }
}

Thank you so much for your help everyone.

Cheers

Gromic

Ataros 10-04-2011 10:34 PM

@ FG28_Kodiak
I am making a simple mission on Steppe map and trying to modify a script by TheEnlightenedFlorist which sends messages to a particular player in MP onPlaceEnter.

I want to define a new method to do this in 3 languages, but I do not know how to do it correctly. Also I included a multi-engine aircraft into limited list and wonder if the script would kill its engines correctly.

I included my questions into remarks. Would be grateful for any advice. Thank you for all your great help!

Code:

using System;
using System.Collections;
using maddox.game;
using maddox.game.world;
using System.Collections.Generic;

using System.Diagnostics;

/**
 * Parts of the script were taken from:
 *
 * Operation Dynamo v2.0
 * A multiplayer mission for IL-2 Sturmovik: Cliffs of Dover
 * @author TheEnlightenedFlorist
 * http://forum.1cpublishing.eu/showthread.php?t=23579&highlight=operation+dynamo
 * */

public class Mission : AMission
{
 
    //allowed and currently flying aircraft
    int allowed109s = 12;
    int current109s = 0;

    int allowedSpit2s = 7;
    int currentSpit2s = 0;

    int allowed110s = 4;
    int current110s = 0;


    public override void OnBattleStarted()
    {
        base.OnBattleStarted();

        //listen to events from all missions.
        MissionNumberListener = -1;

    }

    // Makes any FMB trigger/action pair work if they have the same name.
    //public override void OnTrigger(int missionNumber, string shortName, bool active)
    //{
    //    base.OnTrigger(missionNumber, shortName, active);
    //    AiAction action = GamePlay.gpGetAction(ActorName.Full(missionNumber, shortName));
    //    if (action != null)
    //        action.Do();
    //}


    public override void OnPlaceEnter(Player player, AiActor actor, int placeIndex)
    {
        base.OnPlaceEnter(player, actor, placeIndex);

        // test
        // notAvailableMsg();

        if (actor != null && actor is AiAircraft)
        {
            //check limited aircraft
            switch ((actor as AiAircraft).InternalTypeName())
            {
                case "bob:Aircraft.Bf-109E-4":
                    {
                        current109s++;
                        if (current109s > allowed109s)
                        {
                            (actor as AiAircraft).hitNamed(part.NamedDamageTypes.Eng0TotalFailure);
                            notAvailableMsg(new Player[] { player });
                            //GamePlay.gpHUDLogCenter(new Player[] { player }, "Aircraft not available! Choose another aircraft.");
                        }
                        break;
                    }
                case "bob:Aircraft.SpitfireMkIIa":
                    {
                        currentSpit2s++;
                        if (currentSpit2s > allowedSpit2s)
                        {
                            (actor as AiAircraft).hitNamed(part.NamedDamageTypes.Eng0TotalFailure);
                            notAvailableMsg(new Player[] { player });
                            //GamePlay.gpHUDLogCenter(new Player[] { player }, "Aircraft not available! Choose another aircraft.");
                        }
                        break;
                    }
                case "bob:Aircraft.Bf-110C-7":
                    {
                        current110s++;
                        if (current110s > allowed110s)
                        {
                            //(actor as AiAircraft).hitNamed(part.NamedDamageTypes.Eng0TotalFailure); // Is this line for single-engined only? только для одномоторных?

                            // Will this do for multi-engine?
                            int iNumOfEngines = (aircraft.Group() as AiAirGroup).aircraftEnginesNum();
                            for (int i = 0; i < iNumOfEngines; i++)
                            {
                                aircraft.hitNamed((part.NamedDamageTypes)Enum.Parse(typeof(part.NamedDamageTypes), "Eng" + i.ToString() + "TotalFailure"));
                            }

                            notAvailableMsg(new Player[] { player });
                            //GamePlay.gpHUDLogCenter(new Player[] { player }, "Aircraft not available! Choose another aircraft.");
                        }
                        break;
                    }
            }
        }
    }

    // Trying to make a new method... Does it look correct?
    public void notAvailableMsg(Player player)
    {
        switch (player.LanguageName())
        {
            case "de":
                GamePlay.gpHUDLogCenter(new Player[] { player }, "Too many aircrafts of this type! Choose another aircraft.");
                break; //need translation please
            case "ru":
                GamePlay.gpHUDLogCenter(new Player[] { player }, "Слишком много самолетов данного типа! Выберите другой самолет.");
                break;
            default:
                GamePlay.gpHUDLogCenter(new Player[] { player }, "Too many aircrafts of this type! Choose another aircraft.");
                break;
        }
    }

    public override void OnPlaceLeave(Player player, AiActor actor, int placeIndex)
    {
        base.OnPlaceLeave(player, actor, placeIndex);

        if (actor != null && actor is AiAircraft)
        {
            //check limited aircraft
            switch ((actor as AiAircraft).InternalTypeName())
            {
                case "bob:Aircraft.Bf-109E-4":
                    current109s--;
                    break;
                case "bob:Aircraft.SpitfireMkIIa":
                    currentSpit2s--;
                    break;
                case "bob:Aircraft.Bf-110C-7":
                    current110s--;
                    break;
            }
        }
    }


FG28_Kodiak 10-05-2011 04:32 AM

Script corrected:
Code:

using System;
using System.Collections;
using maddox.game;
using maddox.game.world;
using System.Collections.Generic;

using System.Diagnostics;

/**
 * Parts of the script were taken from:
 *
 * Operation Dynamo v2.0
 * A multiplayer mission for IL-2 Sturmovik: Cliffs of Dover
 * @author TheEnlightenedFlorist
 * http://forum.1cpublishing.eu/showthread.php?t=23579&highlight=operation+dynamo
 * */

public class Mission : AMission
{

    //allowed and currently flying aircraft
    int allowed109s = 12;
    int current109s = 0;

    int allowedSpit2s = 7;
    int currentSpit2s = 0;

    int allowed110s = 4;
    int current110s = 0;


    public override void OnBattleStarted()
    {
        base.OnBattleStarted();

        //listen to events from all missions.
        MissionNumberListener = -1;

    }

    // Makes any FMB trigger/action pair work if they have the same name.
    //public override void OnTrigger(int missionNumber, string shortName, bool active)
    //{
    //    base.OnTrigger(missionNumber, shortName, active);
    //    AiAction action = GamePlay.gpGetAction(ActorName.Full(missionNumber, shortName));
    //    if (action != null)
    //        action.Do();
    //}


    public override void OnPlaceEnter(Player player, AiActor actor, int placeIndex)
    {
        base.OnPlaceEnter(player, actor, placeIndex);

        // test
        // notAvailableMsg();

        if (actor != null && actor is AiAircraft)
        {
            //check limited aircraft
            switch ((actor as AiAircraft).InternalTypeName())
            {
                case "bob:Aircraft.Bf-109E-4":
                    {
                        current109s++;
                        if (current109s > allowed109s)
                        {
                            (actor as AiAircraft).hitNamed(part.NamedDamageTypes.Eng0TotalFailure);
                            notAvailableMsg(player);
                            //GamePlay.gpHUDLogCenter(new Player[] { player }, "Aircraft not available! Choose another aircraft.");
                        }
                        break;
                    }
                case "bob:Aircraft.SpitfireMkIIa":
                    {
                        currentSpit2s++;
                        if (currentSpit2s > allowedSpit2s)
                        {
                            (actor as AiAircraft).hitNamed(part.NamedDamageTypes.Eng0TotalFailure);
                            notAvailableMsg(player);
                            //GamePlay.gpHUDLogCenter(new Player[] { player }, "Aircraft not available! Choose another aircraft.");
                        }
                        break;
                    }
                case "bob:Aircraft.Bf-110C-7":
                    {
                        current110s++;
                        if (current110s > allowed110s)
                        {
                            //(actor as AiAircraft).hitNamed(part.NamedDamageTypes.Eng0TotalFailure); // Is this line for single-engined only? только для одномоторных?

                            // Will this do for multi-engine?
                            int iNumOfEngines = ((actor as AiAircraft).Group() as AiAirGroup).aircraftEnginesNum();
                            for (int i = 0; i < iNumOfEngines; i++)
                            {
                                (actor as AiAircraft).hitNamed((part.NamedDamageTypes)Enum.Parse(typeof(part.NamedDamageTypes), "Eng" + i.ToString() + "TotalFailure"));
                            }

                            notAvailableMsg(player);
                            //GamePlay.gpHUDLogCenter(new Player[] { player }, "Aircraft not available! Choose another aircraft.");
                        }
                        break;
                    }
            }
        }
    }

   
    public void notAvailableMsg(Player player)
    {
        switch (player.LanguageName())
        {
            case "de":
                GamePlay.gpHUDLogCenter(new Player[] { player }, "Limit für diesen Flugzeugtyp erreicht! Wähle ein anderes Muster!");
                break;
            case "ru":
                GamePlay.gpHUDLogCenter(new Player[] { player }, "Слишком много самолетов данного типа! Выберите другой самолет.");
                break;
            default:
                GamePlay.gpHUDLogCenter(new Player[] { player }, "Too many aircrafts of this type! Choose another aircraft.");
                break;
        }
    }

    public override void OnPlaceLeave(Player player, AiActor actor, int placeIndex)
    {
        base.OnPlaceLeave(player, actor, placeIndex);

        if (actor != null && actor is AiAircraft)
        {
            //check limited aircraft
            switch ((actor as AiAircraft).InternalTypeName())
            {
                case "bob:Aircraft.Bf-109E-4":
                    current109s--;
                    break;
                case "bob:Aircraft.SpitfireMkIIa":
                    currentSpit2s--;
                    break;
                case "bob:Aircraft.Bf-110C-7":
                    current110s--;
                    break;
            }
        }
    }

changed:
notAvailableMsg(new Player[] { player }); -to-> notAvailableMsg(player);
notAvailableMsg needs a argument from type Player not an array of it.

aircraft.hitNamed(...); -to-> (actor as AiAircraft).hitNamed(...)
aircraft was not declared - as alternative you can declare AiAircraft aircraft = actor as AiAircraft;

----
//(actor as AiAircraft).hitNamed(part.NamedDamageTypes.Eng0Tot alFailure); // Is this line for single-engined only?
Yes, you kill the first engine with it.

// Will this do for multi-engine?
int iNumOfEngines = ((actor as AiAircraft).Group() as AiAirGroup).aircraftEnginesNum();
for (int i = 0; i < iNumOfEngines; i++)
{
(actor as AiAircraft).hitNamed((part.NamedDamageTypes)Enum.P arse(typeof(part.NamedDamageTypes), "Eng" + i.ToString() + "TotalFailure"));
}
Yes its correct.

"Too many aircrafts of this type! Choose another aircraft."
translated into german:
"Limit für diesen Flugzeugtyp erreicht! Wähle ein anderes Muster!"

Ataros 10-05-2011 07:53 AM

Thank you very much!

FG28_Kodiak 10-07-2011 01:56 PM

Made some rework on the script:

latest version:
http://forum.1cpublishing.eu/showpos...8&postcount=41

Added a exept version:
private void sendChatMessageTo(int army, string[] exepttoplayerlanguages, string msg, object[] parms)
private void sendScreenMessageTo(int army, string[] exepttoplayerlanguages, string msg, object[] parms)
Second Argument is a array of string.
so you can enter the languages this message should not be send
sendScreenMessageTo(-1, new string[] { "de", "ru" }, "Hello", null);

usefull if you have send a Message to for example the german players but dont want send a other language message to them
sendScreenMessageTo(-1, "de" }, "Hallo", null);
sendScreenMessageTo(-1, new string[] { "de" }, "Hello", null);
so the germans (with the german game version) get the german "Hallo"
and all other players gets the english "Hello".

Ataros 10-07-2011 03:17 PM

Just WOW! A lot of work and quality one. I will use it in a new mission version.

BTW can I replace my methods that send messages to individual players with your methods somehow? I use methods like follows:
Code:

    private void objMsg(Player player)
    {
        switch (player.LanguageName())
        {
            case "de":
                GamePlay.gpLogServer(new Player[] { player }, "Achieve air superiority and attack ground targets in C5, D4 and E3!", null);
                break;
            case "ru":
                GamePlay.gpLogServer(new Player[] { player }, "Обеспечьте превосходство в воздухе и атакуйте наземные цели в квадратах C5, D4 и E3!", null);
                break;
            default:
                GamePlay.gpLogServer(new Player[] { player }, "Achieve air superiority and attack ground targets in C5, D4 and E3!", null);
                break;
        }
    }

E.g. can new Player[] { player } be used instead of army in your methods? It is not that important, just want to know.

I will replace "de" message if you give me a translation :)

FG28_Kodiak 10-07-2011 03:24 PM

Not at the moment but its no problem to integrate this. :rolleyes:

"Achieve air superiority and attack ground targets in C5, D4 and E3!"
in german
"Luftüberlegenheit erringen und Bodenziele in C5, D4 und E3 angreifen!"

FG28_Kodiak 10-07-2011 03:53 PM

So integrated:

latest version:
http://forum.1cpublishing.eu/showpos...8&postcount=41

first argument is from type Player, for this example i use the player from OnPlaceEnter(...), so the player sees Hallo if he is german and a english "Hello" he is not.

sendScreenMessageTo(player, "de", "Hallo", null);
sendChatMessageTo(player, "de", "Hallo", null);

sendScreenMessageTo(player, new string[] {"de"}, "Hello", null);
sendChatMessageTo(player, new string[] { "de" }, "Hello", null);

Ataros 10-07-2011 05:38 PM

Sounds like magic! :) Thank you!

Ataros 10-11-2011 06:12 PM

2 Attachment(s)
Hi, Kodiak!
I am facing some issues integrating your message system into my Steppe mission. We plan to put the mission up on R2 or R3 (Repkas) after the official patch is out an I hope you can help me to get it working. I am obviously making something wrong but can not get through it for 3 days already due to lack of basic knowledge.

I divided all the script into #region-s and commented the regions in which messages are available. I described the parts which are not working in comments. Please let me know if it is comfortable for you or you want me to paste the list of issues and parts of the script here on the forum.

In general the issue is that script works on a hosted server which I start ingame (and no one connected). So it sends messages to me as a host. But the script does not work on a dedicated server when I connect to it. The "NET settings" message creates so many errors that a game freezes and some lines of code are skipped like current109s++ in not calculated.

I attach also a server log with errors I get.
Thanks in advance for any advice.

FG28_Kodiak 10-11-2011 06:44 PM

Seems the problem is the
Timeout(12, () =>
may be the player is no longer valid after 12 sec, can you test it without the timeout or a shorter one?

Ataros 10-11-2011 06:50 PM

Quote:

Originally Posted by FG28_Kodiak (Post 347855)
Seems the problem is the
Timeout(12, () =>
may be the player is no longer valid after 12 sec, can you test it without the timeout or a shorter one?

Thank you I will check it tomorrow. Now servers are busy.

I am still sitting and waiting in my aircraft after 12 seconds, so both a player and an aircraft exist. Why can he be invalid?

PS. Sorry, maybe I did not explain it in detail.

Timeout(12, () => is related to
Code:

                                msgTooManyAircraft(player);
                                showTestMsg(player);

which works fine.

Code:

        Timeout(20, () =>
        {
            msgCurrentObjectives(player);            // current objectives
        });

also works.

The part which does not work is
Code:

        //// NET settings msg - do not work on dedicated server, works on hosted server for host at least
        //// prevents several lines of code from execution, e.g. current109s++ does not work

        //sendScreenMessageTo(player, new string[] { "ru" }, "Please set your NET speed to ISDN in game network settings. This is needed for server testing purposes.", null);
        //sendScreenMessageTo(player, "ru", "Пожалуйста, поставьте в настройках игры скорость сети 'ISDN'. Это нужно для тестирования сервера.", null);
        //Timeout(7, () => // 2nd part
        //{
        //    sendScreenMessageTo(player, new string[] { "ru" }, "Please report on 1C Clifs of Dover forums if this helps reducing lag.", null);
        //    sendScreenMessageTo(player, "ru", "Пожалуйста, сообщите на форуме sukhoi.ru уменьшает ли это лаги.", null);
        //});
        //sendChatMessageTo(player, new string[] { "ru" }, "Please set your NET speed to ISDN in game network settings. This is needed for server testing purposes. Please report on 1C forums if this helps reducing lag.", null);
        //sendChatMessageTo(player, "ru", "Пожалуйста, поставьте в настройках игры скорость сети 'ISDN'. Это нужно для тестирования сервера. Пожалуйста, сообщите на форуме sukhoi.ru уменьшает ли это лаги.", null);

Gives many errors if enabled.

And the complete code of OnTickGame sends messages only offline or on a hosted server to the host. Does not send messages to remote player on a dedicated server.

FG28_Kodiak 10-11-2011 07:14 PM

At the moment its only a possibility.

You get a "Object reference not set to an instance of an object" Error. Thats means the script would use a object wich is null, but at the moment i dont see why the player should be null at the moment OnPlaceEnter is active, so may be its null after 12 sec. At time i dont trust the memory management of a dedicated server ;)

Ataros 10-11-2011 07:19 PM

Edited the previous post a bit. The messages sent after 12 seconds are delivered.

FG28_Kodiak 10-12-2011 07:22 AM

GamePlay.gpRemotePlayers().Length <= 0 should be the bug (to silly btw) GamePlay.gpRemotePlayers().Length > 0 is the correct version.
Next time i should test my code on Multiplayer conditions before give it to the public. Shame on me.

latest version:
http://forum.1cpublishing.eu/showpos...8&postcount=41

Ataros 10-12-2011 07:47 AM

Thank you very much! You know mistakes are a pathway to future success.

So, the "NET message" in OnPlaceEnter will also work I hope. Will try it tonight hopefully.

Ataros 10-12-2011 07:56 AM

I am using about 10-20 timeout statements in onTickGame to send messages. Does it slow down server processor if server has to count 10-20 timers at the same time or not?

Maybe it should be optimized to have only one timer?

FG28_Kodiak 10-12-2011 08:50 AM

Made little additions to the code, to avoid exeptions.

latest version:
http://forum.1cpublishing.eu/showpos...8&postcount=41

Ataros 10-12-2011 08:59 AM

Thank you! Testing on R2 now.

Ataros 10-12-2011 09:09 AM

I get this OnPlaceEnter if enable my "NET message"

Code:

[13:01:51]        Server: 3GIAP_Atas enters the battle.
[13:01:53]        Server: 3GIAP_Atas will fly for the Red forces.
[13:01:58]        Loading mission ...
[13:01:58]        Server to [Server]: A new group of 1 Red aircraft was reported.
[13:01:58]        Mission loaded. time = 0.329
[13:01:58]        Server to [3GIAP_Atas]: Удачного вылета!
[13:01:58]        Server to [3GIAP_Atas]: Пожалуйста, поставьте в настройках игры скорость сети 'ISDN'. Это нужно для тестирования сервера. Пожалуйста, сообщите на форуме sukhoi.ru уменьшает ли это лаги.
[13:01:58]       
[13:01:58]        =================================================
[13:01:58]        System.IO.IOException: I/O error occurred.
[13:01:58]       
[13:01:58]        Server stack trace:
[13:01:58]          at pFdAnwvFuaY9YxSo5Rb.MTbs2Wva9ZwBOQUYQch.XV70nxU5mb(String )
[13:01:58]          at Gs6THTU8KBgeGhkm4tn.1yUfFwUh503FN6STRyP.pAevmyIzcXSHogPw31FA(Object , Object )
[13:01:58]          at Gs6THTU8KBgeGhkm4tn.1yUfFwUh503FN6STRyP.vdHekiRiXUo(String , Object[] )
[13:01:58]          at Gs6THTU8KBgeGhkm4tn.1yUfFwUh503FN6STRyP.5ExekdenPIb(Player[] , String , Object[] )
[13:01:58]          at LrAZHYDb5HXlxAcGxGQ.O8MywKDql50K0Y6Ucrm.LogServer(Player[] , String , Object[] )
[13:01:58]          at maddox.game.GameDef.gpLogServer(Player[] to, String format, Object[] args)
[13:01:58]          at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
[13:01:58]          at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)
[13:01:58]       
[13:01:58]        Exception rethrown at [0]:
[13:01:58]          at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
[13:01:58]          at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
[13:01:58]          at maddox.game.IGamePlay.gpLogServer(Player[] to, String format, Object[] args)
[13:01:58]          at Mission.OnPlaceEnter(Player player, AiActor actor, Int32 placeIndex)
[13:01:58]          at maddox.game.ABattle.OnPlaceEnter(Player player, AiActor actor, Int32 placeIndex)
[13:01:58]          at maddox.game.ABattle.OnEventGame(GameEventId eventId, Object eventArg0, Object eventArg1, Int32 eventArgInt)
[13:01:58]          at maddox.game.world.Strategy.OnEventGame(GameEventId eventId, Object eventArg0, Object eventArg1, Int32 eventArgInt)
[13:01:58]          at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
[13:01:58]          at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)
[13:01:58]       
[13:01:58]        Exception rethrown at [1]:
[13:01:58]          at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
[13:01:58]          at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
[13:01:58]          at maddox.game.IBattle.OnEventGame(GameEventId eventId, Object eventArg0, Object eventArg1, Int32 eventArgInt)
[13:01:58]          at maddox.game.GameDef.eventGame(GameEventId eventId, Object eventArg0, Object eventArg1, Int32 eventArgInt)
[13:01:58]          at dp8K7ffZC2JmTFxNtum.gkydOifm2sRXchrPjNC.eventGame(GameEventId , Object , Object , Int32 )
[13:01:58]          at tpZkklAJjTISdGT144j.fBZFTNAMvsuuP0ewCS3.AY6A72gxK6R(GameEventId , Object , Object , Int32 )
[13:01:58]        =================================================
[13:02:04]        Chat: Server:        !!! VULCHING IS NOT ALLOWED ON THIS SERVER !!!
[13:02:47]        Loading mission ...
[13:02:47]        Server to [Server]: A new group of 1 Red aircraft was reported.
[13:02:47]        Mission loaded. time = 0.009
[13:02:47]        Server to [3GIAP_Atas]: Удачного вылета!
[13:02:47]        Server to [3GIAP_Atas]: Пожалуйста, поставьте в настройках игры скорость сети 'ISDN'. Это нужно для тестирования сервера. Пожалуйста, сообщите на форуме sukhoi.ru уменьшает ли это лаги.
[13:02:47]       
[13:02:47]        =================================================
[13:02:47]        System.IO.IOException: I/O error occurred.
[13:02:47]       
[13:02:47]        Server stack trace:
[13:02:47]          at pFdAnwvFuaY9YxSo5Rb.MTbs2Wva9ZwBOQUYQch.XV70nxU5mb(String )
[13:02:47]          at Gs6THTU8KBgeGhkm4tn.1yUfFwUh503FN6STRyP.pAevmyIzcXSHogPw31FA(Object , Object )
[13:02:47]          at Gs6THTU8KBgeGhkm4tn.1yUfFwUh503FN6STRyP.vdHekiRiXUo(String , Object[] )
[13:02:47]          at Gs6THTU8KBgeGhkm4tn.1yUfFwUh503FN6STRyP.5ExekdenPIb(Player[] , String , Object[] )
[13:02:47]          at LrAZHYDb5HXlxAcGxGQ.O8MywKDql50K0Y6Ucrm.LogServer(Player[] , String , Object[] )
[13:02:47]          at maddox.game.GameDef.gpLogServer(Player[] to, String format, Object[] args)
[13:02:47]          at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
[13:02:47]          at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)
[13:02:47]       
[13:02:47]        Exception rethrown at [0]:
[13:02:47]          at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
[13:02:47]          at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
[13:02:47]          at maddox.game.IGamePlay.gpLogServer(Player[] to, String format, Object[] args)
[13:02:47]          at Mission.OnPlaceEnter(Player player, AiActor actor, Int32 placeIndex)
[13:02:47]          at maddox.game.ABattle.OnPlaceEnter(Player player, AiActor actor, Int32 placeIndex)
[13:02:47]          at maddox.game.ABattle.OnEventGame(GameEventId eventId, Object eventArg0, Object eventArg1, Int32 eventArgInt)
[13:02:47]          at maddox.game.world.Strategy.OnEventGame(GameEventId eventId, Object eventArg0, Object eventArg1, Int32 eventArgInt)
[13:02:47]          at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
[13:02:47]          at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)
[13:02:47]       
[13:02:47]        Exception rethrown at [1]:
[13:02:47]          at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
[13:02:47]          at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
[13:02:47]          at maddox.game.IBattle.OnEventGame(GameEventId eventId, Object eventArg0, Object eventArg1, Int32 eventArgInt)
[13:02:47]          at maddox.game.GameDef.eventGame(GameEventId eventId, Object eventArg0, Object eventArg1, Int32 eventArgInt)
[13:02:47]          at dp8K7ffZC2JmTFxNtum.gkydOifm2sRXchrPjNC.eventGame(GameEventId , Object , Object , Int32 )
[13:02:47]          at tpZkklAJjTISdGT144j.fBZFTNAMvsuuP0ewCS3.AY6A72gxK6R(GameEventId , Object , Object , Int32 )
[13:02:47]        =================================================
[13:02:54]        Loading mission ...
[13:02:54]        Server to [Server]: A group of Red 1 just appeared.
[13:02:54]        Mission loaded. t

Code:

    public override void OnPlaceEnter(Player player, AiActor actor, int placeIndex)
    {
        base.OnPlaceEnter(player, actor, placeIndex);

        // Intro messages here
        #region Welcome msgs
        // these 2 work fine
        sendChatMessageTo(player, new string[] { "ru" }, "Good luck and have fun!", null);
        sendChatMessageTo(player, "ru", "Удачного вылета!", null);

        // NET settings msg - do not work on dedicated server, works on hosted server for host at least
        // prevents several lines of code from execution, e.g. current109s++ does not work

        sendScreenMessageTo(player, new string[] { "ru" }, "Please set your NET speed to ISDN in game network settings. This is needed for server testing purposes.", null);
        sendScreenMessageTo(player, "ru", "Пожалуйста, поставьте в настройках игры скорость сети 'ISDN'. Это нужно для тестирования сервера.", null);
        Timeout(7, () => // 2nd part
        {
            sendScreenMessageTo(player, new string[] { "ru" }, "Please report on 1C Clifs of Dover forums if this helps reducing lag.", null);
            sendScreenMessageTo(player, "ru", "Пожалуйста, сообщите на форуме sukhoi.ru уменьшает ли это лаги.", null);
        });
        sendChatMessageTo(player, new string[] { "ru" }, "Please set your NET speed to ISDN in game network settings. This is needed for server testing purposes. Please report on 1C forums if this helps reducing lag.", null);
        sendChatMessageTo(player, "ru", "Пожалуйста, поставьте в настройках игры скорость сети 'ISDN'. Это нужно для тестирования сервера. Пожалуйста, сообщите на форуме sukhoi.ru уменьшает ли это лаги.", null);

        Timeout(20, () => // works fine
        {
            msgCurrentObjectives(player);            // current objectives
        });


FG28_Kodiak 10-12-2011 09:19 AM

Could you change the message for testing please, seems it's a problem with the string, may be to long or the 'ISDN' :confused:

Ataros 10-12-2011 09:22 AM

Quote:

Originally Posted by FG28_Kodiak (Post 348125)
Could you change the message for testing please, seems it's a problem with the string, may be to long or the 'ISDN' :confused:

I'll try it now.

2nd issue still remains. I see all messages from OnTickGame ONLY in server log but not on screen because they are sent only to server, not to remote players.

Code:

[13:17:48]        Server to [Server]: Please leave your feedback at forum.1cpublishing.eu in CloD section. We highly appreciate it!

FG28_Kodiak 10-12-2011 09:31 AM

Could it be that GamePlay.gpPlayer is the server on dedicated?

Could you please test it with:
Code:

using System;
using System.Collections;
using System.Collections.Generic;
using maddox.game;
using maddox.game.world;


public class Mission : AMission
{

    #region MessageSystem

    private void sendScreenMessageTo(int army, string msg, object[] parms)
    {
        List<Player> Players = new List<Player>();

        //Singleplayer or Dedi Server
        if (GamePlay.gpPlayer() != null)
        {
                if (GamePlay.gpPlayer().Army() == army || army == -1)
                    Players.Add(GamePlay.gpPlayer());
        } // Multiplayer
        if (GamePlay.gpRemotePlayers() != null || GamePlay.gpRemotePlayers().Length > 0)
        {
            foreach (Player p in GamePlay.gpRemotePlayers())
            {
                if (p.Army() == army || army == -1)
                    Players.Add(p);
            }
        }
        if (Players != null && Players.Count > 0)
            GamePlay.gpHUDLogCenter(Players.ToArray(), msg, parms);
    }


    private void sendChatMessageTo(int army, string msg, object[] parms)
    {
        List<Player> Players = new List<Player>();

        //Singleplayer or Dedi Server
        if (GamePlay.gpPlayer() != null)
        {
            if (GamePlay.gpPlayer().Army() == army || army == -1)
                Players.Add(GamePlay.gpPlayer());
        } // Multiplayer
        if (GamePlay.gpRemotePlayers() != null || GamePlay.gpRemotePlayers().Length > 0)
        {
            foreach (Player p in GamePlay.gpRemotePlayers())
            {
                if (p.Army() == army || army == -1)
                    Players.Add(p);
            }
        }
        if (Players != null && Players.Count > 0)
            GamePlay.gpLogServer(Players.ToArray(), msg, parms);
    }


    private void sendScreenMessageTo(int army, string playerlanguage, string msg, object[] parms)
    {
        List<Player> Players = new List<Player>();

        //Singleplayer or Dedi Server
        if (GamePlay.gpPlayer() != null)
        {
            if ((GamePlay.gpPlayer().Army() == army || army == -1) && GamePlay.gpPlayer().LanguageName().Equals(playerlanguage))
                Players.Add(GamePlay.gpPlayer());
        } // Multiplayer
        if (GamePlay.gpRemotePlayers() != null || GamePlay.gpRemotePlayers().Length > 0)
        {
            foreach (Player p in GamePlay.gpRemotePlayers())
            {
                if ((p.Army() == army || army == -1) && p.LanguageName().Equals(playerlanguage))
                    Players.Add(p);
            }
        }
        if (Players != null && Players.Count > 0)
            GamePlay.gpHUDLogCenter(Players.ToArray(), msg, parms);
    }


    private void sendChatMessageTo(int army, string playerlanguage, string msg, object[] parms)
    {
        List<Player> Players = new List<Player>();

        //Singleplayer or Dedi Server
        if (GamePlay.gpPlayer() != null)
        {
            if ((GamePlay.gpPlayer().Army() == army || army == -1) && GamePlay.gpPlayer().LanguageName().Equals(playerlanguage))
                Players.Add(GamePlay.gpPlayer());
        } // Multiplayer
        if (GamePlay.gpRemotePlayers() != null || GamePlay.gpRemotePlayers().Length > 0)
        {
            foreach (Player p in GamePlay.gpRemotePlayers())
            {
                if ((p.Army() == army || army == -1) && p.LanguageName().Equals(playerlanguage))
                    Players.Add(p);
            }
        }
        if (Players != null && Players.Count > 0)
            GamePlay.gpLogServer(Players.ToArray(), msg, parms);
    }


    private void sendChatMessageTo(int army, string[] exepttoplayerlanguages, string msg, object[] parms)
    {
        List<Player> Players = new List<Player>();

        //Singleplayer or Dedi Server
        if (GamePlay.gpPlayer() != null)
        {
            if (GamePlay.gpPlayer().Army() == army || army == -1)
                Players.Add(GamePlay.gpPlayer());
        } // Multiplayer
        if (GamePlay.gpRemotePlayers() != null || GamePlay.gpRemotePlayers().Length > 0)
        {
            foreach (Player p in GamePlay.gpRemotePlayers())
            {
                if (p.Army() == army || army == -1)
                    Players.Add(p);
            }
        }

        foreach (string st in exepttoplayerlanguages)
        {
            Players.RemoveAll(item => item.LanguageName().Equals(st));
        }

        if (Players != null && Players.Count > 0)
            GamePlay.gpLogServer(Players.ToArray(), msg, parms);
    }


    private void sendScreenMessageTo(int army, string[] exepttoplayerlanguages, string msg, object[] parms)
    {
        List<Player> Players = new List<Player>();

        foreach (string st in exepttoplayerlanguages)
        {
            //Singleplayer or Dedi Server
            if (GamePlay.gpPlayer() != null)
            {
                if (GamePlay.gpPlayer().Army() == army || army == -1)
                    Players.Add(GamePlay.gpPlayer());
            } // Multiplayer
            if (GamePlay.gpRemotePlayers() != null || GamePlay.gpRemotePlayers().Length > 0)
            {
                foreach (Player p in GamePlay.gpRemotePlayers())
                {
                    if (p.Army() == army || army == -1)
                        Players.Add(p);
                }
            }
        }
        foreach (string st in exepttoplayerlanguages)
        {
            Players.RemoveAll(item => item.LanguageName().Equals(st));
        }

        if (Players != null && Players.Count > 0)
            GamePlay.gpHUDLogCenter(Players.ToArray(), msg, parms);
    }


    private void sendChatMessageTo(Player player, string msg, object[] parms)
    {
        if (player != null)
            GamePlay.gpLogServer(new Player[] { player }, msg, parms);
    }


    private void sendScreenMessageTo(Player player, string msg, object[] parms)
    {
        if (player != null)
            GamePlay.gpHUDLogCenter(new Player[] { player }, msg, parms);
    }


    private void sendChatMessageTo(Player player, string playerlanguage, string msg, object[] parms)
    {
        if (player != null)
            if (player.LanguageName().Equals(playerlanguage))
                GamePlay.gpLogServer(new Player[] { player }, msg, parms);
    }


    private void sendScreenMessageTo(Player player, string playerlanguage, string msg, object[] parms)
    {
        if (player != null)
            if (player.LanguageName().Equals(playerlanguage))
                GamePlay.gpHUDLogCenter(new Player[] { player }, msg, parms);
    }
   
   
    private void sendChatMessageTo(Player player, string[] exepttoplayerlanguages, string msg, object[] parms)
    {

        List<Player> Players = new List<Player>();
       
        if (player != null)
            Players.Add(player);   
       
        foreach (string st in exepttoplayerlanguages)
        {
            if(Players != null)
                Players.RemoveAll(item => item.LanguageName().Equals(st));
        }

        if (Players != null && Players.Count > 0)
            GamePlay.gpLogServer(Players.ToArray(), msg, parms);
    }
 
 
    private void sendScreenMessageTo(Player player, string[] exepttoplayerlanguages, string msg, object[] parms)
    {
        List<Player> Players = new List<Player>();
       
        if (player != null)
            Players.Add(player);   
       
        foreach (string st in exepttoplayerlanguages)
        {
            if (Players != null)
                Players.RemoveAll(item => item.LanguageName().Equals(st));
        }

        if (Players != null && Players.Count > 0)
            GamePlay.gpHUDLogCenter(Players.ToArray(), msg, parms);
    }
   
    #endregion

}


Ataros 10-12-2011 10:56 AM

The 1st problem with errors is solved! The chat message was too long.
Thank you!

Quote:

Originally Posted by FG28_Kodiak (Post 348130)
Could it be that GamePlay.gpPlayer is the server on dedicated?

It can be. But I am joining the server as 3GIAP_Atas and do not get the message that server gets :) you can try it on R2 now. You will not receive the message probably.

Thanks, will test soon.

EDIT. Ah, 10 people are playing can not restart now ((.

FG28_Kodiak 10-12-2011 10:59 AM

Ok i found out how to run a dedicated Server on my own Computer, so i can test it by my self ;)

Ataros 10-12-2011 11:01 AM

Quote:

Originally Posted by FG28_Kodiak (Post 348179)
Ok i found out how to run a dedicated Server on my own Computer, so i can test it by my self ;)

Thanks! Edited the previous message saying that the 1st problem is solved. Chat message was too long.

BTW you can join your own dedicated server from the same PC with your client if you run the dedi via a shortcut (creating a windows shortcut for a dedi with -server in properties).

FG28_Kodiak 10-12-2011 11:17 AM

Yes i get the english messages at my private testserver.
Btw the messages are to long for my screen resolution (19' 1280*1024), so i can't see the begin and the end of the message.

I also get the OnTickGame Messages (with my latest version), good to know that GamePlay.gpPlayer() is the server so we can send testmessages to the LOG. ;)
But i ever think gpPlayer is for Singleplayer and gpRemotePlayer is for Multiplayer, so sorry for the inconvenience :(

SO latest Version:
Code:

using System;
using System.Collections;
using System.Collections.Generic;
using maddox.game;
using maddox.game.world;


public class Mission : AMission
{

    #region MessageSystem

    private void sendScreenMessageTo(int army, string msg, object[] parms)
    {
        List<Player> Players = new List<Player>();

        //Singleplayer or Dedi Server
        if (GamePlay.gpPlayer() != null)
        {
                if (GamePlay.gpPlayer().Army() == army || army == -1)
                    Players.Add(GamePlay.gpPlayer());
        } // Multiplayer
        if (GamePlay.gpRemotePlayers() != null || GamePlay.gpRemotePlayers().Length > 0)
        {
            foreach (Player p in GamePlay.gpRemotePlayers())
            {
                if (p.Army() == army || army == -1)
                    Players.Add(p);
            }
        }
        if (Players != null && Players.Count > 0)
            GamePlay.gpHUDLogCenter(Players.ToArray(), msg, parms);
    }


    private void sendChatMessageTo(int army, string msg, object[] parms)
    {
        List<Player> Players = new List<Player>();

        //Singleplayer or Dedi Server
        if (GamePlay.gpPlayer() != null)
        {
            if (GamePlay.gpPlayer().Army() == army || army == -1)
                Players.Add(GamePlay.gpPlayer());
        } // Multiplayer
        if (GamePlay.gpRemotePlayers() != null || GamePlay.gpRemotePlayers().Length > 0)
        {
            foreach (Player p in GamePlay.gpRemotePlayers())
            {
                if (p.Army() == army || army == -1)
                    Players.Add(p);
            }
        }
        if (Players != null && Players.Count > 0)
            GamePlay.gpLogServer(Players.ToArray(), msg, parms);
    }


    private void sendScreenMessageTo(int army, string playerlanguage, string msg, object[] parms)
    {
        List<Player> Players = new List<Player>();

        //Singleplayer or Dedi Server
        if (GamePlay.gpPlayer() != null)
        {
            if ((GamePlay.gpPlayer().Army() == army || army == -1) && GamePlay.gpPlayer().LanguageName().Equals(playerlanguage))
                Players.Add(GamePlay.gpPlayer());
        } // Multiplayer
        if (GamePlay.gpRemotePlayers() != null || GamePlay.gpRemotePlayers().Length > 0)
        {
            foreach (Player p in GamePlay.gpRemotePlayers())
            {
                if ((p.Army() == army || army == -1) && p.LanguageName().Equals(playerlanguage))
                    Players.Add(p);
            }
        }
        if (Players != null && Players.Count > 0)
            GamePlay.gpHUDLogCenter(Players.ToArray(), msg, parms);
    }


    private void sendChatMessageTo(int army, string playerlanguage, string msg, object[] parms)
    {
        List<Player> Players = new List<Player>();

        //Singleplayer or Dedi Server
        if (GamePlay.gpPlayer() != null)
        {
            if ((GamePlay.gpPlayer().Army() == army || army == -1) && GamePlay.gpPlayer().LanguageName().Equals(playerlanguage))
                Players.Add(GamePlay.gpPlayer());
        } // Multiplayer
        if (GamePlay.gpRemotePlayers() != null || GamePlay.gpRemotePlayers().Length > 0)
        {
            foreach (Player p in GamePlay.gpRemotePlayers())
            {
                if ((p.Army() == army || army == -1) && p.LanguageName().Equals(playerlanguage))
                    Players.Add(p);
            }
        }
        if (Players != null && Players.Count > 0)
            GamePlay.gpLogServer(Players.ToArray(), msg, parms);
    }


    private void sendChatMessageTo(int army, string[] exepttoplayerlanguages, string msg, object[] parms)
    {
        List<Player> Players = new List<Player>();

        //Singleplayer or Dedi Server
        if (GamePlay.gpPlayer() != null)
        {
            if (GamePlay.gpPlayer().Army() == army || army == -1)
                Players.Add(GamePlay.gpPlayer());
        } // Multiplayer
        if (GamePlay.gpRemotePlayers() != null || GamePlay.gpRemotePlayers().Length > 0)
        {
            foreach (Player p in GamePlay.gpRemotePlayers())
            {
                if (p.Army() == army || army == -1)
                    Players.Add(p);
            }
        }

        foreach (string st in exepttoplayerlanguages)
        {
            Players.RemoveAll(item => item.LanguageName().Equals(st));
        }

        if (Players != null && Players.Count > 0)
            GamePlay.gpLogServer(Players.ToArray(), msg, parms);
    }


    private void sendScreenMessageTo(int army, string[] exepttoplayerlanguages, string msg, object[] parms)
    {
        List<Player> Players = new List<Player>();

        foreach (string st in exepttoplayerlanguages)
        {
            //Singleplayer or Dedi Server
            if (GamePlay.gpPlayer() != null)
            {
                if (GamePlay.gpPlayer().Army() == army || army == -1)
                    Players.Add(GamePlay.gpPlayer());
            } // Multiplayer
            if (GamePlay.gpRemotePlayers() != null || GamePlay.gpRemotePlayers().Length > 0)
            {
                foreach (Player p in GamePlay.gpRemotePlayers())
                {
                    if (p.Army() == army || army == -1)
                        Players.Add(p);
                }
            }
        }
        foreach (string st in exepttoplayerlanguages)
        {
            Players.RemoveAll(item => item.LanguageName().Equals(st));
        }

        if (Players != null && Players.Count > 0)
            GamePlay.gpHUDLogCenter(Players.ToArray(), msg, parms);
    }


    private void sendChatMessageTo(Player player, string msg, object[] parms)
    {
        if (player != null)
            GamePlay.gpLogServer(new Player[] { player }, msg, parms);
    }


    private void sendScreenMessageTo(Player player, string msg, object[] parms)
    {
        if (player != null)
            GamePlay.gpHUDLogCenter(new Player[] { player }, msg, parms);
    }


    private void sendChatMessageTo(Player player, string playerlanguage, string msg, object[] parms)
    {
        if (player != null)
            if (player.LanguageName().Equals(playerlanguage))
                GamePlay.gpLogServer(new Player[] { player }, msg, parms);
    }


    private void sendScreenMessageTo(Player player, string playerlanguage, string msg, object[] parms)
    {
        if (player != null)
            if (player.LanguageName().Equals(playerlanguage))
                GamePlay.gpHUDLogCenter(new Player[] { player }, msg, parms);
    }
   
   
    private void sendChatMessageTo(Player player, string[] exepttoplayerlanguages, string msg, object[] parms)
    {

        List<Player> Players = new List<Player>();
       
        if (player != null)
            Players.Add(player);   
       
        foreach (string st in exepttoplayerlanguages)
        {
            if(Players != null)
                Players.RemoveAll(item => item.LanguageName().Equals(st));
        }

        if (Players != null && Players.Count > 0)
            GamePlay.gpLogServer(Players.ToArray(), msg, parms);
    }
 
 
    private void sendScreenMessageTo(Player player, string[] exepttoplayerlanguages, string msg, object[] parms)
    {
        List<Player> Players = new List<Player>();
       
        if (player != null)
            Players.Add(player);   
       
        foreach (string st in exepttoplayerlanguages)
        {
            if (Players != null)
                Players.RemoveAll(item => item.LanguageName().Equals(st));
        }

        if (Players != null && Players.Count > 0)
            GamePlay.gpHUDLogCenter(Players.ToArray(), msg, parms);
    }
   
    #endregion

}


Ataros 10-12-2011 12:05 PM

Thank you very much! Will try to install it tonight.

Ataros 10-12-2011 01:39 PM

All messages work finally (in Russian at least)! Runs on Repka 2 now. Thank you very much!

Ataros 10-12-2011 05:57 PM

What these errors can be related? Just had server launcher crash some time after these errors.

Code:

[21:44:59]       
[21:44:59]        =================================================
[21:44:59]        System.NullReferenceException: Object reference not set to an instance of an object.
[21:44:59]       
[21:44:59]        Server stack trace:
[21:44:59]          at Mission.OnPlaceLeave(Player player, AiActor actor, Int32 placeIndex)
[21:44:59]          at maddox.game.ABattle.OnPlaceLeave(Player player, AiActor actor, Int32 placeIndex)
[21:44:59]          at maddox.game.ABattle.OnEventGame(GameEventId eventId, Object eventArg0, Object eventArg1, Int32 eventArgInt)
[21:44:59]          at maddox.game.world.Strategy.OnEventGame(GameEventId eventId, Object eventArg0, Object eventArg1, Int32 eventArgInt)
[21:44:59]          at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
[21:44:59]          at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)
[21:44:59]       
[21:44:59]        Exception rethrown at [0]:
[21:44:59]          at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
[21:44:59]          at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
[21:44:59]          at maddox.game.IBattle.OnEventGame(GameEventId eventId, Object eventArg0, Object eventArg1, Int32 eventArgInt)
[21:44:59]          at maddox.game.GameDef.eventGame(GameEventId eventId, Object eventArg0, Object eventArg1, Int32 eventArgInt)
[21:44:59]          at dp8K7ffZC2JmTFxNtum.gkydOifm2sRXchrPjNC.eventGame(GameEventId , Object , Object , Int32 )
[21:44:59]          at tpZkklAJjTISdGT144j.fBZFTNAMvsuuP0ewCS3.AY6A72gxK6R(GameEventId , Object , Object , Int32 )
[21:44:59]        =================================================
[21:44:59]        Server: vist is now with the Blue army.


FG28_Kodiak 10-12-2011 06:03 PM

Nothing to do with my part,
something in OnPlaceLeave going wrong.

You should test actor for null value:

if (actor != null) //missing
{
if ((actor as AiAircraft).InternalTypeName() == "bob:Aircraft.DH82A")
...
}

Ataros 10-12-2011 06:28 PM

Thank you very much! It's a hard science for me, ahh...

Octocat 12-06-2011 09:41 AM

You can declare a function as:

private void sendScreenMessageTo(int army, string msg, params object[] parms)

then array for the parameters will be generated automatically, the call will be easier to look:

sendScreenMessageTo(myarmy, "I am at grid {0}, {1}", xpos, ypos);


Also, lowercase first letter in class or function name is Java style, not C#. Microsoft C# Code Design Guidelines.

FG28_Kodiak 12-06-2011 01:50 PM

I use lowercase first letters for private methods and uppercase for public, thats all. And i am not interested in "Style Guidlines" from Microsoft.

And i don't use the params parameter to avoid confusion between
(GamePlay)
void gpLogServer(Player[] to, string format, object[] args);
and my methods.

btw.
Welcome to the forum!

Octocat 12-06-2011 02:22 PM

Thank you.

As we say: our business - to offer, your - to refuse. In the end, everyone chooses his own way. ;)

KDN 12-07-2011 01:23 PM

I am trying to use the \n within the " " of a sting to create a new line for long screen messages and it seems that I am not getting it right.
for example:
SendScreenMessageTo(1, "Note\nPress TAB and 4 at ANY time\nLoad any submission available in the list");

Any idea what I might be missing?

FG28_Kodiak 12-07-2011 01:47 PM

It's not possible.
GamePlay.gpHUDLogCenter(..) doesn't support it, i've tried it too ;).

You can use the timeout command to show one message after another.

Code:

SendScreenMessageTo(1, "Note");

Timeout(5, () =>    // Time in Seconds
{
    SendScreenMessageTo(1, "Press TAB and 4 at ANY time");
});
Timeout(10, () =>   
{
SendScreenMessageTo(1, "Load any submission available in the list");
});

etc.

KDN 12-07-2011 01:57 PM

Thaaaaaaank you!!
I will do just that :)

podvoxx 01-12-2012 09:30 AM

to Kodiak
Hi! I use your script to send messages:

Code:

sendChatMessageTo(-1, "blablabla", new object[] { }); //TEST
sendScreenMessageTo(-1, "blablabla", new object[] { }); //TEST

Code:

private void sendScreenMessageTo(int army, string msg, object[] parms)
    {
        List<Player> Players = new List<Player>();

        //Singleplayer or Dedi Server
        if (GamePlay.gpPlayer() != null)
        {
                if (GamePlay.gpPlayer().Army() == army || army == -1)
                    Players.Add(GamePlay.gpPlayer());
        } // Multiplayer
        if (GamePlay.gpRemotePlayers() != null || GamePlay.gpRemotePlayers().Length > 0)
        {
            foreach (Player p in GamePlay.gpRemotePlayers())
            {
                if (p.Army() == army || army == -1)
                    Players.Add(p);
            }
        }
        if (Players != null && Players.Count > 0)
            GamePlay.gpHUDLogCenter(Players.ToArray(), msg, parms);
    }


    private void sendChatMessageTo(int army, string msg, object[] parms)
    {
        List<Player> Players = new List<Player>();

        //Singleplayer or Dedi Server
        if (GamePlay.gpPlayer() != null)
        {
            if (GamePlay.gpPlayer().Army() == army || army == -1)
                Players.Add(GamePlay.gpPlayer());
        } // Multiplayer
        if (GamePlay.gpRemotePlayers() != null || GamePlay.gpRemotePlayers().Length > 0)
        {
            foreach (Player p in GamePlay.gpRemotePlayers())
            {
                if (p.Army() == army || army == -1)
                    Players.Add(p);
            }
        }
        if (Players != null && Players.Count > 0)
            GamePlay.gpLogServer(Players.ToArray(), msg, parms);
    }

Code:

[21:56:12]        =================================================
[21:56:12]        System.NullReferenceException: Object reference not set to an instance of an object.
[21:56:12]       
[21:56:12]        Server stack trace:
[21:56:12]          at 6UZP66dp5dKAdD5LMYr.F9pJL9dGtcbAt8r8Umh.JwjWWYN9w9(xnKDxkk8wATA33F3hpA , G7xPRi2e9fpuLtHG23a )
[21:56:12]          at 5iyST5gABhh0WhImZtw.4W7PgSgvHpySuqonJno.sp1UnA9jmwb(Player[] , String , Object[] , Double )
[21:56:12]          at 5iyST5gABhh0WhImZtw.4W7PgSgvHpySuqonJno.yEy1eAe2YPQxskLBZIku(Object , Object , Object , Double )
[21:56:12]          at 5iyST5gABhh0WhImZtw.4W7PgSgvHpySuqonJno.d87UnNOmgnm(Player[] , String , Object[] )
[21:56:12]          at pqlnUTF7gnMAoU4L9MP.lm1GgkFoiOOBGu1gmwf.ZnhKPrKgxsgJUIGtmgOK(Object , Object , Object )
[21:56:12]          at pqlnUTF7gnMAoU4L9MP.lm1GgkFoiOOBGu1gmwf.HUDLogCenter(Player[] , String , Object[] )
[21:56:12]          at maddox.game.GameDef.gpHUDLogCenter(Player[] to, String msg, Object[] parms)
[21:56:12]          at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
[21:56:12]          at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)
[21:56:12]       
[21:56:12]        Exception rethrown at [0]:
[21:56:12]          at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
[21:56:12]          at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
[21:56:12]          at maddox.game.IGamePlay.gpHUDLogCenter(Player[] to, String msg, Object[] parms)
[21:56:12]          at Mission.sendScreenMessageTo(Int32 army, String msg, Object[] parms)
[21:56:12]          at Mission.OnActorDead(Int32 missionNumber, String shortName, AiActor actor, List`1 damages)
[21:56:12]          at maddox.game.world.Strategy.OnActorDead(Int32 missionNumber, String shortName, AiActor actor, AiDamageInitiator initiator)
[21:56:12]          at maddox.game.ABattle.OnEventGame(GameEventId eventId, Object eventArg0, Object eventArg1, Int32 eventArgInt)
[21:56:12]          at maddox.game.world.Strategy.OnEventGame(GameEventId eventId, Object eventArg0, Object eventArg1, Int32 eventArgInt)
[21:56:12]          at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
[21:56:12]          at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)
[21:56:12]       
[21:56:12]        Exception rethrown at [1]:
[21:56:12]          at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
[21:56:12]          at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
[21:56:12]          at maddox.game.IBattle.OnEventGame(GameEventId eventId, Object eventArg0, Object eventArg1, Int32 eventArgInt)
[21:56:12]          at maddox.game.GameDef.eventGame(GameEventId eventId, Object eventArg0, Object eventArg1, Int32 eventArgInt)
[21:56:12]          at RoFTf9069W6jWRmA8PN.U2RoVL0OVdWjVQJ7319.eventGame(GameEventId , Object , Object , Int32 )
[21:56:12]          at NTlYp6NdtgpnKt7wGgO.VvFELvNie2My3mOTesk.WPGBQuHHKI8(GameEventId , Object , Object , Int32 )
[21:56:12]        =================================================

It occurs in the method OnActorDead()
Code:

public void messageTaskComplite(int numberDeadUnit, int taskPrice, int armyTask, string msg)
    {
        sendChatMessageTo(-1, getLocalizedMessage(msg) + "[ {0} ]", new object[] { numberDeadUnit });
        sendScreenMessageTo(-1, getLocalizedMessage(msg), new object[] { });
        if (armyTask == 1)
        {
            sendChatMessageTo(-1, getLocalizedMessage("getPointsRED") + "[ {0} ]", new object[] { taskPrice });
        }
        else if (armyTask == 2)
        {
            sendChatMessageTo(-1, getLocalizedMessage("getPointsBLUE") + "[ {0} ]", new object[] { taskPrice });
        }
    }

Code:

public override void OnActorDead(int missionNumber, string shortName, AiActor actor, List<DamagerScore> damages)
        {
                base.OnActorDead(missionNumber, shortName, actor, damages);
        //sendChatMessageTo(-1, actor.ToString(), new object[] { }); //TEST       
        if (actor != null)
        {
            //AiGroundActor STATISTIC
            if (actor is AiGroundActor)
            {
                sendChatMessageTo(-1, "***Plane KILL - AiAircraft:....." + shortName, new object[] { });  //TEST
                    AiGroundActor groundActor = actor as AiGroundActor;
                if (groundActor != null)
                {
                    //sendChatMessageTo(-1, groundActor.ToString(), new object[] { }); //TEST
                    //tasks AiGroundActor DEAD stat
                    switch (missionNumber)
                    {
                        case 1:
                            if (actor.Army() == 2)
                            {                               
                                if (groundActor.Type() == AiGroundActorType.Artillery)
                                {
                                    numberDeadUnit01_1++;
                                    if (numberDeadUnit01_1 == numberCompliteTask01_1)
                                    {
                                        messageTaskComplite(numberDeadUnit01_1, taskPrice01_1, 1, "successMission01_1");                                       
                                        redScore = redScore + taskPrice01_1;
                                        taskStatusArray.SetValue(true, 0);
                                    }
                                }
                                else
                                {
                                    numberDeadUnit01_2++;
                                    if (numberDeadUnit01_2 == numberCompliteTask01_2)
                                    {
                                        messageTaskComplite(numberDeadUnit01_2, taskPrice01_2, 1, "successMission01_2");                                       
                                        redScore = redScore + taskPrice01_2;
                                        taskStatusArray.SetValue(true, 1);
                                    }
                                }
                            }         
                            break;                                     
                    } //switch
                   
            //AiAircraft STATISTIC
            if (actor is AiAircraft)
            {
                sendChatMessageTo(-1, "***Plane KILL - AiAircraft:....." + shortName, new object[] { });  //TEST
                    AiAircraft aircraft = (actor as AiAircraft);
                if (aircraft != null)
                {
                    // Main AiAircraft plane stat
                    if (aircraft.Army() == 1)
                    {
                        numberDeadRedPlanes++;
                        blueScore = blueScore + unitPlanePrice;
                    }
                    else if (aircraft.Army() == 2 && aircraft != null)
                    {
                        numberDeadBluePlanes++;
                        redScore = redScore + unitPlanePrice;
                    }     
                }               
            }           
        }//null
        }

But i have problem on dedi server. On multiplayer and single all works fine. On dedi - HUD message don`t work...
What method do I need to use on the dedi server?

getLocalizedMessage("getPointsRED") turn off(always "en")

FG28_Kodiak 01-12-2012 12:11 PM

Can you test these please, i ve made some rework meanwhile:

Code:

    private void sendScreenMessageTo(int army, string msg, params object[] args)
    {
        List<Player> Consignees = new List<Player>();

        if (GamePlay.gpPlayer() != null)
            Consignees.Add(GamePlay.gpPlayer());
        if (GamePlay.gpRemotePlayers() != null)
            Consignees.AddRange(GamePlay.gpRemotePlayers());

        if (army == -1)
            GamePlay.gpHUDLogCenter(null, msg, args);
        else if (Consignees.Exists(item => item.Army() == army))
            GamePlay.gpHUDLogCenter(Consignees.FindAll(item => item.Army() == army).ToArray(), msg, args);
    }


    private void sendChatMessageTo(int army, string msg, params object[] args)
    {
        List<Player> Consignees = new List<Player>();

        if (GamePlay.gpPlayer() != null)
            Consignees.Add(GamePlay.gpPlayer());
        if (GamePlay.gpRemotePlayers() != null)
            Consignees.AddRange(GamePlay.gpRemotePlayers());

        if (army == -1)
            GamePlay.gpLogServer(null, msg, args);
        else if (Consignees.Exists(item => item.Army() == army))
            GamePlay.gpLogServer(Consignees.FindAll(item => item.Army() == army).ToArray(), msg, args);
    }

you can use it now without "new object[]{...}", simply use your variables.

example
int redpoints =10;
int bluepoints =20;

sendScreenMessageTo(-1, "Red have {0} Points / Blue: {1} Points", redpoints, bluepoints);
or use it without
sendScreenMessageTo(-1, "Welcome to our Server");

podvoxx 01-12-2012 05:09 PM

Quote:

Originally Posted by FG28_Kodiak (Post 378652)
Can you test these please, i ve made some rework meanwhile:

you can use it now without "new object[]{...}", simply use your variables.

Thank you very much for your help! Msg system work fine.


All times are GMT. The time now is 09:15 AM.

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