1C Home   |   Register   |   Today Posts   |   Members   |   UserCP   |   Calendar   |   Search   |   FAQ

Go Back   Official 1C Company forum > 1C Publishing > IL-2 Sturmovik: Cliffs of Dover > FMB, Mission & Campaign builder Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 05-28-2012, 06:27 PM
Fer912 Fer912 is offline
Junior Member
 
Join Date: Sep 2011
Location: San clemente del tuyu Argentina
Posts: 12
Default teacher looking for?

good morning again to see if someone can lend a hand, I created a mission style coop, which still could not test and so the code is not okay.
My intention is to bring together in an array all the local pilots and remote mission, I wonder if there is any advice on what is written or modified to improve it or fix it thanks

Code:
using System;
using System.Collections.Generic;
using maddox.core;
using maddox.game;
using maddox.game.world;
using maddox.GP;



public class Mission : AMission
{

    bool _WonSup = true;    // wonSup se da con el 75% de los pilotos vivos, cada avion volable vale 12.5
    bool _WonEsc = true;    // wonEsc se da con el +50% de los aviones de ataques vivos
    bool _WonATK = false;   // wonATK se da con +60% de los blancos asignados destruidos
    int indice = 0;

    private class piloto
    {
        string _nombre;
        string _estado;
        int _valor;

        public string Nombre
        {
            set { this._nombre = value; }
            get { return this._nombre; }
        }

        public string Estado
        {
            get { return this._estado; }
            set { this._estado = value; }
        }

        public int Valor
        {
            set { this._valor = value; }
            get { return this._valor; }
        }
    };

    piloto[] p = new piloto[8];

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

        if ("WonEsc".Equals(shortName) && active)
        {
            _WonEsc = false;
            GamePlay.gpGetTrigger("WonEsc").Enable = false;
            GamePlay.gpHUDLogCenter("WonEsc Fallido");
        }

        if ("WonAtk".Equals(shortName) && active)
        {
            _WonATK = true;
            GamePlay.gpGetTrigger("WonAtk").Enable = false;
            GamePlay.gpHUDLogCenter("WonAtk Cumplido");
        }
    }


    public override void OnActorCreated(int missionNumber, string shortName, AiActor actor)
    {
        base.OnActorCreated(missionNumber, shortName, actor);

        if (actor is AiAircraft)
        {
            for (int i = 0; i < (actor as AiAircraft).Places(); i++ )
            {
                if ((actor as AiAircraft).Player(i) != null)
                {
                    p[indice].Nombre = (actor as AiAircraft).Player(i).Name();
                    p[indice].Estado = "Vivo";
                    p[indice].Valor = 0;    //por ahora no lo uso, va a ser implementado en otros para los defectos del avion segun las tirada de dados de rol
                    indice++;
                }
            }
        }
    }

    
    public override void OnActorDead(int missionNumber, string shortName, AiActor actor, List<DamagerScore> damages)
    {
        base.OnActorDead(missionNumber, shortName, actor, damages);

        if (actor is AiAircraft)
        {
            GamePlay.gpLogServer(null, " Paso 1 Ok ", null);

            for (int i = 0; i < (actor as AiAircraft).Places(); i++)
            {
                GamePlay.gpLogServer(null, "Primer For i={0}", new object[] { i });
                GamePlay.gpLogServer(null, " Paso 2 Ok ", null);
                //  if ((actor as AiAircraft).Player(i) != null)
                //{
                for (int j = 0; j < indice; j++)
                {
                    GamePlay.gpLogServer(null, " Buscando al Piloto Ok ", null);
                    if (p[j].Nombre.Equals((actor as AiAircraft).Player(i).Name()))
                    {
                        p[j].Estado = "Muerto";

                        GamePlay.gpLogServer(null, "piloto {0} ha muerto JAJAJ", new object[] { p[j].Nombre });
                    }

                }
                //}
            }
        }
    }
}
Reply With Quote
  #2  
Old 05-28-2012, 07:29 PM
FG28_Kodiak FG28_Kodiak is offline
Senior Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

Sorry i don't understand your question.

Do you want all Players in an Array?
Code:
public Player[] AllPlayers()
    {
        List<Player> players = new List<Player>();

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

        return players.ToArray();
    }
I don't understand what you mean with "remote mission".
Reply With Quote
  #3  
Old 05-28-2012, 08:30 PM
Fer912 Fer912 is offline
Junior Member
 
Join Date: Sep 2011
Location: San clemente del tuyu Argentina
Posts: 12
Default

if that kodiak thanks again.
what I wanted to know is if this form is well done or not

Code:
 public override void OnActorCreated(int missionNumber, string shortName, AiActor actor)
    {
        base.OnActorCreated(missionNumber, shortName, actor);

        if (actor is AiAircraft)
        {
            for (int i = 0; i < (actor as AiAircraft).Places(); i++ )
            {
                if ((actor as AiAircraft).Player(i) != null)
                {
                    p[indice].Nombre = (actor as AiAircraft).Player(i).Name();
                    p[indice].Estado = "Vivo";
                    p[indice].Valor = 0;    //por ahora no lo uso, va a ser implementado en otros para los defectos del avion segun las tirada de dados de rol
                    indice++;
                }
            }
        }
    }
I apologize for the inconvenience and misunderstanding, my English is very poor as well as my knowledge of programming, so I'm asking and reading everything I can to solve my doubts

mains to thank
Reply With Quote
  #4  
Old 05-28-2012, 09:43 PM
FG28_Kodiak FG28_Kodiak is offline
Senior Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

Ah ok, now i understand.

At event OnActorCreated is no human player available. There only 'empty' actors are created.

A Player enters a plane (actor) with the OnPlaceEnter event:
Code:
public override void OnPlaceEnter(Player player, AiActor actor, int placeIndex)
{
        base.OnPlaceEnter(player, actor, placeIndex);

        //your code here
}
Reply With Quote
  #5  
Old 05-28-2012, 10:16 PM
Fer912 Fer912 is offline
Junior Member
 
Join Date: Sep 2011
Location: San clemente del tuyu Argentina
Posts: 12
Default

ok thanks again
Reply With Quote
Reply

Thread Tools
Display Modes

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 08:56 PM.

Based on a design by: Miner Skinz.com

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright © 2007 1C Company. All rights reserved.