1C Home   |   Register   |   Today Posts   |   Members   |   UserCP   |   Calendar   |   Search   |   FAQ

Go Back   Official 1C Company forum > 1C Publishing > IL-2 Sturmovik: Cliffs of Dover > FMB, Mission & Campaign builder Discussions

Reply
 
Thread Tools Display Modes
  #11  
Old 05-27-2012, 01:20 PM
Freyah's Avatar
Freyah Freyah is offline
Approved Member
 
Join Date: May 2012
Posts: 8
Default

@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
Reply With Quote
  #12  
Old 05-27-2012, 01:32 PM
FG28_Kodiak FG28_Kodiak is offline
Senior Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

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;
        
    }
Reply With Quote
  #13  
Old 05-27-2012, 01:44 PM
Freyah's Avatar
Freyah Freyah is offline
Approved Member
 
Join Date: May 2012
Posts: 8
Default

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.
Reply With Quote
  #14  
Old 05-27-2012, 02:25 PM
FG28_Kodiak FG28_Kodiak is offline
Senior Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

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;
        
    }

Last edited by FG28_Kodiak; 05-27-2012 at 02:27 PM.
Reply With Quote
  #15  
Old 05-28-2012, 12:48 AM
Freyah's Avatar
Freyah Freyah is offline
Approved Member
 
Join Date: May 2012
Posts: 8
Default

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
Reply With Quote
  #16  
Old 05-28-2012, 04:49 AM
hc_wolf hc_wolf is offline
Approved Member
 
Join Date: Jul 2010
Posts: 439
Default

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);
                    });
                }
	}
__________________
__________________
Win7, 64bit Ultra
Asus P8P67Pro MB
Intel i7-2600K
Coursair 16GB (4x 4GB), DDR3-1600MHz
Gainward Nvidia 580GTX 3GB DDR5
850-Watt Modular Power Supply
WIN7 and COD on Gskill SSD 240GB
40" Panasonic LCD
TrackIR5 +
Thrustmaster Warthog stick, throttle & pedals
Reply With Quote
  #17  
Old 05-28-2012, 04:10 PM
Freyah's Avatar
Freyah Freyah is offline
Approved Member
 
Join Date: May 2012
Posts: 8
Default

Thankyou hc_wolf! I will certainly try it out !
Reply With Quote
  #18  
Old 10-29-2012, 05:41 AM
superbee15 superbee15 is offline
Junior Member
 
Join Date: Apr 2011
Location: Qld Australia
Posts: 13
Default

Just trying 1st mission and wanted to use trigger.

What and where is "script spawn C"?
Reply With Quote
  #19  
Old 10-29-2012, 01:25 PM
KG26_Alpha's Avatar
KG26_Alpha KG26_Alpha is offline
Super Moderator
 
Join Date: Jan 2008
Location: London
Posts: 2,796
Default

Quote:
Originally Posted by superbee15 View Post
Just trying 1st mission and wanted to use trigger.

What and where is "script spawn C"?
Its in the triggers menu
__________________


Reply With Quote
  #20  
Old 10-30-2012, 04:04 AM
superbee15 superbee15 is offline
Junior Member
 
Join Date: Apr 2011
Location: Qld Australia
Posts: 13
Default

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
Attached Images
File Type: jpg Trigger Page.jpg (8.9 KB, 24 views)
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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

Based on a design by: Miner Skinz.com

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright © 2007 1C Company. All rights reserved.