Fulqrum Publishing Home   |   Register   |   Today Posts   |   Members   |   UserCP   |   Calendar   |   Search   |   FAQ

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

Reply
 
Thread Tools Display Modes
  #1  
Old 11-04-2012, 10:58 AM
notafinger! notafinger! is offline
Approved Member
 
Join Date: Feb 2011
Posts: 124
Default Script help for Storm of War Campaign

Hi,

I need a script to flash a screen message using a trigger, TTime. I tried with onticktime but there was alot of variation in the timings of the messages between different servers. I need it spelled out for me exactly like you would a child.
Reply With Quote
  #2  
Old 11-04-2012, 12:54 PM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

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

public class Mission : AMission
{

    public override void OnBattleStarted()
    {
        base.OnBattleStarted();
        
        MissionNumberListener = -1;
    }



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


        if (shortName.Equals("TimerTriggerName"))
        {
            GamePlay.gpHUDLogCenter("yourMessage");
        }


        AiAction action = GamePlay.gpGetAction(ActorName.Full(missionNumber, shortName));

        if (action != null)
        {
            action.Do();
        }
    }
}
Change TimerTriggerName and yourMessage to your needs.
Reply With Quote
  #3  
Old 11-04-2012, 02:20 PM
notafinger! notafinger! is offline
Approved Member
 
Join Date: Feb 2011
Posts: 124
Default

Would this be the same for a pass through trigger? Also, I would want the message to be sent to one side only.

For example, I want a group of blue AI bombers that once they pass a certain point a screen message would go for red saying that bombers were inbound.

Last edited by notafinger!; 11-04-2012 at 03:15 PM.
Reply With Quote
  #4  
Old 11-04-2012, 03:01 PM
5./JG27.Farber 5./JG27.Farber is offline
Approved Member
 
Join Date: Aug 2011
Posts: 1,958
Default

Kodiak,

Thanks for your help once again. If I recall there was a piece of script to make this only trigger once, was there not?
Reply With Quote
  #5  
Old 11-04-2012, 04:30 PM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

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

public class Mission : AMission
{
     public override void OnBattleStarted()
    {
        base.OnBattleStarted();

        MissionNumberListener = -1;
    }


    public List<Player> GetAllPlayer()
    {
        List<Player> players = new List<Player>();

        if (GamePlay.gpIsServerSingle())
            if (GamePlay.gpPlayer()!= null)
                players.Add(GamePlay.gpPlayer());

        if (GamePlay.gpRemotePlayers()!= null)
            players.AddRange(GamePlay.gpRemotePlayers());

        return players;
    }

    public Player[] BlueSide()
    {
        if (GetAllPlayer().Exists(item => item.Army() == 2))
            return GetAllPlayer().FindAll(item => item.Army() == 2).ToArray();

        return null;
    }

    public Player[] RedSide()
    {
        if (GetAllPlayer().Exists(item => item.Army() == 1))
            return GetAllPlayer().FindAll(item => item.Army() == 1).ToArray();

        return null;
    }

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


        if (shortName.Equals("TimerTriggerName"))
        {
            GamePlay.gpHUDLogCenter("yourMessage");
        }



        if (shortName.Equals("RedTriggerName"))
        {
            if (RedSide()!=null)
                GamePlay.gpHUDLogCenter(RedSide(), "yourMessage");
        }


        if (shortName.Equals("BlueTriggerName"))
        {
            if (BlueSide() != null)
                GamePlay.gpHUDLogCenter(BlueSide(), "yourMessage");
        }


        if (shortName.Equals("TPassThruTriggerName"))
        {
            AiAction action = GamePlay.gpGetAction(ActorName.Full(missionNumber, shortName));

            if (action != null)
            {
                action.Do();
            }

            //Add this for deaktivate the tpassthru trigger
            GamePlay.gpGetTrigger(shortName).Enable = false;


        }
    }
}
Reply With Quote
  #6  
Old 11-07-2012, 12:53 PM
_79_dev _79_dev is offline
Approved Member
 
Join Date: Sep 2010
Location: Dublin
Posts: 242
Default

Hi Kodiak, in this part of script:

PHP Code:
 if (shortName.Equals("TPassThruTriggerName"))
        {
            
AiAction action GamePlay.gpGetAction(ActorName.Full(missionNumbershortName));

            if (
action != null)
            {
                
action.Do();
            }

            
//Add this for deaktivate the tpassthru trigger
            
GamePlay.gpGetTrigger(shortName).Enable false;


        } 
does this:

PHP Code:
if (action != null)
            {
                
action.Do();
            } 

have to be inside "if (shortName.Equals("TPassThruTriggerName"))" ?

does it mean that action will be done only for TPassThruTrigger?

Also deactivating trigger means to disable theme for good or after they invoked?

PHP Code:
 //Add this for deaktivate the tpassthru trigger
            
GamePlay.gpGetTrigger(shortName).Enable false
__________________

Asus P6T V2 Deluxe, I7 930, 3x2 GB RAM XMS3 Corsair1333 Mhz, Nvidia Leadtek GTX 470, Acer 1260p screen projector, Track IR 4 OS ver5, Saitek Pro Flight Rudder, Saitek X52, Win 7 x64 ultimate
Reply With Quote
  #7  
Old 11-07-2012, 01:55 PM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

the action is only activated if the trigger is triggered, you can also place it outside if you like.

Quote:
Also deactivating trigger means to disable theme for good or after they invoked?
All other triggers are deactivated after activation, exept TGroupDestroyed is also deaktivated if the group reached the last waypoint. TPassThru is not deaktivated after activation so you must do it via script.
In my case above the passthru tigger must be activated once. But you can disable a trigger at any time. For example you have two condition one win and one fail.
Maybe the win condition is to destroy groundtargets and you use a TGroundDestroy trigger and the fail condition you must make it before the time is over. To avoid the activation of the second trigger you can disable it.
Example:
Code:
    public override void OnTrigger(int missionNumber, string shortName, bool active)
    {
        base.OnTrigger(missionNumber, shortName, active);


        if (shortName.Equals("TimerTriggerName"))
        {
            GamePlay.gpHUDLogCenter("You failed Time is over");
            GamePlay.gpGetTrigger("GroundDestroyed").Enable = false;
        }

        if (shortName.Equals("GroundDestroyed"))
        {
            GamePlay.gpHUDLogCenter("You win you destroyed the Groundtargets");
            GamePlay.gpGetTrigger("TimerTriggerName").Enable = false;

        }
    }

Last edited by FG28_Kodiak; 11-07-2012 at 02:00 PM.
Reply With Quote
  #8  
Old 11-09-2012, 06:32 AM
Osprey's Avatar
Osprey Osprey is offline
Approved Member
 
Join Date: Jan 2010
Location: Gloucestershire, England
Posts: 1,264
Default

Gruber, the script that I emailed you had pass through events triggering successfully. Did this not work?
Reply With Quote
Reply


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 08:27 AM.


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