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)
-   -   Script help for Storm of War Campaign (http://forum.fulqrumpublishing.com/showthread.php?t=35685)

notafinger! 11-04-2012 10:58 AM

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. :-P

FG28_Kodiak 11-04-2012 12:54 PM

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.

notafinger! 11-04-2012 02:20 PM

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.

5./JG27.Farber 11-04-2012 03:01 PM

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?

FG28_Kodiak 11-04-2012 04:30 PM

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;


        }
    }
}


_79_dev 11-07-2012 12:53 PM

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


FG28_Kodiak 11-07-2012 01:55 PM

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;

        }
    }


Osprey 11-09-2012 06:32 AM

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


All times are GMT. The time now is 10:38 AM.

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