![]() |
|
|
|
#1
|
|||
|
|||
|
I wish I were a part of the dev team and know all the answers
Meanwhile another script destroying abandoned planes from ru forums. Tell me what you think of it. Code:
using System;
using maddox.game;
using maddox.game.world;
using System.Collections.Generic;
public class Mission : AMission
{
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);
/***
aircraft.hitNamed (part.NamedDamageTypes.FuelTank1Exploded);
aircraft.hitNamed (part.NamedDamageTypes.FuelTank2Exploded);
aircraft.hitNamed (part.NamedDamageTypes.FuelTank3Exploded);
aircraft.hitNamed (part.NamedDamageTypes.FuelTank4Exploded);
aircraft.hitNamed (part.NamedDamageTypes.FuelTank5Exploded);
aircraft.hitNamed (part.NamedDamageTypes.FuelTank6Exploded);
aircraft.hitNamed (part.NamedDamageTypes.FuelTank7Exploded);
***/
}
}
private void fuelTankFire (AiAircraft aircraft)
{
if (aircraft != null)
{
aircraft.hitNamed (part.NamedDamageTypes.FuelTank0Fire);
/***
aircraft.hitNamed (part.NamedDamageTypes.FuelTank1Fire);
aircraft.hitNamed (part.NamedDamageTypes.FuelTank2Fire);
aircraft.hitNamed (part.NamedDamageTypes.FuelTank3Fire);
aircraft.hitNamed (part.NamedDamageTypes.FuelTank4Fire);
aircraft.hitNamed (part.NamedDamageTypes.FuelTank5Fire);
aircraft.hitNamed (part.NamedDamageTypes.FuelTank6Fire);
aircraft.hitNamed (part.NamedDamageTypes.FuelTank7Fire);
***/
}
}
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);
/*** Tank fire doesn't work after engine total failure - ???
Timeout (15, () =>
{fuelTankFire (aircraft);}
);
***/
/*** Cool, but kills fps
Timeout (25, () =>
{explodeFuelTank (aircraft);}
);
***/
Timeout (90, () =>
{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 (30, () =>
{destroyAiControlledPlane (aircraft);}
);
}
/**
public override void OnAircraftTookOff (int missionNumber, string shortName, AiAircraft aircraft) {
base.OnAircraftTookOff (missionNumber, shortName, aircraft);
...
}
**/
}
Quote:
Quote:
Quote a Dev: Quote:
My guess is you can switch server off, but you can not unload a mission as you can not unload life as it gives birth to smth Last edited by Ataros; 04-28-2011 at 10:49 PM. |
|
#2
|
|||
|
|||
|
Problem with exploding fuel tanks could be that other players also get damaged.
|
|
#3
|
|||
|
|||
|
Hi Guys, im having some fun with this scripting business and have finally got a script that works, however I could do with some help with the timing commands:
I know that 1800 ticks = 1 minute but im not entirely sure what these two number cause to happen. From my script file: if (Time.tickCounter() % 126000 == 18000) When this counts down a mission is launched but im unsure as to the significane of the two timings: does the 126000 give the time between each repeat operation of the operation? I have found the second number, 18000 in this case appears to set the time for the first operation. Is this correct? SO, if i want the operation (in this case a mission starts within themain mission and planes spawn) to repeat every 2 hours, but the first operation is 10 minutes after the main mission begins would this be correct? if (Time.tickCounter() % 216000 == 18000) Thanks! |
|
#4
|
|||
|
|||
|
1st number = repeat i.e if it was 108000 - the map/ mission should load every 1hour...
2nd number = start time i.e. if it was 18000 = the map/mission should start within 10 minutes of the game start, or repeat interval... But i dont think it works 100%... but as i have been told 1800 ticks "roughly" equals a minute... |
|
#5
|
|||
|
|||
|
Quote:
I actually did some offline testing and set the timings to minutes adn sped things up! It appears to work roughly as you say... it will do for now! |
|
#6
|
|||
|
|||
|
Yea i did offline testin as well... but x16 is just not fast enough lol! only went a couple of hours in...
|
|
#7
|
|||
|
|||
|
Ive tested and tested... its not working :S
Help ! |
![]() |
| Thread Tools | |
| Display Modes | |
|
|