![]() |
|
|
|
#1
|
|||
|
|||
|
Hi Ataros,
Hopefully I will be a little more clear this time! I used the in-game script system using a Trigger to cause an Action to happen. Eg in my missions if a plane I select is shot down, it triggers the spawn of another plane. EDIT>Script Trigger: Walrus 1= Target Group destroyed (Walrus flying boat selected) Action: Walrus 1= Air spawn group (second walrus selected) This system works in single player, so that when the first walrus is shot down a second spawns at a preselected place. However, when I include the scripts you guys have been developing to despawn empty aircraft (for use online) the ingame script above does not work in either single or multiplayer. Any ideas what i am doing wrong? |
|
#2
|
|||
|
|||
|
I was just looking at the .mis files in notepad...
Example Code:
[PARTS] core.100 bob.100 [MAIN] MAP Land$English_Channel_1940 BattleArea 200000 160000 120000 100000 9000 TIME 5 WeatherIndex 0 CloudsHeight 1000 BreezeActivity 1 ThermalActivity 1 [GlobalWind_0] Power 3.000 0.000 0.000 BottomBound 0.00 TopBound 1500.00 GustPower 5 GustAngle 45 [splines] [AirGroups] gb02.0F [gb02.0F] Flight0 1 2 3 Flight1 11 12 13 Flight2 21 22 23 Flight3 31 32 33 Class Aircraft.BlenheimMkIV Formation VIC CallSign 31 Fuel 86 Weapons 1 1 2 1 1 Detonator Bomb.Bomb_GP_250lb_MkIV 2 130 11 Skill 0.3 0.3 0.3 0.3 0.3 0.3 0.3 0.3 [gb02.0F_Way] NORMFLY 224480.60 255230.91 500.00 230.00 NORMFLY 254029.14 255139.99 1000.00 230.00 NORMFLY 274678.41 250003.49 1500.00 230.00 NORMFLY 290803.61 240345.28 1500.00 230.00 GATTACK_POINT 290788.83 215917.45 1500.00 230.00 NORMFLY 290883.76 208132.47 1500.00 230.00 NORMFLY 265387.72 208373.88 1500.00 230.00 NORMFLY 246038.12 228039.38 1500.00 230.00 NORMFLY 224003.28 252601.51 1500.00 230.00 [CustomChiefs] [Stationary] [Buildings] [BuildingsLinks] [Trigger] trigger TTime 1200 Also looks like we can edit aircraft here much "easier"... if you know what your doing! NOTE - not at home to test it myself lol Ross |
|
#3
|
|||
|
|||
|
Quote:
I think you can shut server down with .cmd file. |
|
#4
|
|||
|
|||
|
Well as you know we both start a mission through the script, but i want to know if we can stop it... as we had already discused :S
But as we dont know how to do this via scipt, i was woundering is we could do it through the .mis file... |
|
#5
|
|||
|
|||
|
Yeah, I would like to know this as well. The way the MP missions are designed are amazing (with missions able to be loaded into missions etc.) but, for instance, lets say you want an ongoing war, how are you going to stop it from going into the night?
Or could you just load a mission and make the sun appear again out of nowhere, without missing a beat, while others are playing at the same time? More testing I guess |
|
#6
|
|||
|
|||
|
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. |
|
#7
|
|||
|
|||
|
Problem with exploding fuel tanks could be that other players also get damaged.
|
|
#8
|
|||
|
|||
|
I did not learn how to use triggers yet but if you paste here a complete script I am sure someone would help.
|
|
#9
|
|||
|
|||
|
Quote:
However we should try: 1) make a mission with internal triggers without script 2) make a mission with script that loads the first mission in. 3) load more missions when needed. I will not have time to try this for a couple of days however (( Alternatively you can program all the triggers in a script by hand. Check links in the 1st message of this thread for examples. e.g. Code:
/ / $ Reference Campaign.dll
/ / - $ Debug
using System;
using maddox.game;
using maddox.game.world;
public class Mission: maddox.game.campaign.Mission {
public override void OnTrigger (int missionNumber, string shortName, bool active)
{
if ("trigger". Equals (shortName) & & active)
{
GamePlay.gpHUDLogCenter ("Triggers trigger");
}
}
}
Code:
using System;
using maddox.game;
using maddox.game.world;
class Mission: maddox.game.AMission
{
public override void OnActorDead (int missionNumber, string shortName, AiActor actor, System.Collections.Generic.List <DamagerScore> damages)
{
base.OnActorDead (missionNumber, shortName, actor, damages);
AiAction action = GamePlay.gpGetAction ("TestAction");
if (action! = null)
{
action.Do ();
}
}
}
Code:
using System;
using maddox.game;
using maddox.game.world;
using System.Collections.Generic;
public class Mission : maddox.game.AMission
{
private List<AiAction> actions = new List<AiAction>();
private int round = 1;
private bool completed = false;
public override void OnBattleStarted()
{
AiAction action = GamePlay.gpGetAction("startGroup2");
if (action != null) actions.Add(action);
action = GamePlay.gpGetAction("startGroup3");
if (action != null) actions.Add(action);
GamePlay.gpHUDLogCenter(String.Format("Раунд {0}", round));
}
public override void OnActorDead(int missionNumber, string shortName, AiActor actor, System.Collections.Generic.List<DamagerScore> damages)
{
base.OnActorDead(missionNumber, shortName, actor, damages);
if (!(actor is AiAircraft))
return; // Не самолет
int army = (actor as AiAircraft).Group().Army();
if (army == 1)
{
if (!completed)
{
bool fail = (actor as AiAircraft).AirGroup().DiedAircrafts >= (actor as AiAircraft).AirGroup().InitNOfAirc;
if (fail)
{
GamePlay.gpHUDLogCenter("Миссия провалена.");
}
}
}
else
{
bool next = (actor as AiAircraft).AirGroup().DiedAircrafts >= (actor as AiAircraft).AirGroup().InitNOfAirc;
if (next)
{
if (round == 3)
{
completed = true;
GamePlay.gpHUDLogCenter("Поздравляем, миссия пройдена!");
}
else
{
round++;
startNewRound();
}
}
}
}
private void startNewRound()
{
GamePlay.gpHUDLogCenter(String.Format("Раунд {0}", round));
if (actions.Count > 0)
{
actions[0].Do();
actions.RemoveAt(0);
}
}
}
http://translate.google.com/translat...hp%3Ft%3D68369 Would you tell us what exactly you are trying to do and what does not work. Run my script it loads missions on timing more or less. Does not always destroy planes on the server however. Last edited by Ataros; 04-30-2011 at 02:23 AM. |
|
#10
|
|||
|
|||
|
I have pretty much copied and pasted your scripting ...
I always right click and compile to see if the script is OK, which it is ... So when ever I try and test it ... My ai bots are still flying At the current time I am in the middle of making a new online map with less 'repeat mission' loading, and more internal triggers But as you have posted above, I will need script for 'triggers' to flash messages on the screen about incoming planes etc ... I shall give the above a try when I'm on my pc later! |
![]() |
| Thread Tools | |
| Display Modes | |
|
|