![]() |
|
#81
|
||||
|
||||
|
I am not sure it is possible to overload ABattle without creating your own add-in.
|
|
#82
|
|||
|
|||
|
Hm just try and error and see what happen, ABattle has mostly the same methods than AMission. The only examples i know are from the campaign directory and are only single missions.
I wish there where a documentation about scripting.
|
|
#83
|
|||
|
|||
|
Quote:
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)) || ((GamePlay.gpPlayer().Place() as AiAircraft) == (actor as AiAircraft))) {
PlaneIsEmpty = false;
break;
}
}
if (PlaneIsEmpty) {
(actor as AiAircraft).Destroy();
}
}
public override void OnPlaceLeave(Player player, AiActor actor, int placeIndex) {
base.OnPlaceLeave(player, actor, placeIndex);
Timeout(1, () => {
_DespawnEmptyPlane(actor);
});
}
}
|
|
#84
|
|||
|
|||
|
HI Squoag,
I tried your version in nthe post above and it despawned the plane if I changed from pilot to a gunners position. I tested this on my own 'server' and in single player. Obviously in MP this would not be desireable! |
|
#85
|
|||
|
|||
|
Hi Flashman,
Are you 100% sure that you used the second code block in my post and not the first? What you're seeing is very symptomatic of the first code block in my post. I put it there as a before/after for the original author but perhaps I should mark it more clearly... |
|
#86
|
|||
|
|||
|
Quote:
Will test on Australian Skies tomorrow EDIT: This works for me, thanks No457_Mako & No457_Squog, has helped with server stability. Ran 3 maps no worries, we were having issues with loading new maps before this Worked with Position swap ONLINE in the bf 110 as well. Matoni Last edited by SC/JG Matoni; 05-02-2011 at 03:03 PM. |
|
#87
|
|||
|
|||
|
Quote:
Im pretty sure I tried both but truth be told you have me wondering now.... I will try this again when I get the time and see if it works for me. Please note: i tried this on my own 'server' not on the Syndicate server. |
|
#88
|
|||
|
|||
|
Script to destroy actors in a mission (e.g. before loading new one to server).
This kills mission (or submission) own actors. To kill all actors 'living' on a server (e.g. loaded by other missions) remove the lines put in blue color. Code:
foreach (int army in GamePlay.gpArmies())
{
foreach (AiAirGroup group in GamePlay.gpAirGroups(army))
{
if (ActorName.MissionNumber(group.Name()).Equals(MissionNumber))
{
AiActor[] members = group.GetItems();
for (int i = members.Length - 1; i > -1; i--)
{
(members[i] as AiAircraft).Destroy();
}
}
}
foreach (AiGroundGroup group in GamePlay.gpGroundGroups(army))
{
if (ActorName.MissionNumber(group.Name()).Equals(MissionNumber))
{
AiActor[] members = group.GetItems();
for (int i = members.Length - 1; i > -1; i--)
{
(members[i] as AiGroundActor).Destroy();
}
}
}
}
May need some testing and fine-tuning. Last edited by Ataros; 05-03-2011 at 09:03 AM. |
|
#89
|
|||
|
|||
|
~S
I would appear Beta 4 breaks all of these kill actor scripts... well it does 4 me |
|
#90
|
|||
|
|||
|
Phew its not just our server then, I rolled back to Beta 1 and the scripts work again.
|
![]() |
|
|