Official Fulqrum Publishing forum

Official Fulqrum Publishing forum (http://forum.fulqrumpublishing.com/index.php)
-   FMB, Mission & Campaign builder Discussions (http://forum.fulqrumpublishing.com/forumdisplay.php?f=203)
-   -   [Tutorial] Target Pass Through Triggers Air/Scramble [wip] (http://forum.fulqrumpublishing.com/showthread.php?t=28487)

KG26_Alpha 12-15-2011 10:01 AM

[Tutorial] Target Pass Through Triggers Air/Scramble [wip]
 
Target Pass Through Trigger Tutorial.

I recommend reading this tutorial first. >> http://forum.1cpublishing.eu/showthread.php?t=28454

This allows you to set trigger events when aircraft fly through a defined area.

This example shows Defiants triggered to spawn and attack when He111's flying into the Target Trigger Area.

This tutorial assumes you have read the above example from FG28 Kodiak as the script spawn Only applies to the Defiants.

http://img.photobucket.com/albums/v1...nttrigger1.jpg
http://img.photobucket.com/albums/v1...nttrigger2.jpg
http://img.photobucket.com/albums/v1...nttrigger3.jpg

KG26_Alpha 12-15-2011 12:27 PM

Target Pass Through Scramble.
 
Target Pass Through Trigger Scramble Tutorial.

I recommend reading this tutorial first. >> http://forum.1cpublishing.eu/showthread.php?t=28454

This allows you to set trigger events when aircraft fly through a defined area.

This example shows Hurricanes triggered to spawn scramble and attack when Dornier 17's flying into the Target Trigger Area.

This tutorial assumes you have read the above example from FG28 Kodiak as the script spawn Only applies to the Hurricanes.

http://img.photobucket.com/albums/v1...letrigger1.jpg

http://img.photobucket.com/albums/v1...letrigger2.jpg

http://img.photobucket.com/albums/v1...letrigger3.jpg

WarFox101 12-15-2011 10:17 PM

Thanks for this, Now if i can only remember the million of things Ive learned in the past week ill be good.

28_Condor 12-16-2011 02:12 AM

The Target Pass Through Trigger works with the player going? I tried and it did not work ...

Will need a script?

Pato Salvaje 12-16-2011 08:33 AM

Thank you very much sir. Great tutorial. Keep it coming.
I have to test if a group with "script spawn C" selected can be flight by a human pilot...
And if this group can have only a "takeoff waypoint"...

WarFox101 12-16-2011 10:16 AM

OK works great, however the spawning aircraft keep spawning :( There must have been 50 on the ground waiting to take off.

Ataros 12-16-2011 10:52 AM

Quote:

Originally Posted by WarFox101 (Post 370626)
OK works great, however the spawning aircraft keep spawning :( There must have been 50 on the ground waiting to take off.

I suspect the trigger "works" for every aircraft in a group. Had this issue in R2 mission, had to include in a script a variable TriggerOn = 1 every time trigger "worked" and then check if TriggerOn = 1 or = 0 regularly.

FG28_Kodiak 12-16-2011 02:25 PM

You can use this script to avoid this:

Code:

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


public class Mission : AMission
{

    public override void OnTrigger(int missionNumber, string shortName, bool active)
    {
        base.OnTrigger(missionNumber, shortName, active);

        AiAction Action = GamePlay.gpGetAction(shortName);

        if (Action != null)
            Action.Do();
       
        GamePlay.gpGetTrigger(shortName).Enable = false;
    }
}


335th_GRAthos 12-16-2011 09:56 PM

Awesome!

Thanks guys for these postings!

:)

~S~

WarFox101 12-16-2011 11:30 PM

Thanks FG28_Kodiak looks good, ill try it out and see how it works.

Freyah 05-27-2012 01:20 PM

@Kodiak, I'm looking at the script you posted to nullify multiple spawn events:
Quote:

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


public class Mission : AMission
{

public override void OnTrigger(int missionNumber, string shortName, bool active)
{
base.OnTrigger(missionNumber, shortName, active);

AiAction Action = GamePlay.gpGetAction(shortName);

if (Action != null)
Action.Do();

GamePlay.gpGetTrigger(shortName).Enable = false;
}
}
If I have at trigger to spawn 109's (called "109") and only want them to spawn once, no matter how many times I fly through the trigger zone, should It be done with your script by just putting "109" where ever (shortname) appears? Do I just write for example - public override void OnTrigger(int missionNumber, string 109, bool active) etc or is there something to be entered for missionNumber and bool active? (possibly Amission too?) Also is it possible to do this for several triggers in one mission by just repeating the script in its entirety one after another?

Hope its no trouble to ask, I'm just learning the ropes here....

cheers
Freyah

FG28_Kodiak 05-27-2012 01:32 PM

You get the triggername via shortName.
So you can check the trigger with a if clause.

OnTrigger(..) should look like:
Code:

  public override void OnTrigger(int missionNumber, string shortName, bool active)
    {
        base.OnTrigger(missionNumber, shortName, active);


        if ("109".Equals(shortName))
        {
            AiAction Action = GamePlay.gpGetAction(shortName); // if your action has an other Name than your trigger change GamePlay.gpGetAction(shortName) into GamePlay.gpGetAction("ActionName")

            if (Action != null)
                Action.Do();

            GamePlay.gpGetTrigger(shortName).Enable = false; // if trigger is TPassThru to avoid multiple activation

            return; // leave method to avoid second call of the Action
        }


        AiAction Action = GamePlay.gpGetAction(shortName);

        if (Action != null)
            Action.Do();
        GamePlay.gpGetTrigger(shortName).Enable = false;
       
    }


Freyah 05-27-2012 01:44 PM

Thanks for the speedy reply !! I think I'm understanding it better now, will test it out soon! Can I do this over and over in the same script, to get the same effect for other triggers of the same type? eg 109 , Spit , 110 , etc.

FG28_Kodiak 05-27-2012 02:25 PM

Yes, simply add an other if clause (in a script you can only use one method, a second OnTrigger would cause an error, so you must modify the existing):
Code:

public override void OnTrigger(int missionNumber, string shortName, bool active)
    {
        base.OnTrigger(missionNumber, shortName, active);


        if ("109".Equals(shortName))
        {
            AiAction Action = GamePlay.gpGetAction(shortName); // if your action has an other Name than your trigger change GamePlay.gpGetAction(shortName) into GamePlay.gpGetAction("ActionName")

            if (Action != null)
                Action.Do();

            GamePlay.gpGetTrigger(shortName).Enable = false; // if trigger is TPassThru to avoid multiple activation

            return; // leave method to avoid second call of the Action
        }

        if ("Spit".Equals(shortName))
        {
            AiAction Action = GamePlay.gpGetAction(shortName); // if your action has an other Name than your trigger change GamePlay.gpGetAction(shortName) into GamePlay.gpGetAction("ActionName")

            if (Action != null)
                Action.Do();

            GamePlay.gpGetTrigger(shortName).Enable = false; // if trigger is TPassThru to avoid multiple activation

            return; // leave method to avoid second call of the Action
        }

        AiAction Action = GamePlay.gpGetAction(shortName);

        if (Action != null)
            Action.Do();
        GamePlay.gpGetTrigger(shortName).Enable = false;
       
    }


Freyah 05-28-2012 12:48 AM

Thankyou Kodiak! That works like a charm. Got it to work using this :

Code:

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


public class Mission : AMission
{


    public override void OnTrigger(int missionNumber, string shortName, bool active)
    {
        base.OnTrigger(missionNumber, shortName, active);


        if ("109".Equals(shortName))
        {
            AiAction Action = GamePlay.gpGetAction("109"); // if your action has an other Name than your trigger change GamePlay.gpGetAction(shortName) into GamePlay.gpGetAction("ActionName")

            if (Action != null)
                Action.Do();

            GamePlay.gpGetTrigger(shortName).Enable = false; // if trigger is TPassThru to avoid multiple activation

            return; // leave method to avoid second call of the Action
        }



       
    }
}

( I think I can change the - AiAction Action = GamePlay.gpGetAction("109"); - back to (shortName).. but I'll leave it scince it works...

I'm very grateful for your time and for this lesson! I'm in your debt Sir!
Now to tackle the Multiple trigger ones.....

Cheers,
Freyah

hc_wolf 05-28-2012 04:49 AM

Freyhay, this should give you a head start with multiple grouped trigger objective.

All 3 ships must be destroyed before the objective is complete.
Use it for just about anything. Your Triggers are called Ship1, ship2 etc.


Code:


    int TotalRedShipsDestroyed = 0;
        const string Objective_Ships = "  English Supply Tankers 3 of 3,";        //BlueObjective  RedShips Destroyed

        bool ship1 = false;        //English Supply Tanker 1 of 3        ship1
    bool ship2 = false;        //English Supply Tanker 2 of 3        ship2       
    bool ship3 = false;        //English Supply Tanker 3 of 3        ship3



  public override void OnTrigger(int missionNumber, string shortName, bool active)
    {
        base.OnTrigger(missionNumber, shortName, active);

            if ("ship1".Equals(shortName) && active)
                {
                    TotalRedShipsDestroyed++;
                    GamePlay.gpLogServer(null, "British Ship " + TotalRedShipsDestroyed.ToString() + " of 10 destroyed!!!", new object[] { });
                    ship1 = true;
                }

                if ("ship2".Equals(shortName) && active)
                {
                    TotalRedShipsDestroyed++;
                    GamePlay.gpLogServer(null, "British Ship " + TotalRedShipsDestroyed.ToString() + " of 10 destroyed!!!", new object[] { });
                    ship2 = true;
                }

                if ("ship3".Equals(shortName) && active)
                {
                    TotalRedShipsDestroyed++;
                    GamePlay.gpLogServer(null, "British Ship " + TotalRedShipsDestroyed.ToString() + " of 10 destroyed!!!", new object[] { });
                    ship3 = true;
                }
                               
                               
                                if (ship1 && ship2 && ship3)
                {
                    GamePlay.gpHUDLogCenter("English Supply ships headding North have been destroyed!!!");
                    GamePlay.gpGetTrigger(shortName).Enable = false;
                    Timeout(10, () =>
                    {
                        GamePlay.gpLogServer(null, "Blue Objective  Completed!!!", new object[] { });
                        GamePlay.gpHUDLogCenter("Blue Objective  Completed!!!");
                                                Objective_Total_Blue += (Objective_Ships);
                    });
                }
        }


Freyah 05-28-2012 04:10 PM

Thankyou hc_wolf! I will certainly try it out !

superbee15 10-29-2012 05:41 AM

Just trying 1st mission and wanted to use trigger.

What and where is "script spawn C"?

KG26_Alpha 10-29-2012 01:25 PM

Quote:

Originally Posted by superbee15 (Post 474289)
Just trying 1st mission and wanted to use trigger.

What and where is "script spawn C"?

Its in the triggers menu

superbee15 10-30-2012 04:04 AM

1 Attachment(s)
Alpha
Thanks for reply.
As commented in original question I am totally new to FMB in CLOD. I also read post by Kodiak.

I cannot see any item menu that is like "script spawn C". I have attached screen shot of what I see.

Any help appreciated.

Cheers

FG28_Kodiak 10-30-2012 04:37 AM

Not on the trigger page, open the Object-Browser place a plane on the map, then you can select the Group properties, at the end of the option list you will find what you looking for ;).

superbee15 10-30-2012 07:45 AM

Thanks Kodiak
Got it working. It seems a little finicky (missed typed name 1st time) but it works now.

Cheers

KG26_Alpha 10-30-2012 10:01 AM

Yes sorry,

As in the second post tutorial image, it shows the Group Properties tab and check the "script spawn " box at the bottom.

I'm working on something else so its been a while since I was in there, some script phrases sound similar to others and can be confusing.

:grin:

fruitbat 10-30-2012 08:16 PM

I'm obviously doing something wrong, as i can't get the "script spawn C" box at the bottom, and have instead this,

http://i7.photobucket.com/albums/y29...tbat1/fmb1.jpg

http://i7.photobucket.com/albums/y29...tbat1/fmb2.jpg

Any ideas????:confused:

FG28_Kodiak 10-30-2012 09:08 PM

Open the object browser under group properties at the bottom you will find it :rolleyes:

fruitbat 10-30-2012 09:10 PM

Quote:

Originally Posted by FG28_Kodiak (Post 475263)
Open the object browser under group properties at the bottom you will find it :rolleyes:

but it shows "Script Spawn Or" instead, as shown in the screenshots in my post above.....

whereas in Alphas screenshot it does say "Script Spawn C"

http://img.photobucket.com/albums/v1...letrigger2.jpg

bolox 10-30-2012 09:14 PM

select Ju87> properties> group properties tab
scroll down to bottom- last check box = "Script Spawn Or" - on my install
tick this to enable it to be spawned by trigger

(you could look at somt mission#46 in fmb- all the RAF fighters are spawned this way- but only if you've played it;) )

fruitbat 10-30-2012 09:16 PM

Quote:

Originally Posted by bolox (Post 475269)
select Ju87> properties> group properties tab
scroll down to bottom- last check box = "Script Spawn Or"
tick this to enable it to be spawned by trigger

(you could look at somt mission#46 in fmb- all the RAF fighters are spawned this way- but only if you've played it;) )

Haven't got that far yet;)

however, will be looking very closely at it now!

FG28_Kodiak 10-31-2012 04:28 AM

Script Spawn Or the lable is cut of, i think its should called "Script Spawn Only" :rolleyes:

http://img827.imageshack.us/img827/8...letrigger2.jpg

Riksen 11-02-2013 10:40 PM

Hey guys whats up?!! Hope everything is going good for everyone... I'm getting into scripting for my missions and I would like to know if any of u guys know how i can get the scripts of the training missions... U see, I'm making a campaign for Battle of Britain and I would like to start with a training mission at first, similar to the one already present in the game (training with the Tiger Moth), but I cant find the cs files for those missions anywhere. I have no clue how the mission triggers those yellow flasing rings, how to position the player in front of the aircaraft, how to allow the ai to take over the plane for landing, etc...

Any help?

Killerwhale 09-10-2014 12:18 AM

is there anyway that you can command aircrafts to take off? i have 3 aircrafts including mine set for take off. i can take off but they wont follow and the control tower keeps saying permission for take off denied.

Continu0 09-10-2014 08:44 AM

Hi

Try to switch on the autopilot for 5 secs before you take off. After that, they should follow you.


All times are GMT. The time now is 12:07 AM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 2007 Fulqrum Publishing. All rights reserved.