Results 1 to 5 of 5

Thread: Units activated by one trigger do not activate another trigger

  1. #1
    Novice Pilot ITAF_Airone1989's Avatar
    Join Date
    Aug 2020
    Posts
    95
    Post Thanks / Like
    Total Downloaded
    812.8 KB

    Units activated by one trigger do not activate another trigger

    Hi to all,
    I did some tests and seems that a units activated by one trigger do not activate another trigger.
    So, for example, I have a group of planes createdby a time triggerand then I want a message that says "mission completed" when they are destroyed, even if the script is correct the message doesn't appear.

    Any solutions?

    Many thanks

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

    Re: Units activated by one trigger do not activate another trigger

    I tested this once and have mixed results, a PassThrough activated by a plane spawn a tank, that when destroy a truck trigger
    DestroyGround for spawn a ship... sometimes the ship spawn, but most times no.

  3. Likes ITAF_Airone1989 liked this post
  4. #3
    Team Fusion Artist's Avatar
    Join Date
    Mar 2010
    Posts
    2,866
    Post Thanks / Like
    Total Downloaded
    319.97 MB

    Re: Units activated by one trigger do not activate another trigger

    Units activated at runtime must have their trigger also created in the code at runtime after the activation. Triggers defined in the FMB have no effect. An example on how to create triggers at runtime can be found in the CRadar class of the SampleMission. I'll post example code here later.

  5. Likes N/A liked this post
  6. #4
    Team Fusion Artist's Avatar
    Join Date
    Mar 2010
    Posts
    2,866
    Post Thanks / Like
    Total Downloaded
    319.97 MB

    Re: Units activated by one trigger do not activate another trigger

    Code:
        public override void OnTrigger(int missionNumber, string shortName, bool active)
        {
            base.OnTrigger(missionNumber, shortName, active);
            if ("Rommel_Car_Dismount".Equals(shortName) && active)
            {
                GamePlay.gpGetTrigger(shortName).Enable = false;
                /// get the aircraft group ("BoB_LW_Wekusta_ObdL.01 30") spawn in, takeoff, follow waypoints action
                AiAction action = GamePlay.gpGetAction("Rommel_Plane");
                if (action != null)
                {
                    action.Do();
                    /// create a new trigger 
                    Timeout(10, () => {
                        ISectionFile sfTrigger = GamePlay.gpCreateSectionFile();
                        sfTrigger.add("Trigger", "Rommel_Plane_Destroy", "TGroupDestroyed BoB_LW_Wekusta_ObdL.01 30");
                        GamePlay.gpPostMissionLoad(sfTrigger);
                    });
                }
            }
            else if ("Rommel_Plane_Destroy".Equals(shortName) && active)
            {
                /// Do what must be done ;-)
            }
        ...

  7. Likes N/A liked this post
  8. #5
    Supporting Member
    Join Date
    Dec 2019
    Posts
    473
    Post Thanks / Like
    Total Downloaded
    22.61 MB

    Re: Units activated by one trigger do not activate another trigger

    Quote Originally Posted by Airone1989 View Post
    Hi to all,
    I did some tests and seems that a units activated by one trigger do not activate another trigger.
    So, for example, I have a group of planes createdby a time triggerand then I want a message that says "mission completed" when they are destroyed, even if the script is correct the message doesn't appear.

    Any solutions?

    Many thanks
    I think I came up against this myself, check this thread:

    https://theairtacticalassaultgroup.c...l=1#post362549

    Basically you neef the 'listener' bit when your mission starts. Please treat the more knowedgeable people's responses as better guidance than mine though!

    If you look at the missions you tested for me, at the one with a recon 108 reported in the bay, that mission actually initially either spawns the 108 OR the 109s, and, if the 108 spawns and then is damaged it may or may not spawn the 109s too. So I'm using an 'on damaged' based on a spawned 108 to maybe (random number generation) spawn some 109s to come and attack the player if you hang around too long. To get that to work it needed the 'listener' bit of code.
    I am Yo-Yo not YoYo (that's someone else)

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
  •