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

Показано с 1 по 25 из 789

Тема: Вопросы.

Комбинированный просмотр

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

    Re: Вопросы.

    Цитата Сообщение от 41Sqn_Banks Посмотреть сообщение
    Hello naryv,
    Hi Banks!

    Цитата Сообщение от 41Sqn_Banks Посмотреть сообщение
    I have some problems with the creation of user labels. Basically I want to use gpMakeUserLabel to create a user label for each waypoint of an air group, and than use gpMakeUserLabel to draw it to the player. This is needed to show the waypoints to the players under full real realism settings.

    Код:
    public override void OnPlaceEnter(Player player, AiActor actor, int placeIndex)
    {
        base.OnPlaceEnter(player, actor, placeIndex);
    
        if (actor is AiAircraft)
        {
            AiAircraft aiAircraft = actor as AiAircraft;
            AiAirGroup aiAirGroup = aiAircraft.AirGroup();
            if (aiAirGroup != null)
            {
                AiWayPoint[] waypoints = aiAirGroup.GetWay();
    
                foreach (AiWayPoint waypoint in waypoints)
                {
                    GPUserLabel userLabel = GamePlay.gpMakeUserLabel(new maddox.GP.Point2d(waypoint.P.x, waypoint.P.x), player, waypoint.P.z.ToString(System.Globalization.CultureInfo.InvariantCulture.NumberFormat), GamePlay.gpTimeofDay(), (int)GPUserIconType.Waypoint);
                    GamePlay.gpDrawUserLabel(new Player[] { player }, userLabel);
                }
            }
        }
    }
    The problem is that the labels are not displayed. The creation seems to have been successful, at least gpMakeUserLabel didn't return null. There is also no error or exception in the log.

    Am I missing something? Do I have to store the created user label in order to display it? Is it because the same player is used to create and draw it?
    Now in single mission there would be event OnUserCreateUserLabel(GPUserLabel ul) after you make gpDrawUserLabel(), but it really don't display, this is bug ( hope it would be fixed with next patch, we didn't test it this way in single). But it should work in online missions, displaying labels for users thats not a server, i mean client players would get displayed labels, server player wouldn't.
    Don't happy, be worry

  2. #2

    Re: Вопросы.

    Цитата Сообщение от naryv Посмотреть сообщение
    Hi Banks!


    Now in single mission there would be event OnUserCreateUserLabel(GPUserLabel ul) after you make gpDrawUserLabel(), but it really don't display, this is bug ( hope it would be fixed with next patch, we didn't test it this way in single). But it should work in online missions, displaying labels for users thats not a server, i mean client players would get displayed labels, server player wouldn't.
    Sorry it doesn't work with single player and dedicated server. gpMakeUserLabel does create a label object (at least it doesn't return null), however gpDrawUserLabel doesn't have any effect, the label created by gpMakeUserLabel is not drawn for the client player. Note that I use the same player in gpMakeUserLabel and gpDrawUserLabel. Maybe it is only possible to draw labels with gpDrawUserLabel that were created by different players?

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

    Re: Вопросы.

    Цитата Сообщение от 41Sqn_Banks Посмотреть сообщение
    Sorry it doesn't work with single player and dedicated server. gpMakeUserLabel does create a label object (at least it doesn't return null), however gpDrawUserLabel doesn't have any effect, the label created by gpMakeUserLabel is not drawn for the client player. Note that I use the same player in gpMakeUserLabel and gpDrawUserLabel. Maybe it is only possible to draw labels with gpDrawUserLabel that were created by different players?
    Hi again! Here is simple sample: tests.zip single mission - when you enter plane(it is AI controlled first) label of aircraft is drawing on the map in the position of aircraft, try it, does it work this way?
    Don't happy, be worry

  4. #4

    Re: Вопросы.

    Цитата Сообщение от naryv Посмотреть сообщение
    Hi again! Here is simple sample: tests.zip single mission - when you enter plane(it is AI controlled first) label of aircraft is drawing on the map in the position of aircraft, try it, does it work this way?
    Hello naryv, I tried the different version of gpDrawUserLabel, unfortunatly the following two are not working:

    void gpDrawUserLabel(int army, GPUserLabel ul);
    void gpDrawUserLabel(Player[] to, GPUserLabel ul);

    No label is displayed. Only void gpDrawUserLabel(GPUserLabel ul); is working. To late for a fix?

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

    Re: Вопросы.

    Цитата Сообщение от podvoxx Посмотреть сообщение
    Нет, самолета не было рядом. Это происходит когда какая-то машина встает, все машины ее ждут и останавливаются где придется. А можно в сиквеле как-то выровнять движение в колонне? У них к тому же бывают такие элементы пилотожа когда вроде колонна едет ровно, а пара машинок начинает вилять, как будто объезжает припятствие, потом другие и т.д. На ускорении как старое немое кино смотрится.
    Увеличивал интервал до 2-х минут - все равно затор может возникнуть
    когда вихляется - скорее всего на обочину наехала - пытается вернуться на дорогу и её может разбросать. Ещё как вариант не только увеличить интервал но и стартовую точку двигать - тогда меньше шансы затора. Насчёт сиквела я ничего сказать не могу, там видно будет.

    Цитата Сообщение от podvoxx Посмотреть сообщение
    Кстати вопрос по ускорению. Пытался ускорить процесс респауна, он происходит в методе OnTickGame() после проверки StopWatch. После ускорения респаун не срабатывает, это из-за того, что таймер StopWatch останавливается при изменении скорости времени? Или OnTickGame() не обрабатывается?
    OnTickGame() всегда тикает, от ускорения не зависит, надо смотреть что за таймер и как он сделан....


    Цитата Сообщение от 41Sqn_Banks Посмотреть сообщение
    Hello naryv, I tried the different version of gpDrawUserLabel, unfortunatly the following two are not working:

    void gpDrawUserLabel(int army, GPUserLabel ul);
    void gpDrawUserLabel(Player[] to, GPUserLabel ul);

    No label is displayed. Only void gpDrawUserLabel(GPUserLabel ul); is working. To late for a fix?
    оk, try this one :
    Код:
    //$debug
    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,player,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);
        }
        
    }
    does it work?
    Don't happy, be worry

  6. #6

    Re: Вопросы.

    Цитата Сообщение от naryv Посмотреть сообщение
    ...
    Thanks! I will try out ASAP. I hope I only made a stupid mistake in my script. Would be awesome if it works!

    Another question: What's the benefit of having "//$debug" at the top of the script?
    I know I can use "//$reference <dll name>" to load a assembly. Are there any other "hidden" commands that can be used at the top of the script?

  7. #7

    Re: Вопросы.

    Цитата Сообщение от naryv Посмотреть сообщение
    does it work?
    Unfortunately not, only one user label is drawn that has the actor.Name as text. The labels to a specific player or army are not drawn Script is running on a dedicated server, player is a remote client.

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

    Re: Вопросы.

    Цитата Сообщение от 41Sqn_Banks Посмотреть сообщение
    Unfortunately not, only one user label is drawn that has the actor.Name as text. The labels to a specific player or army are not drawn Script is running on a dedicated server, player is a remote client.
    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 :
    Код:
    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.

    --- Добавлено ---

    Цитата Сообщение от =HH=Pauk Посмотреть сообщение
    podvoxx, выручай, надежда на тебя, никто не может помочь в вопросе посадки гидросамолетов на воду... хотя в условиях задано.
    увы, похоже никак

    --- Добавлено ---

    Цитата Сообщение от Ph0b0s Посмотреть сообщение
    Вопрос,
    как определить было ли попадание по самолету одним игроком в другого?

    Появилась идея, немного повысить комфортность полетов на дуэльном сервере, а именно: выводить надпись игроку при нажатии Alt+F2 "Самолет противника уничтожен", который ранее подстрелил своего соперника, как это было в старом ИЛе при нажатии новой попытки, либо после полного уничтожения самолета.
    есть событие на повреждение самолёта -
    Код:
    public override void OnActorDamaged(int missionNumber, string shortName, AiActor actor, AiDamageInitiator initiator, part.NamedDamageTypes damageType)
        {
            base.OnActorDamaged(missionNumber, shortName, actor, initiator, damageType);
        }
    в нём как аргумент идёт initiator - это кто подбил и damageType - что подбили, можно запоминать и при выходе писать игроку.
    Don't happy, be worry

  9. #9
    Зашедший Аватар для =HH=Pauk
    Регистрация
    14.06.2005
    Адрес
    СПб
    Сообщений
    319

    Re: Вопросы.

    Цитата Сообщение от naryv Посмотреть сообщение
    Цитата Сообщение от =HH=Pauk Посмотреть сообщение
    парни, вопрос, как заставить Walrus садиться на воду и взлетать?
    эта амфибия боится воды...
    есть конечно же мысль, ограничить топляк, но это крайний выход и то решит вопрос только с посадкой
    увы, похоже никак
    спасибо за ответ, а то уже извелся в попытках его таки посадить... кроме как топляком заставить больше никак не получатся.
    Сталкиваясь с сильным противником, у тебя в голове лишь одна мысль... Как выжить?

  10. #10

    Re: Вопросы.

    Цитата Сообщение от 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 :
    Код:
    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.[COLOR="Silver"]
    Does GamePlay.gpPlayer() work for dedicated server, too?

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

    Re: Вопросы.

    Цитата Сообщение от 41Sqn_Banks Посмотреть сообщение
    Does GamePlay.gpPlayer() work for dedicated server, too?
    yes, just tryed this mission runing on dedicated server, join it, and enter the spit flying in mission, get 3 labels as it should be done.
    Don't happy, be worry

Ваши права

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