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 > CoD Multiplayer

CoD Multiplayer Everything about multiplayer in IL-2 CoD

Reply
 
Thread Tools Display Modes
  #1  
Old 10-13-2012, 10:05 PM
41Sqn_Banks 41Sqn_Banks is offline
Approved Member
 
Join Date: Oct 2007
Posts: 644
Default New coop script

This new coop script doesn't use the mission menu, instead the commands are typed into the chat console. Thus the dummy aircraft are no longer needed.

Steps:
1) You must add the following line to your conf.ini or confs.ini (if you want to use the dedicated server):
Code:
[rts]
scriptAppDomain = 0
2) Create a new mission or use a existing single player mission
3) Add the following script to the mission:
Code:
using System;
using System.Collections.Generic;
using System.Text;

using maddox.game;
using maddox.game.world;

//$reference parts/core/gamePlay.dll

public class Mission : AMission
{
    public override void OnBattleInit()
    {
        base.OnBattleInit();

        if (GamePlay is GameDef)
        {
            (GamePlay as GameDef).EventChat += new GameDef.Chat(Mission_EventChat);
        }
    }

    void Mission_EventChat(IPlayer from, string msg)
    {
        if (msg.StartsWith("!help"))
        {
            Chat("Commands: !aircraft, !select#", from);
        }
        if (msg.StartsWith("!aircraft") || msg.StartsWith("!select"))
        {
            List<Tuple<AiAircraft, int>> aircraftPlaces = new List<Tuple<AiAircraft, int>>();
            if (GamePlay.gpArmies() != null && GamePlay.gpArmies().Length > 0)
            {
                foreach (int army in GamePlay.gpArmies())
                {
                    if (GamePlay.gpAirGroups(army) != null && GamePlay.gpAirGroups(army).Length > 0)
                    {
                        foreach (AiAirGroup airGroup in GamePlay.gpAirGroups(army))
                        {
                            if (airGroup.GetItems() != null && airGroup.GetItems().Length > 0)
                            {
                                foreach (AiActor actor in airGroup.GetItems())
                                {
                                    if (actor is AiAircraft)
                                    {
                                        AiAircraft Aircraft = actor as AiAircraft;
                                        for (int place = 0; place < Aircraft.Places(); place++)
                                        {
                                            aircraftPlaces.Add(new Tuple<AiAircraft, int>(Aircraft, place));
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            if (msg.StartsWith("!aircraft"))
            {
                int i = 0;
                foreach (Tuple<AiAircraft, int> aircraftPlace in aircraftPlaces)
                {
                    string playerName = "";
                    Player player = aircraftPlace.Item1.Player(aircraftPlace.Item2);
                    if (player != null)
                    {
                        playerName = " " + player.Name();
                    }
                    Chat("#" + i + ": " + aircraftPlace.Item1.Name() + " " + aircraftPlace.Item1.TypedName() + " " + aircraftPlace.Item1.CrewFunctionPlace(aircraftPlace.Item2) + " " + playerName, from);
                    i++;
                }
            }
            else if (msg.StartsWith("!select"))
            {
                msg = msg.Replace("!select", "");

                int i = -1;
                if (int.TryParse(msg, out i) && i < aircraftPlaces.Count)
                {
                    Tuple<AiAircraft, int> aircraftPlace = aircraftPlaces[i];
                    if (aircraftPlace.Item1.Player(aircraftPlace.Item2) == null)
                    {
                        from.PlaceEnter(aircraftPlace.Item1, aircraftPlace.Item2);
                    }
                    else
                    {
                        Chat("Place occupied.", from);
                    }
                }
                else
                {
                    Chat("Please enter a valid aircraft number, e.g. !select0, !select1, !select2, ...", from);
                }
            }
        }
    }

    public void Chat(string line, IPlayer to)
    {
        if (GamePlay is GameDef)
        {
            (GamePlay as GameDef).gameInterface.CmdExec("chat " + line + " TO " + to.Name());
        }
    }
}
4) Host the mission. Clients have access to several commands by typing the command into the chat:

!help - this will show the available commands
!aircraft - this will show a list of all available aircraft starting with the id of the aircraft
!select# - this will place the player into the aircraft, replace # with the id of the aircraft, e.g. !select0 will place you into the first aircraft and so on.

Last edited by 41Sqn_Banks; 10-13-2012 at 10:31 PM.
Reply With Quote
  #2  
Old 10-13-2012, 10:34 PM
41Sqn_Banks 41Sqn_Banks is offline
Approved Member
 
Join Date: Oct 2007
Posts: 644
Default

I created an example mission, see attachment of this post.
Attached Files
File Type: zip example.zip (1.8 KB, 223 views)
Reply With Quote
  #3  
Old 10-14-2012, 03:27 AM
SirAthlon's Avatar
SirAthlon SirAthlon is offline
Approved Member
 
Join Date: Apr 2011
Posts: 13
Default

Nice Banks,i test it
__________________
My Cliff of Dover support for MG
Reply With Quote
  #4  
Old 10-14-2012, 09:21 AM
Osprey's Avatar
Osprey Osprey is offline
Approved Member
 
Join Date: Jan 2010
Location: Gloucestershire, England
Posts: 1,264
Default

This looks excellent, thank you Banks. I don't understand all those whining saying there 'is no co-op' - they don't see the bigger picture from coding like this.

@Farber, you are sure to read this, do you think this would be useful for the multisquad campaign or aren't we quite there yet?
Reply With Quote
  #5  
Old 10-14-2012, 10:11 AM
5./JG27.Farber 5./JG27.Farber is offline
Approved Member
 
Join Date: Aug 2011
Posts: 1,958
Default

I would have to know how many people were turning up and set out all the aircraft. Would be more viable with a smaller group.

This looks like the best coop so far though.
Reply With Quote
  #6  
Old 10-14-2012, 01:11 PM
Skoshi Tiger Skoshi Tiger is offline
Approved Member
 
Join Date: Nov 2007
Location: Western Australia
Posts: 2,197
Default

Downloaded the mission and played around with it this arvo. Although I've never played in a il2 Co-op I can see how it would work to let pilots join their flights and get into the action.

I guess the mission designer needs to put a lot of work into the briefings for the mission to get everyone up to full speed on their individual task and the overall objective(s) for the mission sorted out. Can they display waypoints for individual flight on the mission map?

Just one question. Would there be anyway for pilots to alter their loadout (or is this against the essence of being in a co-op)?

Cheers
Reply With Quote
  #7  
Old 10-15-2012, 07:22 AM
41Sqn_Banks 41Sqn_Banks is offline
Approved Member
 
Join Date: Oct 2007
Posts: 644
Default

Quote:
Originally Posted by Skoshi Tiger View Post
I guess the mission designer needs to put a lot of work into the briefings for the mission to get everyone up to full speed on their individual task and the overall objective(s) for the mission sorted out. Can they display waypoints for individual flight on the mission map?
Depending on your realism settings you can see the waypoints of the flight on the map, unfortunatly this setting also shows your own aircarft on the map.

There is hope that in the future it will be possible to create user labels within script. But this feature is still bugged in the latest RC.

Quote:
Just one question. Would there be anyway for pilots to alter their loadout (or is this against the essence of being in a co-op)?
There is no way. The loadouts can only be defined for the whole flight, not for individual aircraft. However that is not a big problem, typically the coop mission is designed for a specific loadout.
Reply With Quote
  #8  
Old 10-15-2012, 09:46 AM
Ataros Ataros is offline
Approved Member
 
Join Date: Jun 2010
Location: USSR
Posts: 2,439
Default

Excellent news, many thanks Banks!

Is it possible to make an html(java?) file which when launched on a client PC would provide a GUI for this script? Hopefully data on already occupied seats can be transfered from server/other clients in real time (or on demand at least)?

Last edited by Ataros; 10-15-2012 at 10:20 AM.
Reply With Quote
  #9  
Old 10-25-2012, 05:44 AM
bw_wolverine's Avatar
bw_wolverine bw_wolverine is offline
Approved Member
 
Join Date: Jun 2010
Location: Toronto, Canada
Posts: 622
Default

This is great! Thank you, Banks.

Is there a way to set some aircraft so that they don't show up on the list of aircraft at start?

I suppose I could set the other aircraft to spawn on trigger so they aren't active in the game at the outset until someone triggers the spawn.
__________________
Pilot #1 (9:40 hours flying time, 3/0/1 Fighters, 7/2/0 Bombers). RIP

No.401 Squadron Forum


Using ReconNZ's Pilot Log Book
Reply With Quote
  #10  
Old 10-26-2012, 03:57 AM
Palex Palex is offline
Registered Member
 
Join Date: May 2008
Posts: 6
Question

Thx for the script Banks....one question:

can i change the list of available planes when use !aircraft command?? e.g only red side.

Salute!
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 07:22 PM.


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