???
Математика на уровне МГУ

Показано с 1 по 6 из 6

Тема: GroundBuilding

  1. #1
    Заявка на ПМЖ
    Регистрация
    06.07.2011
    Возраст
    43
    Сообщений
    12

    GroundBuilding

    How to see all the buildings created in .mis file through the script...

    in other words:

    how to use public class GroundBuilding

  2. #2
    Старший Офицер Форума
    Регистрация
    15.02.2002
    Адрес
    Moscow
    Возраст
    45
    Сообщений
    6,905
    Images
    51

    Re: GroundBuilding

    Hi! GroundBuilding is class that contains just 2 members - Title (name of the building) and pos (position of the building). This class used in OnBuildingKilled event to check what kind of building dies and where. Buildings that used this class not loaded in missions - they are property of map - i.e. that buildings which are already placed to the map.
    When you create buildings in mission - it would be stationary objects and you could use GroundStationary class , its propertys -
    Скрытый текст:
    Код:
    string Title { get; }
          string Name { get; }
          string country { get; }
          string Category { get; }
          Point3d pos { get; }
          AiGroundActorType Type { get; }
          void Destroy();
          bool IsAlive { get; }
    
    AiGroundActorType {
        Unknown,
        
        // cars, tanks
        Medic,
        Motorcycle,
        ArmoredCar,
        Tractor,
        Car,
        Amphibian,
        SPG,
        Tank,
        Bus,
        LightTruck,
        Truck,
        Trailer,
        
        // stationary
        Balloon,
        Generator,
        Predictor,
        Radar,
        RadioBeacon,
        RadioBeamProjector,
        Listener,
        AmmoComposition,
        ContainerShort,
        ContainerLong,
        Artillery,
        AAGun,
        Plane,
        GroundCrew,
        
        // trains/wagons
        EngineWagon,
        FreightWagon,
        PassengerWagon,
        
        // ships
        ShipMisc,
        ShipTransport,
        ShipSmallWarship,
        ShipDestroyer,
        ShipCruiser,
        ShipBattleship,
        ShipCarrier,
        ShipSubmarine,
    
        // statics
        Bridge,
        House
      }


    and you can get array of GroundStationary's objects in mission like this :
    GroundStationary[] gpGroundStationarys(); - all GroundStationary objects in runing mission,
    GroundStationary[] gpGroundStationarys(string Country); - all GroundStationary objects in runing mission with specific Country,
    GroundStationary[] gpGroundStationarys(double x, double y, double r); all GroundStationary objects in runing mission placed in circle with center in x,y and radious r,
    GroundStationary[] gpGroundStationarys(string Country, double x, double y, double r); all GroundStationary objects in runing mission placed in circle with center in x,y and radious r, with specific Country.
    Thus you can get array of all created stationary objects, filter it by Type == AiGroundActorType .House , and you'll get array of buildings created in mission.
    Don't happy, be worry

  3. #3
    Заявка на ПМЖ
    Регистрация
    06.07.2011
    Возраст
    43
    Сообщений
    12

    Re: GroundBuilding

    ok, thanks for the tip. I was actually looping through GroundStationary [] but I coud not find anything like House.
    However when I checked my mission in FMB there was no buildings in it.... silly me.

    I noticed one thing, looping through:


    foreach (GroundStationary gs in GamePlay.gpGroundStationarys())
    {
    //Console.WriteLine("GroundStationary: " + gs.Name + " Category: " + gs.Category + " country : " + gs.country + " Title: " + gs.Title + " Type : " + gs.Type);
    }


    will not result in all static objects from mission but if i add:

    if (actor is AiGroundActor)
    {
    AiGroundActor ground = actor as AiGroundActor;


    string landType = GamePlay.gpLandType(actor.Pos().x, actor.Pos().y).ToString();
    string gpSectorName = GamePlay.gpSectorName(actor.Pos().x, actor.Pos().y).ToString();
    //Console.WriteLine("AiGroundActor: " + actor.Name() + " Type: " + ground.Type() + " Grid: " + gpSectorName + " Land Type: " + landType);

    }

    Then eventually i got theme all... or is there any much simpler method to do

  4. #4
    Заявка на ПМЖ
    Регистрация
    06.07.2011
    Возраст
    43
    Сообщений
    12

    Re: GroundBuilding

    Ok, just tested it still no joy of getting list of buildings... i can get only statics objects... Any tips???

    what i have is:

    [Buildings]
    0_bld buildings.House$EnglandShelter00 1 269360.87 206200.34 -55.00
    1_bld buildings.House$EnglandGeneralServiceShed1916 1 70742.43 177040.67 -60.00
    2_bld buildings.House$EnglandGeneralServiceShed1916 1 70785.06 177063.10 -60.00
    3_bld buildings.House$EnglandGeneralServiceShed1916 1 70828.50 177088.93 -60.00
    4_bld buildings.House$EnglandRespiratorWorkshop 1 70869.88 177094.28 -60.00
    5_bld buildings.House$EnglandRespiratorWorkshop 1 70864.06 177104.15 -60.00
    6_bld buildings.House$EnglandRespiratorWorkshop 1 70858.04 177112.86 -60.00
    7_bld buildings.House$EnglandGunneryWorkshop 1 70883.13 177113.79 30.00
    8_bld buildings.House$GermanyControltower 1 280570.32 213172.30 -30.00
    9_bld buildings.House$FuelStorage_01 1 280547.48 213027.04 -30.00
    10_bld buildings.House$FuelStorage_01 1 280547.48 212991.82 -30.00
    11_bld buildings.House$FuelStorage_01 1 280549.08 212961.40 -30.00
    [BuildingsLinks]

    thats from .mis file

    so basicly buildings created on FMB are not being written as statics objects.... right???


    and if i loop through it both methods, i cant get any House types being displayed for some reason...
    Крайний раз редактировалось _79_dev; 20.01.2014 в 05:33.

  5. #5
    Старший Офицер Форума
    Регистрация
    15.02.2002
    Адрес
    Moscow
    Возраст
    45
    Сообщений
    6,905
    Images
    51

    Re: GroundBuilding

    I'm really sorry, i don't understood you at first message, my bad . So, it is not possible to get list of [Buildings] object in script, only thing that you can get - is it's name and pos when it die.

    Цитата Сообщение от _79_dev Посмотреть сообщение
    Ok, just tested it still no joy of getting list of buildings... i can get only statics objects... Any tips???

    what i have is:

    [Buildings]
    0_bld buildings.House$EnglandShelter00 1 269360.87 206200.34 -55.00
    <skip>[BuildingsLinks]

    thats from .mis file

    so basicly buildings created on FMB are not being written as statics objects.... right???
    not exactly, there are two class of objects - static and stationary, we can operate with stationary and can not - with static ; [Buildings] - are static. You can use some of buildings model in FMB stationary->buildings , and this object would be stationary and present in gpGroundStationarys() array.
    Don't happy, be worry

  6. #6
    Заявка на ПМЖ
    Регистрация
    06.07.2011
    Возраст
    43
    Сообщений
    12

    Re: GroundBuilding

    Ok, thanks for the answer... You are gentelmen...

Ваши права

  • Вы не можете создавать новые темы
  • Вы не можете отвечать в темах
  • Вы не можете прикреплять вложения
  • Вы не можете редактировать свои сообщения
  •