![]() |
|
#1
|
|||
|
|||
![]()
And it reintroduces the stutters online which I kinda missed .....NOT!....lol. Rolled client back to 14305 will try on Matoni's OGN later.
![]() |
#2
|
|||
|
|||
![]() Quote:
Code:
// v.1.6.17 trig NEW using System; using maddox.game; using maddox.game.world; using System.Collections.Generic; public class Mission : AMission { // 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); aircraft.hitNamed (part.NamedDamageTypes.Eng0TotalFailure); aircraft.hitNamed (part.NamedDamageTypes.Eng1TotalFailure); /***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); } ); } } |
#3
|
|||
|
|||
![]()
Sample shows moving frontline and changing spawnpoints from red to blue and vice versa based on trigger (flyby above an airfield).
Can someone program a small 3 airfields battle based on it? Say a middle airfield becomes red or blue based on which tanks remain alive after taking the airfield. Then spawn new groups of tanks in say 20 minutes for a new round. Code:
using System; using System.Collections; using maddox.game; using maddox.game.world; public class Mission : AMission { internal class MissionMarker { internal double x; internal double y; internal int army; internal MissionMarker(double x, double y, int army) { this.x = x; this.y = y; this.army = army; } } private MissionMarker[] MissionMarkers = new MissionMarker[] { new MissionMarker(17100.80,14515.20,2), new MissionMarker(20428.80, 8934.40, 2), new MissionMarker(12492.80, 17203.20, 1), new MissionMarker(11801.60, 21555.20, 1) }; internal ISectionFile CreateNewFrontLineMission(int markerNum, int newArmy) { MissionMarkers[markerNum].army = newArmy; foreach (AiBirthPlace bp in GamePlay.gpBirthPlaces()) { if (bp != null) bp.destroy(); } ISectionFile f = GamePlay.gpCreateSectionFile(); string sect; string key; string value; sect = "FrontMarker"; for (int i = 0; i < MissionMarkers.Length; i++) { key = "FrontMarker" + i.ToString(); value = MissionMarkers[i].x.ToString(System.Globalization.CultureInfo.InvariantCulture.NumberFormat) + " " + MissionMarkers[i].y.ToString(System.Globalization.CultureInfo.InvariantCulture.NumberFormat) + " " + MissionMarkers[i].army.ToString(); f.add(sect, key, value); } sect = "BirthPlace"; for (int i = 0; i < MissionMarkers.Length; i++) { key = "BirthPlace_" + i.ToString(); value = " " + MissionMarkers[i].army.ToString() + " " + MissionMarkers[i].x.ToString(System.Globalization.CultureInfo.InvariantCulture.NumberFormat) + " " + MissionMarkers[i].y.ToString(System.Globalization.CultureInfo.InvariantCulture.NumberFormat) + " 0 10 1 0 . . ."; f.add(sect, key, value); } return f; } public override void OnTrigger(int missionNumber, string shortName, bool active) { base.OnTrigger(missionNumber, shortName, active); for (int i = 0; i < MissionMarkers.Length; i++) for (int j = 1; j < 3; j++) { string str = "changeArmy" + i.ToString() + "_" + (j).ToString(); if (str.Equals(shortName)) { string armyOwner; if (j == 1) { armyOwner = " Red army"; } else { armyOwner = " Blue army"; } GamePlay.gpHUDLogCenter("Airdrome: " + i.ToString() + " turn to " + armyOwner); GamePlay.gpPostMissionLoad(CreateNewFrontLineMission(i, j)); } } AiAction action = GamePlay.gpGetAction(ActorName.Full(missionNumber, shortName)); if (action != null) action.Do(); } } Last edited by Ataros; 05-06-2011 at 07:51 AM. |
#4
|
|||
|
|||
![]()
Okay. I think I've got a handle on how to create and manipulate "MissionMarkers" aka Front Markers in a script. I've attached a simple, commented example. Shoot down the bomber in front of you and the southwest airfield's front marker changes to blue.
Quote:
Do you have a link to a tutorial on how to create multiplayer missions? |
#5
|
||||
|
||||
![]() Quote:
I'm slowly getting to grips with this ![]() I have a script for generating sub-missions, messages etc., and want to start a later flight in the same mission to make a second later attack on a convoy in the same mission but I can't seem to set a later start time in FMB Object Viewer. There's no way to change it from the main mission start time of 12:00 (which seems a bit daft). Can I script a start time for a planned mission or perhaps a spawn, aircraft. waypoints etc? I tried to follow your moving front line and army changes but I can't see how to make it work for a new flight.
__________________
klem 56 Squadron RAF "Firebirds" http://firebirds.2ndtaf.org.uk/ ASUS Sabertooth X58 /i7 950 @ 4GHz / 6Gb DDR3 1600 CAS8 / EVGA GTX570 GPU 1.28Gb superclocked / Crucial 128Gb SSD SATA III 6Gb/s, 355Mb-215Mb Read-Write / 850W PSU Windows 7 64 bit Home Premium / Samsung 22" 226BW @ 1680 x 1050 / TrackIR4 with TrackIR5 software / Saitek X52 Pro & Rudders |
![]() |
|
|