View Single Post
  #7  
Old 08-09-2011, 09:30 PM
41Sqn_Banks 41Sqn_Banks is offline
Approved Member
 
Join Date: Oct 2007
Posts: 644
Default

Code:
// IL2DCE: A dynamic campaign engine for IL-2 Sturmovik: Cliffs of Dover
// Copyright (C) 2011 Stefan Rothdach
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

//$reference parts/IL2DCE/IL2DCE.dll
//$reference parts/core/gamePlay.dll
//$debug

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

public class Mission : AMission
{
    public override void OnBattleStarted()
    {
        base.OnBattleStarted();
        maddox.game.GameDef game = GamePlay as maddox.game.GameDef;
        
        game.EventChat += new GameDef.Chat(Game_EventChat);
    }

    void Game_EventChat(IPlayer from, string msg)
    {
        if (msg.Contains("!hello"))
        {
            GamePlay.gpLogServer(new Player[] { from }, "Hello World!", null);
        }
    }

}
This script is also causing the serialization exception. It looks like the usage of GameDef forces the serialization. This is really a shame as capturing the chat would be very useful for multiplayer missions ... but writing a multiplayer addin was successful so far
Reply With Quote