Results 1 to 14 of 14

Thread: HUD message not working when in a campaign

  1. #1
    Supporting Member
    Join Date
    Dec 2019
    Posts
    473
    Post Thanks / Like
    Total Downloaded
    22.61 MB

    HUD message not working when in a campaign

    Hi,

    Does anyone happen to know a quick reason why my:

    GamePlay.gpHUDLogCenter

    Doesn't work now I've changed my script to be a campaign class. i.e.

    public class Mission : maddox.game.campaign.Mission

    Instead of:

    public class Mission : AMission

    I can see that HUD messages work in other campaigns, but can't see what I need to change in the reference or whatever to get mine to work again.

    Thanks.
    I am Yo-Yo not YoYo (that's someone else)

  2. #2
    ATAG Member ATAG_Oskar's Avatar
    Join Date
    Nov 2017
    Location
    Canada
    Posts
    986
    Post Thanks / Like
    Total Downloaded
    908.31 MB

    Re: HUD message not working when in a campaign

    What version are you using?

    void gpHUDLogCenter(string msg);
    void gpHUDLogCenter(Player[] to, string msg);
    void gpHUDLogCenter(Player[] to, string msg, object[] parms);
    void gpHUDLogCenter(Player[] to, string msg, object[] parms, double lifeTime);

  3. #3
    Supporting Member
    Join Date
    Dec 2019
    Posts
    473
    Post Thanks / Like
    Total Downloaded
    22.61 MB

    Re: HUD message not working when in a campaign

    Quote Originally Posted by ATAG_Oskar View Post
    What version are you using?

    void gpHUDLogCenter(string msg);
    void gpHUDLogCenter(Player[] to, string msg);
    void gpHUDLogCenter(Player[] to, string msg, object[] parms);
    void gpHUDLogCenter(Player[] to, string msg, object[] parms, double lifeTime);
    void gpHUDLogCenter(string msg);

    That one I think, I just use:

    GamePlay.gpHUDLogCenter("My message here") and it would display the text on screen.

    It's the one that I use alot in my guide to te FMB.

    Maybe I've messed up something else, but all I did was change the one liine on the class to get my missions into a campagin and then my HUD messages stopped.

    I was hoping there was an 'easy answer' rather than me having to dig around and try testing script within a campaign...
    I am Yo-Yo not YoYo (that's someone else)

  4. #4
    varrattu
    Guest

    Re: HUD message not working when in a campaign

    As far as I know AI pilots do not recognise gpHUDLogCenter messages at all.

    And as long as you are the one and only human in your campaign you can / should use

    GamePlay.gpHUDLogCenter("Hello Yo-Yo");

    without any overload method.

    ~V~

  5. #5
    Supporting Member
    Join Date
    Dec 2019
    Posts
    473
    Post Thanks / Like
    Total Downloaded
    22.61 MB

    Re: HUD message not working when in a campaign

    Yes that's all I think I am doing.

    The HUD works fine when I have it as a single mission, but when I put it in a campaign (by just changing the line for the main class) it isn't showing for some reason.

    I've looked at a mission in the default career and that seems to have the HUD showing 'mission complete' to the player, and without any difference to what I have in my script.

    Looks like I'll have to put the hours in to figure it out.
    I am Yo-Yo not YoYo (that's someone else)

  6. #6
    varrattu
    Guest

    Re: HUD message not working when in a campaign

    "just changing the line for the main class" is not enough.

    Try it after adding:

    Code:
    //$reference parts/core/Campaign.dll
    
    using maddox.game.campaign;
    ~V~

    Edit: if your script file is not TOP SECRET, feel free to show it. Remote diagnosis is always difficult and in the end leads to guessing game

    The more we share, the more we learn ...
    Last edited by varrattu; Sep-29-2020 at 09:16.

  7. Likes fenbeiduo liked this post
  8. #7
    Ace 1lokos's Avatar
    Join Date
    Jan 2012
    Posts
    5,323
    Post Thanks / Like
    Total Downloaded
    1.04 GB

    Re: HUD message not working when in a campaign

    Default campaign use GamePlay.gpHUDLogCenter for "yellow messages" and SayToGroup for planes "chit chat".

    Code:
    //$reference Campaign.dll
    //-$debug
    using System;
    using maddox.game;
    using maddox.game.world;
    
    public class Mission : maddox.game.campaign.Mission 
    {
    
        AiActor a1, a2, a3;
        AiAircraft airc1, airc2, airc3, my_airc;
    
        public override void OnBattleStarted() {
            base.OnBattleStarted();
            a1 = GamePlay.gpActorByName("0:BoB_RAF_F_FatCat_Early.010");
            a2 = GamePlay.gpActorByName("0:BoB_RAF_F_FatCat_Early.100");
            a3 = GamePlay.gpActorByName("0:BoB_RAF_F_FatCat_Early.000");
    
    
            if (a1 == null || a2 == null || a3 == null) {
                System.Console.WriteLine("SCRIPR ERROR: Aircraft not found");
            }
    
            airc1 = (AiAircraft)a1;
            airc2 = (AiAircraft)a2;
            airc3 = (AiAircraft)a3;
            my_airc = (AiAircraft)GamePlay.gpPlayer().Place();
    
            if (airc1.Person(0) != null) {
                Timeout(20.0, () => {
                    airc1.SayToGroup(my_airc.AirGroup(), "Weather_looks_good_all_the_way_to_Manston_Good_luck_sir");
                });
                Timeout(90.0, () => {
                    airc1.SayToGroup(my_airc.AirGroup(), "Hello_Hurricane_do_you_copy_There_s_an_enemy_flight");
                });
            }
    
        }
    
        private void checkLanded(AiAircraft aircraft) {
            if (GamePlay.gpPlayer().Place() != aircraft)
                return;
            if (GamePlay.gpGetTrigger("airdrome1").Active) {
                if (Campaign != null) {
                    if (Campaign.battleSuccess != null)
                        return;
                    Campaign.battleSuccess = true;
                }
                GamePlay.gpHUDLogCenter("MISSION COMPLETE");
            }
        }

  9. #8
    Manual Creation Group fenbeiduo's Avatar
    Join Date
    May 2013
    Posts
    70
    Post Thanks / Like
    Total Downloaded
    282.61 MB

    Question Re: HUD message not working when in a campaign

    Quote Originally Posted by 1lokos View Post
    ...
    public class Mission : maddox.game.campaign.Mission
    {
    ...
    I was using 'Amission' for a campaign mission to somehow achieve the 'mission complete'(message)

    Any different between 'Amission' and 'maddox.game.campaign.Mission '?
    (or any short come to use 'Amission' in a campaign mission?)
    Last edited by fenbeiduo; Sep-29-2020 at 14:12.

  10. #9
    Supporting Member
    Join Date
    Dec 2019
    Posts
    473
    Post Thanks / Like
    Total Downloaded
    22.61 MB

    Re: HUD message not working when in a campaign

    Here's an example:

    This works in FMB and single mission:

    Code:
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.ComponentModel.Design;
    using maddox.game;
    using maddox.game.world;
    using System.Diagnostics;
    
    
    public class Mission : AMission
    {
        public override void OnBattleStarted()
        {
            GamePlay.gpHUDLogCenter("Start-up and let oil temperature reach at least 40 degrees before taxiing");
    
        }
    }
    But when converted to how I understand it needs to be for a campaign mission, it doesn't, it also doesn't compile in the FMB:

    Code:
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.ComponentModel.Design;
    using maddox.game;
    using maddox.game.world;
    using System.Diagnostics;
    
    
    public class Mission : maddox.game.campaign.Mission
    {
        public override void OnBattleStarted()
        {
            GamePlay.gpHUDLogCenter("Start-up and let oil temperature reach at least 40 degrees before taxiing");
    
        }
    }
    Compile error is:

    errorCS0234: The type or namespace 'campaign' does not exist in the namespace 'maddox.game' (are you missing an assembly reference?)
    I am Yo-Yo not YoYo (that's someone else)

  11. #10
    Ace 1lokos's Avatar
    Join Date
    Jan 2012
    Posts
    5,323
    Post Thanks / Like
    Total Downloaded
    1.04 GB

    Re: HUD message not working when in a campaign

    Is not due lack of this lines at top of script?

    Code:
    //$reference Campaign.dll
    //-$debug
    using System;
    ...

  12. Likes N/A, Yo-Yo liked this post
  13. #11
    varrattu
    Guest

    Re: HUD message not working when in a campaign

    @1lokos

    and here the long version ...


    @Yo-Yo: don't care about compiler errors, just test it

    ~V~


    Code:
    //$reference parts/core/Campaign.dll
    
    using maddox.game;
    using maddox.game.campaign;
    
    
    public class Mission : maddox.game.campaign.Mission
    {
        public override void OnBattleStarted()
        {
            GamePlay.gpHUDLogCenter("Start-up and let oil temperature reach at least 40 degrees before taxiing");
    
        }
    }


    Quote Originally Posted by 1lokos View Post
    Is not due lack of this lines at top of script?

    Code:
    //$reference Campaign.dll
    //-$debug
    using System;
    ...
    Attached Images Attached Images
    Last edited by varrattu; Sep-29-2020 at 14:02.

  14. Likes Yo-Yo, 1lokos, danperin liked this post
  15. #12
    Supporting Member
    Join Date
    Dec 2019
    Posts
    473
    Post Thanks / Like
    Total Downloaded
    22.61 MB

    Re: HUD message not working when in a campaign

    Thanks, I'll give it a try, and add that reference in to a new version of my guide when I have time.
    I am Yo-Yo not YoYo (that's someone else)

  16. #13
    Supporting Member
    Join Date
    Dec 2019
    Posts
    473
    Post Thanks / Like
    Total Downloaded
    22.61 MB

    Re: HUD message not working when in a campaign

    Well I've got that test message working from that script there when I use it instead of all my script, now I just need to figure out what else it is in my script that seems to be incompatible!

    Thanks for the assistance, I'm a step closer to my first string of campaign missions.

    Edit: Have got my triggers, other HUD messages, battle success flags and onAircraftDamaged working now. So it just leaves the timed messages to add in.
    Last edited by Yo-Yo; Sep-29-2020 at 15:38.
    I am Yo-Yo not YoYo (that's someone else)

  17. #14
    Supporting Member
    Join Date
    Dec 2019
    Posts
    473
    Post Thanks / Like
    Total Downloaded
    22.61 MB

    Re: HUD message not working when in a campaign

    OK, I seem to have got all of my first mission script working now in a campaign, thanks for all the help.

    I am Yo-Yo not YoYo (that's someone else)

  18. Likes 1lokos, TWC_Flug liked this post

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •