PDA

View Full Version : Scripting and Mission issue.


king1hw
08-05-2017, 12:03 PM
Mission and script trying to use Trigger to launch intercept missions.
using System;
using System.Collections.Generic;
using maddox.game;
using maddox.game.world;
using maddox.GP;
using part;


public class Mission : AMission
{

public override void OnTrigger(int missionNumber, string shortName, bool active)
{
base.OnTrigger(missionNumber, shortName, active);
if ("Shoreham".Equals(shortName))
{
GamePlay.gpPostMissionLoad("missions\Multi\Co-Op\The_Battle_of_Britain\Intercept_Missions\Redhil l.mis");
GamePlay.gpGetTrigger(shortName).Enable = true;
// prints message on screen after mission load
GamePlay.gpHUDLogCenter("Enemy Approaching Shoreham!");
}

}
public override void OnTrigger(int missionNumber, string shortName, bool active)
{
base.OnTrigger(missionNumber, shortName, active);
if ("IsleWight".Equals(shortName))
{
GamePlay.gpPostMissionLoad("missions\Multi\Co-Op\The_Battle_of_Britain\Intercept_Missions\Ford.m is");
GamePlay.gpGetTrigger(shortName).Enable = true;
// prints message on screen after mission load
GamePlay.gpHUDLogCenter("Enemy Approaching West Isle of Wight!");
}

}
public override void OnTrigger(int missionNumber, string shortName, bool active)
{
base.OnTrigger(missionNumber, shortName, active);
if ("Willmington".Equals(shortName))
{
GamePlay.gpPostMissionLoad("missions\Multi\Co-Op\The_Battle_of_Britain\Intercept_Missions\Willmi ngton.mis");
GamePlay.gpGetTrigger(shortName).Enable = true;
// prints message on screen after mission load
GamePlay.gpHUDLogCenter("Enemy Approaching Eastbourne!");
}

}
public override void OnTrigger(int missionNumber, string shortName, bool active)
{
base.OnTrigger(missionNumber, shortName, active);
if ("Dover".Equals(shortName))
{
GamePlay.gpPostMissionLoad("missions\Multi\Co-Op\The_Battle_of_Britain\Intercept_Missions\Hawk.m is")m;
GamePlay.gpGetTrigger(shortName).Enable = true;
// prints message on screen after mission load
GamePlay.gpHUDLogCenter("Enemy Approaching Dover!");
}

}
public override void OnTrigger(int missionNumber, string shortName, bool active)
{
base.OnTrigger(missionNumber, shortName, active);
if ("Southend".Equals(shortName))
{
GamePlay.gpPostMissionLoad("missions\Multi\Co-Op\The_Battle_of_Britain\Intercept_Missions\Eastch urch.mis");
GamePlay.gpGetTrigger(shortName).Enable = true;
// prints message on screen after mission load
GamePlay.gpHUDLogCenter("Enemy Approaching Northern Channel!");
}

}
public override void OnTrigger(int missionNumber, string shortName, bool active)
{
base.OnTrigger(missionNumber, shortName, active);
if ("IsleWight2".Equals(shortName))
{
GamePlay.gpPostMissionLoad("missions\Multi\Co-Op\The_Battle_of_Britain\Intercept_Missions\Ford.m is");
GamePlay.gpGetTrigger(shortName).Enable = true;
// prints message on screen after mission load
GamePlay.gpHUDLogCenter("Enemy Approaching East Isle of Wight!");
}

}
}

[PARTS]
core.100
bob.100
[MAIN]
MAP Land$English_Channel_1940
BattleArea 8500 8500 350000 300000 10000
TIME 12
WeatherIndex 0
CloudsHeight 1000
BreezeActivity 0
ThermalActivity 0
[GlobalWind_0]
Power 0.000 0.000 0.000
BottomBound 0.00
TopBound 1500.00
GustPower 1
GustAngle 0
[splines]
[AirGroups]
BoB_LW_KG26_Stab.07
BoB_LW_KG27_Stab.07
BoB_LW_KG3_Stab.07
[BoB_LW_KG26_Stab.07]
Flight0 1 2 3
Flight1 11 12 13
Flight2 21 22 23
Class Aircraft.He-111H-2
Formation VIC3
CallSign 26
Fuel 100
Weapons 1 1 1 1 1 1 2
Skill0 0.7 0.7 0.7 0.7 0.7 0.7 0.7 0.7
Skill1 0.3 0.3 0.3 0.3 0.3 0.3 0.3 0.3
Skill2 0.3 0.3 0.3 0.3 0.3 0.3 0.3 0.3
Skill10 0.3 0.3 0.3 0.3 0.3 0.3 0.3 0.3
Skill11 0.3 0.3 0.3 0.3 0.3 0.3 0.3 0.3
Skill12 0.3 0.3 0.3 0.3 0.3 0.3 0.3 0.3
Skill20 0.3 0.3 0.3 0.3 0.3 0.3 0.3 0.3
Skill21 0.74 0.74 0.74 0.53 0.74 0.74 0.74 0.74
Skill22 0.74 0.74 0.74 0.37 0.74 0.74 0.74 0.74
[BoB_LW_KG26_Stab.07_Way]
NORMFLY 113121.71 10577.89 6325.00 270.00
NORMFLY 127245.90 197755.26 6325.00 270.00
GATTACK_POINT 155346.69 253373.57 6325.00 270.00
NORMFLY 184828.19 253621.92 6325.00 270.00
NORMFLY 197109.56 228502.37 6325.00 230.00
NORMFLY 203863.47 223844.72 6325.00 230.00
NORMFLY 207355.27 221542.14 6325.00 230.00
NORMFLY 210920.24 219345.27 6325.00 230.00
NORMFLY 214485.22 217124.01 6300.00 230.00
NORMFLY 218050.19 214919.02 6300.00 230.00
NORMFLY 221615.17 212714.02 6300.00 230.00
NORMFLY 225180.14 210509.02 6300.00 230.00
NORMFLY 228745.12 208304.02 5300.00 230.00
NORMFLY 233836.86 205150.00 3700.00 230.00
NORMFLY 238928.59 201995.98 3100.00 230.00
NORMFLY 244020.33 198855.76 2400.00 230.00
NORMFLY 249112.07 195687.94 1800.00 230.00
NORMFLY 254203.81 192533.92 1800.00 230.00
NORMFLY 259295.55 189379.90 1100.00 230.00
LANDING 264387.29 186225.88 500.00 200.00
[BoB_LW_KG27_Stab.07]
Flight0 1 2 3
Flight1 11 12
Flight2 21 22 23
Class Aircraft.He-111H-2
Formation VIC3
CallSign 26
Fuel 100
Weapons 1 1 1 1 1 1 1
Skill0 0.74 0.74 0.74 0.53 0.74 0.74 0.74 0.74
Skill1 0.74 0.74 0.74 0.37 0.74 0.74 0.74 0.74
Skill2 0.74 0.74 0.74 0.47 0.74 0.74 0.74 0.74
Skill10 0.74 0.74 0.74 0.58 0.74 0.74 0.74 0.74
Skill11 0.74 0.74 0.74 0.47 0.74 0.74 0.74 0.74
Skill20 0.74 0.74 0.74 0.58 0.74 0.74 0.74 0.74
Skill21 0.74 0.74 0.74 0.53 0.74 0.74 0.74 0.74
Skill22 0.74 0.74 0.74 0.53 0.74 0.74 0.74 0.74
[BoB_LW_KG27_Stab.07_Way]
FOLLOW 111413.03 10597.59 6350.00 265.00
FOLLOW 126242.91 197958.72 6350.00 265.00 BoB_LW_KG26_Stab.07 0
GATTACK_POINT 155182.48 253523.10 6350.00 265.00
NORMFLY 184886.24 253790.02 6350.00 265.00
NORMFLY 197342.46 228578.04 6350.00 230.00
NORMFLY 203965.23 223979.37 6350.00 230.00
NORMFLY 207397.42 221750.88 6350.00 230.00
NORMFLY 211047.51 219474.39 6350.00 230.00
NORMFLY 214608.74 217287.38 6300.00 230.00
NORMFLY 218144.64 215079.08 6300.00 230.00
NORMFLY 221722.44 212875.47 6300.00 230.00
NORMFLY 228922.13 208473.37 6300.00 230.00
NORMFLY 234012.72 205288.87 5300.00 230.00
NORMFLY 239071.43 202173.95 3700.00 230.00
NORMFLY 244170.80 199024.02 3100.00 230.00
NORMFLY 249270.18 195846.50 2400.00 230.00
NORMFLY 254345.15 192737.24 1800.00 230.00
NORMFLY 259444.52 189540.98 1100.00 230.00
LANDING 278060.01 182149.38 500.00 200.00
[BoB_LW_KG3_Stab.07]
Flight0 1 2 3
Flight1 11 12 13
Flight2 21 22 23
Class Aircraft.He-111H-2
Formation VIC3
CallSign 30
Fuel 100
Weapons 1 1 1 1 1 1 1
Skill0 0.74 0.74 0.74 0.58 0.74 0.74 0.74 0.74
Skill1 0.74 0.74 0.74 0.63 0.74 0.74 0.74 0.74
Skill2 0.74 0.74 0.74 0.53 0.74 0.74 0.74 0.74
Skill10 0.74 0.74 0.74 0.58 0.74 0.74 0.74 0.74
Skill11 0.74 0.74 0.74 0.47 0.74 0.74 0.74 0.74
Skill12 0.74 0.74 0.74 0.42 0.74 0.74 0.74 0.74
Skill20 0.74 0.74 0.74 0.47 0.74 0.74 0.74 0.74
Skill21 0.74 0.74 0.74 0.42 0.74 0.74 0.74 0.74
Skill22 0.74 0.74 0.74 0.53 0.74 0.74 0.74 0.74
[BoB_LW_KG3_Stab.07_Way]
FOLLOW 109732.28 10689.94 6350.00 265.00 BoB_LW_KG27_Stab.07 0
FOLLOW 125318.05 197985.30 6350.00 265.00 BoB_LW_KG27_Stab.07 0
GATTACK_POINT 155203.83 253958.21 6350.00 265.00
NORMFLY 184965.53 253929.07 6350.00 265.00
NORMFLY 197575.02 228717.74 6350.00 230.00
NORMFLY 204126.47 224098.24 6350.00 230.00
NORMFLY 207466.16 221895.13 6350.00 230.00
NORMFLY 211220.83 219633.26 6350.00 230.00
NORMFLY 214771.31 217477.03 6350.00 230.00
NORMFLY 218256.94 215264.06 6350.00 230.00
NORMFLY 221808.98 213042.32 6350.00 230.00
NORMFLY 225440.33 210860.18 6350.00 230.00
NORMFLY 228972.26 208719.87 6350.00 230.00
NORMFLY 234173.54 205513.67 6350.00 230.00
NORMFLY 239168.60 202334.10 5350.00 230.00
NORMFLY 244317.72 199196.87 3350.00 230.00
NORMFLY 249393.86 196026.31 2350.00 230.00
NORMFLY 254502.44 192904.40 1350.00 230.00
NORMFLY 259578.59 189766.27 1150.00 230.00
LANDING 284869.57 193417.24 500.00 200.00
[CustomChiefs]
[Stationary]
[Buildings]
[BuildingsLinks]
[Trigger]
Southend TPassThrough 5 2 266687 287232 30000
Dover TPassThrough 5 2 261887 229632 30000
Willmington TPassThrough 5 2 207743 168190 30000
IsleWight2 TPassThrough 5 2 88320 146476 30000
IsleWight TPassThrough 5 2 37440 146092 30000
Shoreham TPassThrough 5 2 148416 158764 30000o

king1hw
08-05-2017, 12:46 PM
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 (shortName.Equals("Shoreham"))
{
GamePlay.gpPostMissionLoad("missions\Multi\Co-Op\The_Battle_of_Britain\Intercept_Missions\Redhil l.mis");
GamePlay.gpGetTrigger(shortName).Enable = true;
// prints message on screen after mission load
GamePlay.gpHUDLogCenter(RedSide(), ("Enemy Approaching Shoreham!");
}

}
public override void OnTrigger(int missionNumber, string shortName, bool active)
{
base.OnTrigger(missionNumber, shortName, active);
if (shortName.Equals("IsleWight"))
{
GamePlay.gpPostMissionLoad("missions\Multi\Co-Op\The_Battle_of_Britain\Intercept_Missions\Ford.m is");
GamePlay.gpGetTrigger(shortName).Enable = true;
// prints message on screen after mission load
GamePlay.gpHUDLogCenter(RedSide(), ("Enemy Approaching West Isle of Wight!");
}

}
public override void OnTrigger(int missionNumber, string shortName, bool active)
{
base.OnTrigger(missionNumber, shortName, active);
if (shortName.Equals("Willmington"))
{
GamePlay.gpPostMissionLoad("missions\Multi\Co-Op\The_Battle_of_Britain\Intercept_Missions\Willmi ngton.mis");
GamePlay.gpGetTrigger(shortName).Enable = true;
// prints message on screen after mission load
GamePlay.gpHUDLogCenter(RedSide(), ("Enemy Approaching Eastbourne!");
}

}
public override void OnTrigger(int missionNumber, string shortName, bool active)
{
base.OnTrigger(missionNumber, shortName, active);
if (shortName.Equals("Dover"))
{
GamePlay.gpPostMissionLoad("missions\Multi\Co-Op\The_Battle_of_Britain\Intercept_Missions\Hawk.m is")m;
GamePlay.gpGetTrigger(shortName).Enable = true;
// prints message on screen after mission load
GamePlay.gpHUDLogCenter(RedSide(), ("Enemy Approaching Dover!");
}

}
public override void OnTrigger(int missionNumber, string shortName, bool active)
{
base.OnTrigger(missionNumber, shortName, active);
if (shortName.Equals("Southend"))
{
GamePlay.gpPostMissionLoad("missions\Multi\Co-Op\The_Battle_of_Britain\Intercept_Missions\Eastch urch.mis");
GamePlay.gpGetTrigger(shortName).Enable = true;
// prints message on screen after mission load
GamePlay.gpHUDLogCenter(RedSide(), ("Enemy Approaching Northern Channel!");
}

}
public override void OnTrigger(int missionNumber, string shortName, bool active)
{
base.OnTrigger(missionNumber, shortName, active);
if (shortName.Equals("IsleWight2"))
{
GamePlay.gpPostMissionLoad("missions\Multi\Co-Op\The_Battle_of_Britain\Intercept_Missions\Ford.m is");
GamePlay.gpGetTrigger(shortName).Enable = true;
// prints message on screen after mission load
GamePlay.gpHUDLogCenter(RedSide(), "Enemy Approaching East Isle of Wight!");
}

}

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("Dover"))
{
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;


}
}
}