Results 1 to 6 of 6

Thread: Trigger on destroyed

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

    Trigger on destroyed

    I've tried to take some code form a workign mission (Hurricane patrol) and get it to work with minor changes in my own test but it doesn't seem to work. Is someone able to point out why at all please?

    My trigger is attached and my script is here:

    using System;
    using maddox.game;
    using maddox.game.world;
    using System.Collections.Generic;

    public class Mission : AMission
    {

    public override void OnTrigger(int missionNumber, string shortName, bool active)

    {
    base.OnTrigger(missionNumber, shortName, active);

    if ("destroy1".Equals(shortName) && active)
    GamePlay.gpHUDLogCenter("The reconnaissance plane is destroyed!!!");
    GamePlay.gpGetTrigger(shortName).Enable = false;

    }



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

  2. Likes danperin, ATAG_TCP liked this post
  3. #2
    Team Fusion danperin's Avatar
    Join Date
    Dec 2012
    Location
    Sao Paulo, Brazil
    Posts
    1,955
    Post Thanks / Like
    Total Downloaded
    806.84 MB

    Re: Trigger on destroyed

    Hey, Yo!

    Stop messing with my missions!!!


    Lol. just kidding, mate.

    It's awesome to know there's some interest from you guys into creating new missions for CloD


    Things that you have to know:

    First thing you need to do is to create the waypoint and do like this. Select Engage Fighter>Target-SET>select the waypoint for the action to take place:



    After that you can mess with the script:



    Have your .cs already named and on place on the folder, if it not show here, you can simply paste its contents on that area and edit at will,
    but always verify if it's updated inside the FMB with what you have changed on the external .cs file. The contents here and out on the .cs file need to be exactly the same for obvious reasons.




    Then you select "save" on the script box, save your mission, close the game and check the botton of your .mis file to look if the trigger 'victory1' is declared there:



    Your folder always should have all the files togheter and with the exact same name:

    Last edited by danperin; Jul-23-2020 at 17:35.

  4. Likes Yo-Yo, ATAG_TCP, 1lokos liked this post
  5. #3
    Team Fusion danperin's Avatar
    Join Date
    Dec 2012
    Location
    Sao Paulo, Brazil
    Posts
    1,955
    Post Thanks / Like
    Total Downloaded
    806.84 MB

    Re: Trigger on destroyed

    This is just the step by step to create a mission and embbed a .cs file there.

    I'm not a coder, mate, so i created those missions on trial and error like you years ago, i don't remember a lot of stuff, sorry
    Hope the code guys can help you with those script details.

    And here goes the code just for the "destroyed" message i found on an old txt file:

    Code:
    using System;
    using maddox.game;
    using maddox.game.world;
    
    public class Mission : maddox.game.AMission
    {
        public override void OnTrigger(int missionNumber, string shortName, bool active)
      {
       if("victory".Equals(shortName) && active)
       {
         GamePlay.gpHUDLogCenter("Target Destroyed");
         GamePlay.gpGetTrigger(shortName).Enable=false;
          }
      }
    }
    Last edited by danperin; Jul-23-2020 at 21:38.

  6. Likes Yo-Yo, ATAG_TCP liked this post
  7. #4
    Supporting Member
    Join Date
    Dec 2019
    Posts
    473
    Post Thanks / Like
    Total Downloaded
    22.61 MB

    Re: Trigger on destroyed

    Thats all great thanks, it makes sense I should actually target something in the first place now!

    I'm getting there with this scripting, slowly but hopefully surely. I'm getting far fewer compile errors now at least!

    My aim is to make some SP missions, maybe a campaign, both here and in Desert Wings when it comes out. I may be wrong, but I tend to beleive SP missions don't have to be overly fancy, just a few basics put together with a bit of variety, and a bit of attention to detail.... I may of course be gravely wrong, but we'll see. I'm pretty sure I'll end up a year down the line tearing my hair out as I try to track mission by mission stats and such, but, meh, it'll keep the mind alive.
    I am Yo-Yo not YoYo (that's someone else)

  8. Likes danperin, ATAG_TCP liked this post
  9. #5
    Team Fusion danperin's Avatar
    Join Date
    Dec 2012
    Location
    Sao Paulo, Brazil
    Posts
    1,955
    Post Thanks / Like
    Total Downloaded
    806.84 MB

    Re: Trigger on destroyed

    Quote Originally Posted by Yo-Yo View Post
    Thats all great thanks, it makes sense I should actually target something in the first place now!

    I'm getting there with this scripting, slowly but hopefully surely. I'm getting far fewer compile errors now at least!

    My aim is to make some SP missions, maybe a campaign, both here and in Desert Wings when it comes out. I may be wrong, but I tend to beleive SP missions don't have to be overly fancy, just a few basics put together with a bit of variety, and a bit of attention to detail.... I may of course be gravely wrong, but we'll see. I'm pretty sure I'll end up a year down the line tearing my hair out as I try to track mission by mission stats and such, but, meh, it'll keep the mind alive.
    You are right, single player missions are as simple as you are noticing.
    But you always can fill it with fancy scripts if you wish or populate the map to have stuff to see. The FMB have a huge amout of vehicles, ships, trains, AA, objects and etc to explore.

    The script for that patrol mission is a good template for you to create simple single player missions. The other two entries are just fields for you to put some message details for the mission or just a "Good luck on your mission" message because it's triggered to show when you start the mission.

    You can set the target for just one plane or a group the same way, for ground targets/ships you do the same stuff but you select Ground Attack - Target or Ground Attack - Area so you can even determine the percentage of damage to trigger the victory code. Same for one plane to destroy or a group.

    Good luck!

    And please share your missions with the community!

    Last edited by danperin; Jul-23-2020 at 17:34.

  10. Likes ATAG_TCP liked this post
  11. #6
    Supporting Member
    Join Date
    Dec 2019
    Posts
    473
    Post Thanks / Like
    Total Downloaded
    22.61 MB

    Re: Trigger on destroyed

    Quote Originally Posted by danperin View Post
    And please share your missions with the community!

    Of course will do.

    I have got that message/success script working now so another building block in place, thanks.
    I am Yo-Yo not YoYo (that's someone else)

  12. Likes danperin, ATAG_TCP 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
  •