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
  #11  
Old 10-25-2012, 01:16 PM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

Update: Labels working now
Updated Update: Not in Multiplayer

My testscript use the Missionmenu to create the Labels:
Code:
using System;
using maddox.game;
using maddox.game.world;
using System.Collections.Generic;
using maddox.GP;


public class Mission : AMission
{

    class Recon
    {
        public Player ReconPlayer { get; internal set; }
        public List<GPUserLabel> Labels = new List<GPUserLabel>();
    
    
        public Recon(Player player, GPUserLabel userLabel)
        {
            ReconPlayer = player;
            if (userLabel != null)
            {
                Labels.Add(userLabel);
            }
        }
    }


    List<Recon> ActiveRecons = new List<Recon>();


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

        SetMainMenu(player);

    }


    enum MenuID
    {
        MainMenu,
        ReconMenu,
    }


    
    public void SetMainMenu(Player player)
    {
        GamePlay.gpSetOrderMissionMenu(player, false, (int)MenuID.MainMenu, new string[] { "Recon" }, new bool[] { true });
    }


    public void SetReconMenu(Player player)
    {
        GamePlay.gpSetOrderMissionMenu(player, true, (int)MenuID.ReconMenu, new string[] { "Set AAA Mark", "Set Tank Mark", "Set Plane Mark", "Set Factory Mark", "Set Car Mark", "Set Label", "Set Ship Mark", "Set WayPoint Mark", "Delete Marks" }, new bool[] { false, false, false, false, false, false, false, false, false });
    }




    public override void OnOrderMissionMenuSelected(Player player, int ID, int menuItemIndex)
    {
        base.OnOrderMissionMenuSelected(player, ID, menuItemIndex);

        if (ID == 0)
        {
            // main menu
            if (menuItemIndex == 1)
            {
                SetReconMenu(player);
            }
            else
            {
                SetMainMenu(player);
            }
        }
        else if (ID == (int)MenuID.ReconMenu)
        {

            switch (menuItemIndex)
            {
                case 1:
                    AddReconMark(player, GPUserIconType.AAGun);
                    SetMainMenu(player);
                    break;
                case 2:
                    AddReconMark(player, GPUserIconType.Tank);
                    SetMainMenu(player);
                    break;
                case 3:
                    AddReconMark(player, GPUserIconType.Plane);
                    SetMainMenu(player);
                    break;
                case 4:
                    AddReconMark(player, GPUserIconType.Factory);
                    SetMainMenu(player);
                    break;
                case 5:
                    AddReconMark(player, GPUserIconType.Car);
                    SetMainMenu(player);
                    break;
                case 6:
                    AddReconMark(player, GPUserIconType.Label);
                    SetMainMenu(player);
                    break;
                case 7:
                    AddReconMark(player, GPUserIconType.Ship);
                    SetMainMenu(player);
                    break;
                case 8:
                    AddReconMark(player, GPUserIconType.Waypoint);
                    SetMainMenu(player);
                    break;
                case 9:
                    RemoveMarks(player);
                    SetMainMenu(player);
                    break;
                default:
                    SetMainMenu(player);
                    break;
            }
        }
    }


    private void RemoveMarks(Player player)
    {
        if (ActiveRecons.Exists(item => item.ReconPlayer == player))
        {
            Recon recon = ActiveRecons.Find(item => item.ReconPlayer == player);
            recon.Labels.ForEach(item => GamePlay.gpDeleteUserLabel(item));
            recon.Labels.Clear();
        }
        
    }


    private void AddReconMark(Player player, GPUserIconType iconType)
    {
        AiActor actor = player.Place();
        GPUserLabel newLable =null;

        if (actor != null)
        {
            Point2d pos = new Point2d(actor.Pos().x, actor.Pos().y);

            switch (iconType)
            {
                case GPUserIconType.AAGun:
                    newLable = GamePlay.gpMakeUserLabel(pos, player, "AAA", GamePlay.gpTimeofDay(), (int)GPUserIconType.AAGun);
                    break;
                case GPUserIconType.Tank:
                    newLable = GamePlay.gpMakeUserLabel(pos, player, "Tanks", GamePlay.gpTimeofDay(), (int)GPUserIconType.Tank);
                    break;
                case GPUserIconType.Plane:
                    newLable = GamePlay.gpMakeUserLabel(pos, player, "Planes", GamePlay.gpTimeofDay(), (int)GPUserIconType.Plane);
                    break;
                case GPUserIconType.Factory:
                    newLable = GamePlay.gpMakeUserLabel(pos, player, "Factory", GamePlay.gpTimeofDay(), (int)GPUserIconType.Factory);
                    break;
                case GPUserIconType.Car:
                    newLable = GamePlay.gpMakeUserLabel(pos, player, "Car", GamePlay.gpTimeofDay(), (int)GPUserIconType.Car);
                    break;
                case GPUserIconType.Label:
                    newLable = GamePlay.gpMakeUserLabel(pos, player, "Label", GamePlay.gpTimeofDay(), (int)GPUserIconType.Label);
                    break;
                case GPUserIconType.Ship:
                    newLable = GamePlay.gpMakeUserLabel(pos, player, "Ship", GamePlay.gpTimeofDay(), (int)GPUserIconType.Ship);
                    break;
                case GPUserIconType.Waypoint:
                    newLable = GamePlay.gpMakeUserLabel(pos, player, "Waypoint", GamePlay.gpTimeofDay(), (int)GPUserIconType.Waypoint);
                    break;
            }


            if (newLable != null)
            {
                if (ActiveRecons.Exists(item => item.ReconPlayer == player))
                    ActiveRecons.Find(item => item.ReconPlayer == player).Labels.Add(newLable);
                else
                    ActiveRecons.Add(new Recon (player, newLable));
                

                GamePlay.gpDrawUserLabel(player.Army(), newLable);

            }
        }
    }



    static string CreateTimeString(double num)
    {
        double hours = Math.Floor(num);
        double minutes = (num - hours) * 60.0;
        double seconds = (minutes - Math.Floor(minutes)) * 60.0;
        int H = (int)Math.Floor(hours);
        int M = (int)Math.Floor(minutes);
        int S = (int)Math.Floor(seconds);
        return H.ToString("00") + ":" + M.ToString("00") + ":" + S.ToString("00");
    }


    public override void OnUserCreateUserLabel(GPUserLabel ul)
    {
        base.OnUserCreateUserLabel(ul);

        GamePlay.gpLogServer(null, "OnUserCreateUserLabel: {0} created {1} Mark at {2} ", new object[] { ul.Player.Name(), ul.Text, CreateTimeString(ul.time) });

    }
}

Last edited by FG28_Kodiak; 10-26-2012 at 11:02 AM.
Reply With Quote
  #12  
Old 10-25-2012, 06:10 PM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

Congratulations!

What are labels used for? Are these map icons that show unit positions or something else?
Reply With Quote
  #13  
Old 10-25-2012, 06:12 PM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

You can create recon missions, in multiplayer you can mark enemy positions etc. You will see the icons on the in game map and on the briefing screen map.

Last edited by FG28_Kodiak; 10-26-2012 at 08:15 AM.
Reply With Quote
  #14  
Old 10-26-2012, 05:09 AM
theOden theOden is offline
Approved Member
 
Join Date: May 2011
Location: Sweden
Posts: 221
Default

You're the best Kodiak - will try again after work today.
:beer:

Edit: works in SP but NoGo in MP as far as I can see :/
__________________

Last edited by theOden; 10-26-2012 at 10:00 AM.
Reply With Quote
  #15  
Old 10-26-2012, 11:01 AM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

Argh forget to test it in multiplayer.
Ok then no recon missions in multiplayer, in singleplayer it makes not so much sense i think.
Reply With Quote
  #16  
Old 10-26-2012, 07:41 PM
41Sqn_Banks 41Sqn_Banks is offline
Approved Member
 
Join Date: Oct 2007
Posts: 644
Default

Quote:
Originally Posted by naryv
It was a single-mission sample, i tryed step by step check , but now it seems like i know what is the problem:. In multiplayer label will not sent to player which is author of this label - just to not doubling labels, exept case when labels sent to everybody. So, when you use that code you make label with player who enter the plane as author, sever will not send it to this player. But You can change the author of label, then it would be send to remote player, server is good candidate to be author(couse hi makes it really) like this :
Code:
using maddox.game;
using maddox.game.world;
using maddox.GP;
using System.Collections.Generic;
using Math = System.Math;


public class Mission : AMission
{

    public override void OnPlaceEnter(Player player, AiActor actor, int placeIndex)
    {
        base.OnPlaceEnter(player, actor, placeIndex);
        Point2d p ;
        p.x = actor.Pos().x;
        p.y = actor.Pos().y;
        GPUserLabel ul = GamePlay.gpMakeUserLabel(p, GamePlay.gpPlayer(), actor.Name(), GamePlay.gpTimeofDay(), (int)GPUserIconType.Plane);
        GamePlay.gpDrawUserLabel(ul);
        p.x -= 300;        
        ul.pos = p;
        ul.Text = "Show player";
        GamePlay.gpDrawUserLabel(new Player[] { player }, ul);

        p.x += 600;
        p.y += 300;
        ul.pos = p;
        ul.Text = "Show army";
        GamePlay.gpDrawUserLabel(0,ul);
        p.x += 300;
        p.y += 300;
        ul.pos = p;
        GamePlay.gpDrawUserLabel(1, ul);
        p.x += 300;
        p.y += 300;
        ul.pos = p;
        GamePlay.gpDrawUserLabel(2, ul);
    }
    
}
it should draw 3 labels - actor.Name, Show player and Show army , try it please.
Maybe this will help you to solve the problem.

In multiplayer gpDrawUserLabel doesn't draw user labels for the player who was used in gpMakeUserLabel. One should use GamePlay.gpPlayer() (which is the "server") instead for gpMakeUserLabel.
Reply With Quote
  #17  
Old 10-26-2012, 07:57 PM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

Ok, will try it
Reply With Quote
  #18  
Old 10-26-2012, 08:02 PM
41Sqn_Banks 41Sqn_Banks is offline
Approved Member
 
Join Date: Oct 2007
Posts: 644
Default

Habs noch nicht probiert, aber navyr hats wohl erfolgreich auf nem Dedicated Server probiert und 3 Labels angezeigt bekommen.
Reply With Quote
  #19  
Old 10-27-2012, 04:41 AM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

Wenn es funktioniert wäre es auch für die JFS interessant, man könnte in der Navigationsschulung so eine Art Schnitzeljagd veranstalten. Die Frage ist halt wenn ich GamePlay.gpPlayer() verwende, es auch in einer selber gehosteten Multiplayer Mission funktioniert, in dem Fall ist gpPlayer ja der Spieler der hostet.
Muss mal testen.
Reply With Quote
  #20  
Old 10-27-2012, 06:20 AM
theOden theOden is offline
Approved Member
 
Join Date: May 2011
Location: Sweden
Posts: 221
Default

Thanks a tonne Banks, or should I say Danke Sehr?

Still a NoGo as host, guess it works for SP and from a ded.server as described (but we don't have a ded.server exe yet do we? just a second license install where the player runs to another computer flying?)

Tried with "null" as player but still no marker.

In Arma, where I come from, we have "IsMultiplayer" and "IsDedicated" along with a lot of player/server procedures to cope with remote players, hosted server player and dedicated server with no player at all - sure miss them here.

(I prefer flying singleplayer as multiplayer-host on locked server due to MP features - same as in ArmA)

Guess this will work in the "sequel" one day..
__________________
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 11:49 PM.


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