![]() |
|
|
|
#1
|
|||
|
|||
|
Yes, we need someone to make this script to allow just copy-and-paste for those who does not know C# or any other language at all but makes missions in FMB like myself. Please...
This is an example of my mission that runs on Repka server atm. http://forum.1cpublishing.eu/showpos...8&postcount=24 I have no idea what I should put in the .cs file to make "Destroy() method of AiAircraft inside OnTaskCompleted(). " work. Another thing is that aircraft should fall to ground before it is destroyed with some timeout ideally as described here http://forum.1cpublishing.eu/showpos...1&postcount=33. Last edited by Ataros; 04-27-2011 at 10:15 AM. |
|
#2
|
|||
|
|||
|
So have modified ZaltysZ script, with some damage
Code:
using System;
using maddox.game;
using maddox.game.world;
using System.Collections.Generic;
public class Mission : AMission
{
public void _DespawnEmptyPlane(AiActor actor)
{
if (actor == null)
{ return;}
Player[] Players = GamePlay.gpRemotePlayers();
bool PlaneIsEmpty = true;
foreach (Player i in Players)
{
if ((i.Place() as AiAircraft) == (actor as AiAircraft))
{
PlaneIsEmpty = false;
break;
}
}
if (PlaneIsEmpty)
{
(actor as AiAircraft).hitNamed(part.NamedDamageTypes.ControlsElevatorDisabled);
(actor as AiAircraft).hitNamed(part.NamedDamageTypes.ControlsAileronsDisabled);
(actor as AiAircraft).hitNamed(part.NamedDamageTypes.ControlsRudderDisabled);
(actor as AiAircraft).hitNamed(part.NamedDamageTypes.Eng0TotalFailure);
//for 2mots
(actor as AiAircraft).hitNamed(part.NamedDamageTypes.Eng1TotalFailure);
//wait 10min
Timeout(600.0, () => {
(actor as AiAircraft).Destroy();
});
}
}
public override void OnPlaceLeave(Player player, AiActor actor, int placeIndex)
{
base.OnPlaceLeave(player, actor, placeIndex);
_DespawnEmptyPlane(actor);
}
}
|
|
#3
|
|||
|
|||
|
FG28_Kodiak, thank you so much! i will try it tonight.
|
|
#4
|
||||
|
||||
|
Guys, don't bother with engines, kill fuel pump instead (all engines should stop).
By the way, what will happen if player presses "Create" multiple time? There will probably be lots of planes on ground without working controls and engines. There is handy method IsAirborne(). If it returns false, plane should be destroyed immediately; if it returns true, only then disabling of controls should commence. Last edited by ZaltysZ; 04-27-2011 at 03:09 PM. |
|
#5
|
|||
|
|||
|
Disable fuel pump doesn't help, the engines wouldn't stop. Fuel pump is only nessesary at altitudes above 2500m.
You are right IsAirborne() can be very usefull in this script. Corrected Version Code:
using System;
using maddox.game;
using maddox.game.world;
using System.Collections.Generic;
public class Mission : AMission
{
public void _DespawnEmptyPlane(AiActor actor)
{
if (actor == null)
{ return;}
Player[] Players = GamePlay.gpRemotePlayers();
bool PlaneIsEmpty = true;
foreach (Player i in Players)
{
if ((i.Place() as AiAircraft) == (actor as AiAircraft))
{
PlaneIsEmpty = false;
break;
}
}
if ((PlaneIsEmpty) && (actor as AiAircraft).IsAirborne())
{
(actor as AiAircraft).hitNamed(part.NamedDamageTypes.ControlsElevatorDisabled);
(actor as AiAircraft).hitNamed(part.NamedDamageTypes.ControlsAileronsDisabled);
(actor as AiAircraft).hitNamed(part.NamedDamageTypes.ControlsRudderDisabled);
(actor as AiAircraft).hitNamed(part.NamedDamageTypes.Eng0TotalFailure);
//for 2mots
(actor as AiAircraft).hitNamed(part.NamedDamageTypes.Eng1TotalFailure);
//then wait 10min
Timeout(600.0, () => {
(actor as AiAircraft).Destroy();
});
}
else if (PlaneIsEmpty)
{
(actor as AiAircraft).Destroy();
}
}
public override void OnPlaceLeave(Player player, AiActor actor, int placeIndex)
{
base.OnPlaceLeave(player, actor, placeIndex);
_DespawnEmptyPlane(actor);
}
}
Last edited by FG28_Kodiak; 04-27-2011 at 03:37 PM. |
|
#6
|
|||
|
|||
|
Thanks again!
Copied to my mission script. Is it OK? Code:
using System;
using maddox.game;
using maddox.game.world;
using System.Collections.Generic;
public class Mission : AMission
{
public override void OnTickGame()
{
if (Time.tickCounter() % 90000 == 18000) // 50-10 60-10 108000 == 18000
{
GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/128BoF/128BoFsmGroundv1_0.mis");
GamePlay.gpHUDLogCenter("Protect friendly shipping in the channel near France!");
}
if (Time.tickCounter() % 72000 == 72000) // 40-40 45-35 81000 == 63000
{
GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/128BoF/128BoFsmBombersv1_0.mis");
GamePlay.gpHUDLogCenter("Intel: Enemy bombers are heading to blue airfields!");
}
if (Time.tickCounter() % 72000 == 45000) // 40-25 45-45 81000 == 81000
{
GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/128BoF/128BoFsmBombersv1_0a.mis");
GamePlay.gpHUDLogCenter("Intel: Enemy bombers are heading to red airfields in France!");
}
}
public void _DespawnEmptyPlane(AiActor actor)
{
if (actor == null)
{ return; }
Player[] Players = GamePlay.gpRemotePlayers();
bool PlaneIsEmpty = true;
foreach (Player i in Players)
{
if ((i.Place() as AiAircraft) == (actor as AiAircraft))
{
PlaneIsEmpty = false;
break;
}
}
if ((PlaneIsEmpty) && (actor as AiAircraft).IsAirborne())
{
(actor as AiAircraft).hitNamed(part.NamedDamageTypes.ControlsElevatorDisabled);
(actor as AiAircraft).hitNamed(part.NamedDamageTypes.ControlsAileronsDisabled);
(actor as AiAircraft).hitNamed(part.NamedDamageTypes.ControlsRudderDisabled);
(actor as AiAircraft).hitNamed(part.NamedDamageTypes.Eng0TotalFailure);
//for 2mots
(actor as AiAircraft).hitNamed(part.NamedDamageTypes.Eng1TotalFailure);
//then wait 10min
Timeout(600.0, () =>
{
(actor as AiAircraft).Destroy();
});
}
else if (PlaneIsEmpty)
{
(actor as AiAircraft).Destroy();
}
}
public override void OnPlaceLeave(Player player, AiActor actor, int placeIndex)
{
base.OnPlaceLeave(player, actor, placeIndex);
_DespawnEmptyPlane(actor);
}
}
|
|
#7
|
|||
|
|||
|
Quote:
I have noticed that the time counter isnt 100% accurate - the planes appears a couple of minutes soon than what they should... bug? Ross |
|
#8
|
|||
|
|||
|
Destroys crashlanded aircraft in 5 seconds ))
Code:
public override void OnAircraftCrashLanded(int missionNumber, string shortName, AiAircraft aircraft)
{
base.OnAircraftCrashLanded(missionNumber, shortName, aircraft);
Timeout(5, () =>
{
aircraft.Destroy();
});
}
Just notes for myself on timing. Not processed by program. if (Time.tickCounter() % 72000 == 72000) is wrong probably. Last edited by Ataros; 04-27-2011 at 04:34 PM. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|