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 06-11-2012, 02:40 AM
king1hw king1hw is offline
Approved Member
 
Join Date: Jul 2010
Posts: 64
Default RADAR Script

I was wondering if their is a script to give radar reports or a vector to targets. the one in July works but when multiple missions spawned it loses it.


Thanks
Reply With Quote
  #2  
Old 06-11-2012, 04:24 AM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

Can you descripe the problem better? Do you mean my script? Can you post your Missions which encountered the problem?
Reply With Quote
  #3  
Old 06-11-2012, 11:42 AM
king1hw king1hw is offline
Approved Member
 
Join Date: Jul 2010
Posts: 64
Default Radar

No worries working great just had to spread out mission load better 30 minutes in july is to close. I was also trying to remove the Mission loading capabilities so that they just loaded in a series I did this by adding the the OnBattle Start section and then in as a OnTickTime in each individual mission script how ever not getting the Hud to be displayed to each team try rewriting it myself but I am really not a C++ guy. So I just have stuck with what works. Log and no hub display at all, I can separate it to go to each team.

Basic add on to each mission script:
using System;
using maddox.game;
using maddox.game.world;
using System.Collections.Generic;
using System.Diagnostics;

public class Mission : AMission
{

Stopwatch MissionTimer1M2 = new Stopwatch();


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

//MissionNumberListener = -1;

MissionTimer1M2.Reset();
MissionTimer1M2.Start();
}

//Section 1: Trigger Nachrichten

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

if ("Trigger2All".Equals(shortName) && active)
{
AiAction action = GamePlay.gpGetAction("Trigger2All");
if (action != null)
{
action.Do();
}
GamePlay.gpGetTrigger(shortName).Enable = false;
}

if (("ScoreBlue50".Equals(shortName) && active) && (MissionTimer1M2.Elapsed.Minutes <= 5) //Trigger 1 Nachricht
{
GamePlay.gpHUDLogCenter("The LW succeeded and inflicted heavy damage on Port of Dover");
GamePlay.gpGetTrigger(shortName).Enable = false;
}

if (("ScoreRed51".Equals(shortName) && active) && (MissionTimer1M2.Elapsed.Minutes <= 5) //Trigger 1 Nachricht
{
GamePlay.gpHUDLogCenter("The RAF inflicted heavy losses on the LW bombers");
GamePlay.gpGetTrigger(shortName).Enable = false;
}

if (("ScoreRed49".Equals(shortName) && active) && (MissionTimer1M2.Elapsed.Minutes <= 5) //Trigger 2 Nachricht
{
GamePlay.gpHUDLogCenter("The RAF inflicted heavy losses on the LW bombers");
GamePlay.gpGetTrigger(shortName).Enable = false;
}
if (("ScoreRed100".Equals(shortName) && active) && (MissionTimer1M2.Elapsed.Minutes <= 5) //Trigger 2 Nachricht
{
GamePlay.gpHUDLogCenter("The German minelayer was successully stopped!");
GamePlay.gpGetTrigger(shortName).Enable = false;
}

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

}

public override void OnTickGame()
{
if (Time.tickCounter() % 1296000 == 72000) // 1296000 = 12 hour repeat, 72000 = 40 min delay.
{
GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/July1940_v10/Missionen/Mission2.mis");

double initTime = 0.0;
Timeout(initTime += 100, () =>
{
GamePlay.gpHUDLogCenter(null, "RAF fly CAP between Calais and Dover", new object[] {});
GamePlay.gpLogServer(null, "RAF fly CAP between Calais and Dover", new object[] {});
GamePlay.gpHUDLogCenter(null, "LW meet a flight of Do17s 5000m over Calais in appr. {0} min.! Escort them", new object[] {});
GamePlay.gpLogServer(null, "LW meet a flight of Do17s 5000m over Calais in appr. {0} min.! Escort them", new object[] {});
}
}

//Section 4 : AI remove

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

}



As you can see there is no space between messages and the first gets lost.

thank for working so hard to keep this sim in the air Kodiak.
Reply With Quote
  #4  
Old 06-11-2012, 12:35 PM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

Code:
GamePlay.gpHUDLogCenter(null, "RAF fly CAP between Calais and Dover", new object[] {});
GamePlay.gpLogServer(null, "RAF fly CAP between Calais and Dover", new object[] {});
GamePlay.gpHUDLogCenter(null, "LW meet a flight of Do17s 5000m over Calais in appr. {0} min.! Escort them", new object[] {});
GamePlay.gpLogServer(null, "LW meet a flight of Do17s 5000m over Calais in appr. {0} min.! Escort them", new object[] {});
Ok first problem, you use null as destination, this means the message goes to all players. First parameter is a array of players the message should go to. So you need an array of all blue and a array of all red players.

So we first want all players:
there are two methods
GamePlay.gpPlayer(), on Singleplayer and player hosted Missions this is the player(host), on Dedicated Servers this is the server (it's usefull you like to write messages in the serverlog without showing it to others, for error messages etc.)
For the other players you need
GamePlay.gpRemotePlayers() this will get you a array with all players connected to the server could be null so you should test for null value (no players) before use it.

So if you want all players create a list and add the players to it:
Code:
List<Player> players = new List<Player>();

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

So now we have all, but we need the reds and the blues, the player object has the Army() method red players are member of the army 1 and blues are army 2.

to get the reds:
Code:
Player[] Reds = players.FindAll(item => item.Army() == 1).ToArray();
to get the blues
Code:
Player[] Blues = players.FindAll(item => item.Army() == 2).ToArray();
so now we have the two groups
before using them we must check if there i min one player in the group
so
Code:
if(Reds.Length > 0)
...
if(Blues.Length > 0)
...
so now we can send the message to the different groups:
Code:
if(Reds.Length > 0)
{
GamePlay.gpHUDLogCenter(Reds, "RAF fly CAP between Calais and Dover", new object[] {});
GamePlay.gpLogServer(Reds, "RAF fly CAP between Calais and Dover", new object[] {});
}

if(Blues.Length > 0)
{
GamePlay.gpHUDLogCenter(Blues, "LW meet a flight of Do17s 5000m over Calais in appr. {0} min.! Escort them", new object[] {});
GamePlay.gpLogServer(Blues, "LW meet a flight of Do17s 5000m over Calais in appr. {0} min.! Escort them", new object[] {});
}

Complete:
Code:
List<Player> players = new List<Player>();

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

Player[] Reds = players.FindAll(item => item.Army() == 1).ToArray();
Player[] Blues = players.FindAll(item => item.Army() == 2).ToArray();

if(Reds.Length > 0)
{
GamePlay.gpHUDLogCenter(Reds, "RAF fly CAP between Calais and Dover", new object[] {});
GamePlay.gpLogServer(Reds, "RAF fly CAP between Calais and Dover", new object[] {});
}

if(Blues.Length > 0)
{
GamePlay.gpHUDLogCenter(Blues, "LW meet a flight of Do17s 5000m over Calais in appr. {0} min.! Escort them", new object[] {});
GamePlay.gpLogServer(Blues, "LW meet a flight of Do17s 5000m over Calais in appr. {0} min.! Escort them", new object[] {});
}
So how to make easy to use methods is on you, learning by doing or searching the forum (there is already a thread about this)
Reply With Quote
  #5  
Old 06-12-2012, 08:45 AM
king1hw king1hw is offline
Approved Member
 
Join Date: Jul 2010
Posts: 64
Default

Now it is coming up continuous and not stopping. how do I set a time for the message to then disappear?
Reply With Quote
  #6  
Old 06-12-2012, 10:18 AM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

Code:
GamePlay.gpHUDLogCenter(null, "Only two seconds visible", new object[]{}, 2);
last Argument in example: time in seconds (double)

ups missunderstood the question:

you must place the messages if used in OnTickGame in a if clause example:
Code:
public override void OnTickGame()
    {
        base.OnTickGame();

        if (Time.tickCounter() % 300 == 0) // every 10 sec.
        {
             // your code here
        }
    }
a tick is 1/30 sec.

Last edited by FG28_Kodiak; 06-12-2012 at 10:25 AM.
Reply With Quote
  #7  
Old 06-12-2012, 12:54 PM
king1hw king1hw is offline
Approved Member
 
Join Date: Jul 2010
Posts: 64
Default

public override void OnTickGame()
{
if (Time.tickCounter() % 864000 == 72000) // 864000 = 8 hour repeat, 72000 = 40 min delay.
{
GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/July1940_v10/Missionen/Mission5.mis");
}

/////////////////////////////////////////////Player Hub and Log Info
if (Time.tickCounter() % 300 == 0) // every 10 sec.
{
List<Player> players = new List<Player>();

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

Player[] Reds = players.FindAll(item => item.Army() == 1).ToArray();
Player[] Blues = players.FindAll(item => item.Army() == 2).ToArray();

if (Reds.Length > 0)
{
GamePlay.gpHUDLogCenter(Reds, "Cover our shipping south of Dover (AV22).", new object[] { });
GamePlay.gpLogServer(Reds, "Cover our shipping south of Dover (AV22).", new object[] { });
}

if (Blues.Length > 0)
{
GamePlay.gpHUDLogCenter(Blues, "LW Bombers leave Calais to raid shipping at appr. 4000m! Fly a fighter sweep over AV22!", new object[] { });
GamePlay.gpLogServer(Blues, "LW Bombers leave Calais to raid shipping at appr. 4000m! Fly a fighter sweep over AV22!", new object[] { });
}
}

So does this look right and thanks again for the help and yes I am really trying to learn this stuff.
Reply With Quote
  #8  
Old 06-25-2012, 02:49 PM
king1hw king1hw is offline
Approved Member
 
Join Date: Jul 2010
Posts: 64
Default does this look rt

public override void OnTickGame()
{
if (Time.tickCounter() % 864000 == 72000) // 864000 = 8 hour repeat, 72000 = 40 min delay.
{
GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/July1940_v10/Missionen/Mission2.mis");
{

List<Player> players = new List<Player>();
if (GamePlay.gpPlayer() != null)
players.Add(GamePlay.gpPlayer());
if (GamePlay.gpRemotePlayers() != null)
players.AddRange(GamePlay.gpRemotePlayers());

Player[] Reds = players.FindAll(item => item.Army() == 1).ToArray();
Player[] Blues = players.FindAll(item => item.Army() == 2).ToArray();

if(Reds.Length > 0)
{
GamePlay.gpHUDLogCenter(Reds, "RAF- Fly CAP between Calais and Dover", new object[]{}, 2);
GamePlay.gpLogServer(Reds, "RAF- Fly CAP between Calais and Dover", new object[] { });

if(Blues.Length > 0)
{
GamePlay.gpHUDLogCenter(null, "LW- Meet a flight of HE111's 5000m over Calais.\n In appr. 10 minutes inot mission! Escort them to Dover!", new object[]{}, 2);
GamePlay.gpLogServer(null, "LW- Meet a flight of HE111's 5000m over Calais.\n In appr. 10 minutes inot mission! Escort them to Dover!", new object[] { });
}
}
Reply With Quote
  #9  
Old 06-25-2012, 03:03 PM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

Corrected:

Code:
public override void OnTickGame()
    {
        if (Time.tickCounter()%864000 == 72000) // 864000 = 8 hour repeat, 72000 = 40 min delay.
        {
            GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/July1940_v10/Missionen/Mission2.mis");
           
            List<Player> players = new List<Player>();
            if (GamePlay.gpPlayer() != null)
                players.Add(GamePlay.gpPlayer());
            if (GamePlay.gpRemotePlayers() != null)
                players.AddRange(GamePlay.gpRemotePlayers());

            Player[] Reds = players.FindAll(item => item.Army() == 1).ToArray();
            Player[] Blues = players.FindAll(item => item.Army() == 2).ToArray();

            if (Reds.Length > 0)
            {
                GamePlay.gpHUDLogCenter(Reds, "RAF- Fly CAP between Calais and Dover", new object[] {}, 2);
                GamePlay.gpLogServer(Reds, "RAF- Fly CAP between Calais and Dover", new object[] {});
            }
            if (Blues.Length > 0)
            {
                GamePlay.gpHUDLogCenter(Blues, "LW- Meet a flight of HE111's 5000m over Calais.\n In appr. 10 minutes inot mission! Escort them to Dover!", new object[] { }, 2);
                GamePlay.gpLogServer(Blues, "LW- Meet a flight of HE111's 5000m over Calais.\n In appr. 10 minutes inot mission! Escort them to Dover!", new object[] { });
            }
        }
    }
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 10:13 PM.


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