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)
-   -   spawn airgroups? (http://forum.fulqrumpublishing.com/showthread.php?t=26515)

David198502 09-27-2011 09:54 AM

spawn airgroups?
 
just cannot get airplanes to spawn.
in the FMB i want to spawn a group of planes after another is destroyed, but nothing happens.:confused:
after i destroyed the first group, the second will just not appear.
can someone please explain how to do that?

SNAFU 09-27-2011 10:34 AM

The Trigger-Action was broken a few patchs ago. You have to activate the Action by script.

First define Triggers as usual (Groupdead Triggers must have same Name as the Spawn-Action) and then implement the following into your script:

Code:

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

          if ("YourTriggerName".Equals(shortName) && active)
          {
                AiAction action = GamePlay.gpGetAction("YourActionName"); //same as YourTriggerName
                GamePlay.gpLogServer(null, " Your Trigger was triggered ", new object[] { }); //Testmessage
                if (action != null)
              {
                    action.Do();
              }
                GamePlay.gpGetTrigger(shortName).Enable = false;           
          }
}

You can also work around the trigger by script methods, but that`s another story. ;)

David198502 09-27-2011 11:15 AM

thx but doesnt seem to work...

salmo 10-04-2011 12:59 PM

... and doesn't seem to work for me either (spawning a bomber group every x seconds) :(

SNAFU 10-04-2011 01:43 PM

Mmh, you are using a script like the following and named your triggers and actions accordingly, also in the script? (Triggername = Actionname)

Code:

using System;
using System.Text;
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 ("YourTriggerName".Equals(shortName) && active) //Edit "YourTriggerName"
          {
                AiAction action = GamePlay.gpGetAction("YourActionName"); //same as "YourTriggerName"
                GamePlay.gpLogServer(null, " Your Trigger was triggered ", new object[] { }); //Testmessage
                if (action != null)
              {
                    action.Do();
              }
                GamePlay.gpGetTrigger(shortName).Enable = false;           
          }
  }
}

At least that works for me in multiplayer enviroment. Maybe you test you map in multiplayer hosting as server? Some triggers do not work on a dedicated server, but I understood that is not your question.

Ataros 10-04-2011 02:11 PM

If you do not use any script FMB triggers would work if name of a trigger and action are the same.

If you have any script working with your mission you have to add a trigger section to it to allow triggers to work. The most simple one is
Code:

public override void OnTrigger(int missionNumber, string shortName, bool active)
    {
        base.OnTrigger(missionNumber, shortName, active);       
        AiAction action = GamePlay.gpGetAction(ActorName.Full(missionNumber, shortName));
        if (action != null)
            action.Do();
    }

Your FMB trigger and action must have the same name if you use this script.

Check if both action and trigger are defined correctly (trigger type, airgroup, etc.) and saved in FMB.

SNAFU 10-04-2011 02:19 PM

I don´t know if it was fixed in the Beta, but the action (spawn airgroup) of triggers was broken, some patches ago. So you have to use a script to link triggers and actions. I supposed you set the trigger and the action in the FMB. :cool:

salmo 10-04-2011 03:27 PM

Quote:

Originally Posted by SNAFU (Post 343845)
I don´t know if it was fixed in the Beta, but the action (spawn airgroup) of triggers was broken, some patches ago. So you have to use a script to link triggers and actions. I supposed you set the trigger and the action in the FMB. :cool:

That's what I've done. The info window reports that the group has spawned in my test, indicating that the script has executed, but alas no planes actually spawned :(

Here's the script I used, the trigger & the spawn airgroup (after 60s) actions are both named 'Dorniers'...

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

if ("Dorniers".Equals(shortName) && active)
{
AiAction action = GamePlay.gpGetAction("Dorniers"); //same as YourTriggerName
GamePlay.gpLogServer(null, " German bomber group spawned ", new object[] { }); //Testmessage
if (action != null)
{
action.Do();
}
GamePlay.gpGetTrigger(shortName).Enable = false;
}
}

Ataros 10-04-2011 03:38 PM

Quote:

Originally Posted by salmo (Post 343887)
after 60s

:confused: How is this possible?

Try without the delay.

FG28_Kodiak 10-04-2011 03:50 PM

1 Attachment(s)
Made a sample mission, the Doniers spawn after 10sec.


All times are GMT. The time now is 06:47 AM.

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