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 05-15-2012, 09:55 PM
king1hw king1hw is offline
Approved Member
 
Join Date: Jul 2010
Posts: 64
Default HudLog Question

Ok in the info below how do I send the hudlog to each individual team:

public override void OnTickGame()
{
if (Time.tickCounter() % 540000 == 27000) // 108000 = 60 min repeat, 27000 = 15 min delay.
{
GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/July1940_v10/Missionen/Mission2.mis");
GamePlay.gpHUDLogCenter(null, "RAF fly CAP between Calais and Dover. Minutes left: {0}", new object[] {});
GamePlay.gpHUDLogCenter(null, "LW meet a flight of Do17s 5000m over Calais in appr. {0} min.!\nEscort them to Dover!", new object[] {});
}
}

I would like to send the messages to each team and not to all. Is this possible.

King
Reply With Quote
  #2  
Old 05-15-2012, 10:34 PM
Smokeynz Smokeynz is offline
Approved Member
 
Join Date: Apr 2011
Posts: 106
Default

I use this, slight variation to other methods, which are similar.

Note for arguments, like a set time you added, you need to place the value you want in the new object , note I set "timevalue"
Note: for screen hud messages, to avoid messages overwritting each other on screen to quickly, you add a timeout to delay the writtern message.

My version displays on screen and in log, so the message can be recalled by player.

Code:
ScreenMsg(-1, "MissionMessageToALL");
Timeout(2.0, () =>
{
   ScreenMsg(1, "RAF fly CAP between Calais and Dover");
   ScreenMsg(2, "LW meet a flight of Do17s 5000m over Calais in appr. {0} min.! Escort them", new object[] { timevalue });
 });

Code:
private void ScreenMsg(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);
            GamePlay.gpLogServer(null, msg, args);
        }
        else if (Consignees.Exists(item => item.Army() == army))
        {
            GamePlay.gpHUDLogCenter(Consignees.FindAll(item => item.Army() == army).ToArray(), msg, args);
            GamePlay.gpLogServer(Consignees.FindAll(item => item.Army() == army).ToArray(), msg, args);
        }
    }
Reply With Quote
  #3  
Old 05-16-2012, 01:02 AM
king1hw king1hw is offline
Approved Member
 
Join Date: Jul 2010
Posts: 64
Default OK new at this!

Which one goes where?

you gave me 2 code posts:

So should I set up a Private line like:

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

public class Mission : AMission
{
Stopwatch MissionTimer1M1 = new Stopwatch();

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

//MissionNumberListener = -1;

MissionTimer1M1.Reset();
MissionTimer1M1.Start();
}

//-----------------------------------------------------------------------------------------------
//Section 1: Trigger Nachrichten

public override void OnTrigger(int missionNumber, string shortName, bool active)
{
base.OnTrigger(missionNumber, shortName, active);

if (("ScoreBlue50".Equals(shortName) && active) && (MissionTimer1M1.Elapsed.Minutes <= 5 ) //Trigger 1 Nachricht
{
GamePlay.gpHUDLogCenter("Blue succeeded and sunk 3 red tanker");
GamePlay.gpGetTrigger(shortName).Enable = false;
}

if (("ScoreRed100".Equals(shortName) && active) && (MissionTimer1M1.Elapsed.Minutes <= 5 ) //Trigger 1 Nachricht
{
GamePlay.gpHUDLogCenter("Red successfully reconnoiter LeHavre");
GamePlay.gpGetTrigger(shortName).Enable = false;
}

if (("ScoreRed50".Equals(shortName) && active) && (MissionTimer1M1.Elapsed.Minutes <= 5 ) //Trigger 2 Nachricht
{
GamePlay.gpHUDLogCenter("Red succeeded and shot down 20% blue bomber");
GamePlay.gpGetTrigger(shortName).Enable = false;
}

if ("Trigger1All".Equals(shortName) && active) //Trigger 2 Nachricht
{
GamePlay.gpHUDLogCenter("German build-up plotted near Cherbourg (AD6), heading N!");
GamePlay.gpGetTrigger(shortName).Enable = false;
}

}

public override void OnTickGame()
{
if (Time.tickCounter() % 540000 == 27000) // 108000 = 60 min repeat, 27000 = 15 min delay.
{
GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/July1940_v10/Missionen/Mission2.mis");
GamePlay.gpHUDLogCenter(null, "RAF fly CAP between Calais and Dover. Minutes left: {0}", new object[] {});
GamePlay.gpHUDLogCenter(null, "LW meet a flight of Do17s 5000m over Calais in appr. {0} min.!\nEscort them to Dover!", new object[] {});
}
}
//Section 4 : AI entfernen

public override void OnActorCreated(int missionNumber, string shortName, AiActor actor)
{
base.OnActorCreated(missionNumber, shortName, actor);
if (actor is AiGroundActor)
Timeout(3599, () =>
{
if (actor != null)
{ (actor as AiGroundActor).Destroy(); }
}
);
}

}
///////////////////////////////// Screen Message
private void ScreenMsg(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);
GamePlay.gpLogServer(null, msg, args);
}
else if (Consignees.Exists(item => item.Army() == army))
{
GamePlay.gpHUDLogCenter(Consignees.FindAll(item => item.Army() == army).ToArray(), msg, args);
GamePlay.gpLogServer(Consignees.FindAll(item => item.Army() == army).ToArray(), msg, args);
}
}
Reply With Quote
  #4  
Old 05-16-2012, 03:56 AM
Smokeynz Smokeynz is offline
Approved Member
 
Join Date: Apr 2011
Posts: 106
Default

your old code

Code:
public override void OnTickGame()
{ 
if (Time.tickCounter() % 540000 == 27000) // 108000 = 60 min repeat, 27000 = 15 min delay. 
{
GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/July1940_v10/Missionen/Mission2.mis");
GamePlay.gpHUDLogCenter(null, "RAF fly CAP between Calais and Dover. Minutes left: {0}", new object[] {});
GamePlay.gpHUDLogCenter(null, "LW meet a flight of Do17s 5000m over Calais in appr. {0} min.!\nEscort them to Dover!", new object[] {});
}
}

replace section with


Code:
int timevalue = 10; // a value for test purpose, set to what ever you require noting it could be a varible that changes

public override void OnTickGame()
{ 
if (Time.tickCounter() % 540000 == 27000) // 108000 = 60 min repeat, 27000 = 15 min delay. 
{
GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/July1940_v10/Missionen/Mission2.mis");

ScreenMsg(-1, "MissionMessageToALL");
Timeout(2.0, () =>
{
   ScreenMsg(1, "RAF fly CAP between Calais and Dover");
   ScreenMsg(2, "LW meet a flight of Do17s 5000m over Calais in appr. {0} min.! Escort them", new object[] { timevalue });
 });

}
}

The screen message method can go more or less anywhere in the code as its own block. Although must be between the "AMission".



Code:
public class Mission : AMission
{

///your code

private void ScreenMsg(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);
            GamePlay.gpLogServer(null, msg, args);
        }
        else if (Consignees.Exists(item => item.Army() == army))
        {
            GamePlay.gpHUDLogCenter(Consignees.FindAll(item => item.Army() == army).ToArray(), msg, args);
            GamePlay.gpLogServer(Consignees.FindAll(item => item.Army() == army).ToArray(), msg, args);
        }
    }

//note the wrapping bracket for AMission
}
C# runs in sequence within methods and classes, but outside each method, classes can more or less be in any order.(new to this myself so still getting to grips)

Last edited by Smokeynz; 05-16-2012 at 03:59 AM.
Reply With Quote
  #5  
Old 05-16-2012, 04:23 AM
Smokeynz Smokeynz is offline
Approved Member
 
Join Date: Apr 2011
Posts: 106
Default

I should note the method here is Kodiaks version, although I joined the serverlog and the Hud message into one.
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 02:13 AM.


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