![]() |
|
|
|
#1
|
|||
|
|||
|
Quote:
I will have a look at using triggers and actions within the script itself as some are quite useful. I did have a mission where if one plane was shot down another would spawn... lots of potential with that one. There is a lot to learn, but equally there is a lot we can do that is really interesting. I will post up my next daft script and see what people think later on when im home. Cheers! |
|
#2
|
|||
|
|||
|
If you want to destroy aircraft loaded by submissions do not forget to include
Code:
//////////////////////////////////////////////////////////////////////////////////////////////////
//Listen to events of every (sub)mission
public override void Init(maddox.game.ABattle battle, int missionNumber)
{
base.Init(battle, missionNumber);
MissionNumberListener = -1; //Listen to events of every mission
}
//////////////////////////////////////////////////////////////////////////////////////////////////
|
|
#3
|
|||
|
|||
|
Quote:
|
|
#4
|
|||
|
|||
|
@ Flashman
Just copy and past anywhere you like. You can always check out my recent script in Online Missions go here thread. @all It seems like this script I use does not destroy ships loaded by a submission. Other ground units are destroyed as intended. What can be wrong? IIRC ships belong to AiGroundActor Code:
//Ground objects (except AA Guns) will die after 55 min when counted from their birth
public override void OnActorCreated(int missionNumber, string shortName, AiActor actor)
{
base.OnActorCreated(missionNumber, shortName, actor);
//Ground objects (except AA Guns) will die after 55 min when counted from their birth
if (actor is AiGroundActor)
if ((actor as AiGroundActor).Type() != maddox.game.world.AiGroundActorType.AAGun)
Timeout(3300, () =>
{
if (actor != null)
{ (actor as AiGroundActor).Destroy(); }
}
);
}
Last edited by Ataros; 05-20-2011 at 01:34 PM. |
|
#5
|
|||
|
|||
|
I think you got lucky guys....
(I can only think because I do not undestand the language you write in this thread... From the Hotfix: Quote:
|
|
#6
|
|||
|
|||
|
Quote:
This is what happens in 3-4 hours after starting a mission. https://lh4.googleusercontent.com/_S...5-21_00016.jpg |
|
#7
|
||||
|
||||
|
Somehow game does not see ships as AiGroundActor. Ask naryv about this.
|
|
#8
|
|||
|
|||
|
Looks like the script we are running on Repka and Syndicate is not 100% compatible with multicrew aircraft.
Quote:
Code:
////////////////////////////////////////////////////////////////////////////////////////////////////
// destroys aircraft abandoned by a player.
private bool isAiControlledPlane (AiAircraft aircraft)
{
if (aircraft == null)
{
return false;
}
Player [] players = GamePlay.gpRemotePlayers ();
foreach (Player p in players)
{
if (p != null && (p.Place () is AiAircraft) && (p.Place () as AiAircraft) == aircraft)
{
return false;
}
}
return true;
}
private void destroyPlane (AiAircraft aircraft) {
if (aircraft != null) {
aircraft.Destroy ();
}
}
private void explodeFuelTank (AiAircraft aircraft)
{
if (aircraft != null)
{
aircraft.hitNamed (part.NamedDamageTypes.FuelTank0Exploded);
}
}
private void destroyAiControlledPlane (AiAircraft aircraft) {
if (isAiControlledPlane (aircraft)) {
destroyPlane (aircraft);
}
}
private void damageAiControlledPlane (AiActor actor) {
if (actor == null || !(actor is AiAircraft)) {
return;
}
AiAircraft aircraft = (actor as AiAircraft);
if (!isAiControlledPlane (aircraft)) {
return;
}
if (aircraft == null) {
return;
}
aircraft.hitNamed (part.NamedDamageTypes.ControlsElevatorDisabled);
aircraft.hitNamed (part.NamedDamageTypes.ControlsAileronsDisabled);
aircraft.hitNamed (part.NamedDamageTypes.ControlsRudderDisabled);
aircraft.hitNamed (part.NamedDamageTypes.FuelPumpFailure);
int iNumOfEngines = (aircraft.Group() as AiAirGroup).aircraftEnginesNum();
for (int i = 0; i < iNumOfEngines; i++)
{
aircraft.hitNamed((part.NamedDamageTypes)Enum.Parse(typeof(part.NamedDamageTypes), "Eng" + i.ToString() + "TotalFailure"));
}
/***Timeout (240, () =>
{explodeFuelTank (aircraft);}
);
* ***/
Timeout (300, () =>
{destroyPlane (aircraft);}
);
}
//////////////////////////////////////////
public override void OnPlaceLeave (Player player, AiActor actor, int placeIndex)
{
base.OnPlaceLeave (player, actor, placeIndex);
Timeout (1, () =>
{damageAiControlledPlane (actor);}
);
}
public override void OnAircraftCrashLanded (int missionNumber, string shortName, AiAircraft aircraft)
{
base.OnAircraftCrashLanded (missionNumber, shortName, aircraft);
Timeout (300, () =>
{ destroyPlane(aircraft); }
);
}
public override void OnAircraftLanded (int missionNumber, string shortName, AiAircraft aircraft)
{
base.OnAircraftLanded(missionNumber, shortName, aircraft);
Timeout(300, () =>
{ destroyPlane(aircraft); }
);
}
//////////////////////////////////////////////////////////////////////////////////////////////////
Last edited by Ataros; 05-25-2011 at 11:46 AM. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|