![]() |
#41
|
|||
|
|||
![]()
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 02:37 PM. |
#42
|
|||
|
|||
![]()
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); } } |
#43
|
|||
|
|||
![]() 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 |
#44
|
|||
|
|||
![]()
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 03:34 PM. |
#45
|
|||
|
|||
![]()
someone help me here :S
Main map starts at 05:00 - like the rest of the "sub" maps 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() % 54000 == 18000) { GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/Ross/OnlineBOBb1.mis"); GamePlay.gpHUDLogCenter("Intel: 4x He115's, Heading for Convoy!"); } if (Time.tickCounter() % 99000 == 36000) { GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/Ross/OnlineBOBb2.mis"); GamePlay.gpHUDLogCenter("Intel: 8x He111's, Heading for Lympne!"); } if (Time.tickCounter() % 108000 == 27000) { GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/Ross/OnlineBOBr1.mis"); GamePlay.gpHUDLogCenter("Intel: 12xBlenheim, Heading for Calais Marck!"); } } public override void OnPlaceLeave(Player player, AiActor actor, int placeIndex) { base.OnPlaceLeave(player, actor, placeIndex); Timeout(1, () => { AiAircraft CurAircraft = player.Place() as AiAircraft; AiAircraft PrevAircraft = actor as AiAircraft; if (CurAircraft != PrevAircraft) { (actor as AiAircraft).Destroy(); } }); } } He 115 starts at 05:09 - 1 min fast Blenheim starts at 05:13 - 7 min fast!! He 111 starts at 05:18 - 3 min late?! Whats going on :S :S :S |
#46
|
||||
|
||||
![]()
This will always result in FALSE. % gives you a remainder of division (Остаток от деления), so this operation will always give result greater or equal to 0 and less than divisor (assuming positive numbers).
Code:
if (Time.tickCounter() % 72000 == 0) Last edited by ZaltysZ; 04-27-2011 at 04:21 PM. |
#47
|
|||
|
|||
![]()
Check attachment...
Is the last comment for me or :S Last edited by mcler002; 04-27-2011 at 04:40 PM. Reason: Noticed a mistake from human error :D |
#48
|
|||
|
|||
![]() Quote:
Code:
if (Time.tickCounter() % 72000 == 71999) |
#49
|
|||
|
|||
![]()
The % is the modulus operator in C# (C, C++ and others)
http://en.wikipedia.org/wiki/Modulo_operation Last edited by FG28_Kodiak; 04-27-2011 at 05:16 PM. |
#50
|
||||
|
||||
![]() Quote:
Code:
if (Time.tickCounter() % A == B) A = 30 * amount second of seconds you want to repeat something B = 30 * amount second you want to offset (delay) from beginning of mission I suppose you want to delay something by 72000 and not by 71999 (although the difference is only 1/30s). So: Code:
if (Time.tickCounter() % 72000 == 0 && Time.tickCounter()-72000==0) |
![]() |
|
|