Thread: Script needed
View Single Post
  #1  
Old 08-09-2013, 09:12 PM
Hood Hood is offline
Approved Member
 
Join Date: Jan 2008
Posts: 318
Default Script needed

Hi all

I need a script for a small DF mission I have made. I have 4 triggers. There are 4 trigger names which are the same for trigger and action.

1. Ju87s spawn after 600 seconds

2. Blenheims spawn after 900 seconds

3. A Bf108 spawns after 1200 seconds

4. If the Bf108 is 50%+ destroyed some 109s spawn in.

The best I can do is the following but it won't work in mission:


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

public class Mission : AMission
{

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

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

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

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

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

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

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

if ("Bf109s".Equals(shortName) && active)
{
AiAction action = GamePlay.gpGetAction("Bf109s"); //same as YourTriggerName
GamePlay.gpLogServer(null, " Eeek - huns in the sun! ", new object[] { }); //Testmessage
if (action != null)
{
action.Do();
}
GamePlay.gpGetTrigger(shortName).Enable = false;
}
}
}



Any suggested changes?

Hood
Reply With Quote