![]() |
|
#1
|
|||
|
|||
![]()
for example:
Code:
using System; using System.Collections; using System.Collections.Generic; using maddox.game; using maddox.game.world; public class Mission : AMission { List<AiAircraft> enemyAircraftsInGame = new List<AiAircraft>(); const int EnemyArmy = 1; // reds are enemy change to 2 for blues const int MinNumberEnemyPlanesAlive = 1; // number of enemy planes left before creating new airgroup private Queue<string> ActionQueue = new Queue<string>(new string[] { "createAnsons", "createSpits1", "createBlenheims", "createSpits2", "createMosquitos", "createSpits3"}); public override void OnBattleStarted() { base.OnBattleStarted(); MissionNumberListener = -1; } public override void OnActorCreated(int missionNumber, string shortName, AiActor actor) { base.OnActorCreated(missionNumber, shortName, actor); if (actor is AiAircraft && actor.Army() == EnemyArmy) enemyAircraftsInGame.Add(actor as AiAircraft); } public override void OnAircraftKilled(int missionNumber, string shortName, AiAircraft aircraft) { base.OnAircraftKilled(missionNumber, shortName, aircraft); enemyAircraftsInGame.RemoveAll(item => item == aircraft); if (enemyAircraftsInGame.Count <= MinNumberEnemyPlanesAlive) { string actionName = ActionQueue.Dequeue(); ActionQueue.Enqueue(actionName); AiAction action = GamePlay.gpGetAction(actionName); if (action != null) action.Do(); actionName = ActionQueue.Dequeue(); ActionQueue.Enqueue(actionName); action = GamePlay.gpGetAction(actionName); if (action != null) action.Do(); } } public override void OnActorDead(int missionNumber, string shortName, AiActor actor, List<DamagerScore> damages) { base.OnActorDead(missionNumber, shortName, actor, damages); if (actor is AiAircraft) { enemyAircraftsInGame.RemoveAll(item => item == actor as AiAircraft); if (enemyAircraftsInGame.Count <= MinNumberEnemyPlanesAlive) { string actionName = ActionQueue.Dequeue(); ActionQueue.Enqueue(actionName); AiAction action = GamePlay.gpGetAction(actionName); if (action != null) action.Do(); actionName = ActionQueue.Dequeue(); ActionQueue.Enqueue(actionName); action = GamePlay.gpGetAction(actionName); if (action != null) action.Do(); } } } public override void OnPlaceLeave(Player player, AiActor actor, int placeIndex) { base.OnPlaceLeave(player, actor, placeIndex); if (IsActorDestroyable(actor)) if (actor is AiCart) (actor as AiCart).Destroy(); } private bool IsActorDestroyable(AiActor actor) { bool actorDestroyable = true; //Check if actor is empty (no Player) if (actor is AiAircraft) { if ((actor as AiAircraft).ExistCabin(0)) for (int i = 0; i < (actor as AiAircraft).Places(); i++) { if ((actor as AiAircraft).Player(i) != null) { actorDestroyable = false; break; } } } else if (actor is AiGroundActor) { if ((actor as AiGroundActor).ExistCabin(0)) for (int i = 0; i < (actor as AiGroundActor).Places(); i++) { if ((actor as AiGroundActor).Player(i) != null) { actorDestroyable = false; break; } } } return actorDestroyable; } } First is Bomber, second is fighter. then i modify the Code:
if (enemyAircraftsInGame.Count <= MinNumberEnemyPlanesAlive) { string actionName = ActionQueue.Dequeue(); ActionQueue.Enqueue(actionName); AiAction action = GamePlay.gpGetAction(actionName); if (action != null) action.Do(); actionName = ActionQueue.Dequeue(); ActionQueue.Enqueue(actionName); action = GamePlay.gpGetAction(actionName); if (action != null) action.Do(); } ![]() |
#2
|
|||
|
|||
![]()
thanks
|
#3
|
|||
|
|||
![]()
Hello,
I downloaded shootingrange.zip and extracted the files into the 1C SoftClub folder. I can see the spawn point on the map in FMB. The Actions and Script have loaded in Scipt. But when I run the mission I do not see the spawn point or am able to fly the blue plane I selected (e3b). Is there something else I need to do? thx |
#4
|
|||
|
|||
![]()
You must host in multiplayer as a server. Then start the battle, choose the blue side (click the german/italian flag), then you see the spawnplace, select it ...
Last edited by FG28_Kodiak; 08-27-2012 at 06:53 AM. |
![]() |
Thread Tools | |
Display Modes | |
|
|