![]() |
|
#1
|
|||
|
|||
![]()
Thanks, I try now to load that script via submission and currently running on our server.
If someone is able to test, please report back... ![]()
__________________
http://cornedebrouwer.nl/cf48e |
#2
|
|||
|
|||
![]()
So another Script, Player Plane Memory function.
![]() actual its a early 'alpha' it's shows the playername after shootdown, even if the enemy player leaved the plane via esc or bailed out. then a short message will shown playername1 shoot down by playername2. the message is only shown if a human shoot down a human, the others are in work. Knows anybody how to disable the gamemessages in chat or override them? I actually hoped we get this possibility with the beta patch, so we can change the game messages against our own messages, but i don't find anything. But i look deeper in it ![]() Code:
using System; using maddox.game; using maddox.game.world; using System.Collections.Generic; public class Mission : AMission { public class AirplanePlayerName { public AiAircraft PlayerAirplane{ get; set; } public string PilotName { get; set; } public bool Removable { get; set; } } public List<AirplanePlayerName> UsedAirplanes = new List<AirplanePlayerName>(); public override void OnPlaceEnter(Player player, AiActor actor, int placeIndex) { base.OnPlaceEnter(player, actor, placeIndex); // Player enter Aircraft as Pilot if (actor != null && (actor is AiAircraft) && placeIndex == 0) { foreach (AirplanePlayerName actplane in UsedAirplanes) { if (actplane.PlayerAirplane == (actor as AiAircraft)) // plane is already in list { actplane.PilotName = player.Name(); // change the pilot name return; } } AirplanePlayerName NewAircraft = new AirplanePlayerName(); NewAircraft.PilotName = player.Name(); NewAircraft.PlayerAirplane = (actor as AiAircraft); UsedAirplanes.Add(NewAircraft); } } 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) { foreach (DamagerScore ds in damages) { if (ds.initiator.Player != null && (actor as AiAircraft).InternalTypeName() != null) { foreach (AirplanePlayerName actPlane in UsedAirplanes) { if (actPlane.PlayerAirplane == (actor as AiAircraft) && !actPlane.Removable) { Timeout(1.0, () => { GamePlay.gpLogServer(null, "\n\n===> Player: {0} was shoot down by {1} <===\n\n", new object[] { actPlane.PilotName, ds.initiator.Player.Name() }); }); actPlane.Removable = true; } } } } } UsedAirplanes.RemoveAll(item => item.Removable == true); } public override void OnActorDestroyed(int missionNumber, string shortName, maddox.game.world.AiActor actor) { base.OnActorDestroyed(missionNumber, shortName, actor); if (actor is AiAircraft) { foreach (AirplanePlayerName actPlane in UsedAirplanes) { if (actPlane.PlayerAirplane == (actor as AiAircraft)) { actPlane.Removable = true; } } } UsedAirplanes.RemoveAll(item => item.Removable == true); } } Last edited by FG28_Kodiak; 09-10-2011 at 07:18 PM. |
#3
|
|||
|
|||
![]()
Allright, I just put these 2 scripst 1to1 into an empty submissions and load them into the main mission via mainscript.
Concerning your penalty script: Message and countdown works fine, only the fuelpump is still operable after penalty. I am now trying different damage types, will report back. I added the other damagetypes as you see below, but they all are ignored, I just can take off as usual. . . . if (ArrestTime.TotalSeconds < TotalArrestTime) { TimeSpan RestTime = pri.ArrestEndTime.Subtract(DateTime.Now); GamePlay.gpLogServer(null, "Player: {0} gets a time penalty for leaving Airplane in flight\n", new object[] { player.Name() }); (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.FuelPumpFailure); (actor as AiAircraft).hitNamed (part.NamedDamageTypes.FuelTank0Exploded); (actor as AiAircraft).hitNamed (part.NamedDamageTypes.Eng0TotalSeizure); } . . . PS: Tested the script also on an empty mission, without any other script with the same results... no penalty. ;(
__________________
http://cornedebrouwer.nl/cf48e Last edited by SNAFU; 09-11-2011 at 09:21 AM. |
#4
|
|||
|
|||
![]()
Are the player planes created in Submission or Mainmission?
|
#5
|
|||
|
|||
![]()
Player planes are spawned on airfields of mainmission. But also didn´t work when I load the script as sole script of the main-mission, as mainscript, if you know what I mean.
![]() MissionA.mis (spawn-airfield) MissionA.cs (penalty script)
__________________
http://cornedebrouwer.nl/cf48e |
#6
|
|||
|
|||
![]()
So i tested the script as a single and a multiplayer version (as host) without any problem. But i don't have a dedicated server so i can not test this case.
Think we should meet us in ts, so we can run a test on a dedi. Edit: Ok there is a problem with Dedicated Server, hitnamed seems to be ignored. Last edited by FG28_Kodiak; 09-11-2011 at 04:50 PM. |
#7
|
|||
|
|||
![]()
So script modified, hitnamed not working on dedicated so i use cutlimb
![]() On ground the Undercarriage is cut off and in Air the tail (@SNAFU: Works with Spitfires also, problem on spitfire was only one part should be cut off, all others are ignored). Code:
using System; using maddox.game; using maddox.game.world; using System.Collections.Generic; public class Mission : AMission { const int TotalArrestTime = 30; // Time in seconds public class prisonCell { public string PrisonerName { get; set; } public DateTime ArrestBeginTime { get; set; } public DateTime ArrestEndTime { get; set; } public bool Removable { get; set; } } public List<prisonCell> PrisonCamp = new List<prisonCell>(); public override void OnPlaceEnter(Player player, AiActor actor, int placeIndex) { base.OnPlaceEnter(player, actor, placeIndex); if (actor == null) // if player bailed out the actor is null so remove the player from prison if he is in { if (PrisonCamp.Count != 0) { foreach (prisonCell pri in PrisonCamp) { if (pri.PrisonerName.Equals(player.Name())) { pri.Removable = true; } } PrisonCamp.RemoveAll(item => item.Removable == true); } } if (PrisonCamp.Count != 0) { foreach (prisonCell pri in PrisonCamp) { if (pri.PrisonerName.Equals(player.Name())) { TimeSpan ArrestTime = DateTime.Now.Subtract(pri.ArrestBeginTime); if (ArrestTime.TotalSeconds < TotalArrestTime) { TimeSpan RestTime = pri.ArrestEndTime.Subtract(DateTime.Now); GamePlay.gpLogServer(null, "Player: {0} get a time penalty for leaving Airplane in flight\n", new object[] { player.Name() }); if (!(actor as AiAircraft).IsAirborne()) { (actor as AiAircraft).cutLimb(part.LimbNames.UC0); (actor as AiAircraft).cutLimb(part.LimbNames.UC1); (actor as AiAircraft).cutLimb(part.LimbNames.UC2); (actor as AiAircraft).cutLimb(part.LimbNames.UC3); (actor as AiAircraft).cutLimb(part.LimbNames.UC4); (actor as AiAircraft).cutLimb(part.LimbNames.UC5); } else { (actor as AiAircraft).cutLimb(part.LimbNames.Tail0); (actor as AiAircraft).cutLimb(part.LimbNames.Tail1); (actor as AiAircraft).cutLimb(part.LimbNames.Tail2); (actor as AiAircraft).cutLimb(part.LimbNames.Tail3); (actor as AiAircraft).cutLimb(part.LimbNames.Tail4); (actor as AiAircraft).cutLimb(part.LimbNames.Tail5); (actor as AiAircraft).cutLimb(part.LimbNames.Tail6); (actor as AiAircraft).cutLimb(part.LimbNames.Tail7); } } else { pri.Removable = true; } } } PrisonCamp.RemoveAll(item => item.Removable == true); } } public override void OnPlaceLeave(Player player, AiActor actor, int placeIndex) { base.OnPlaceLeave(player, actor, placeIndex); if ((actor as AiAircraft).IsAirborne()) { prisonCell NewPrisoner = new prisonCell(); NewPrisoner.PrisonerName = player.Name(); NewPrisoner.ArrestBeginTime = DateTime.Now; NewPrisoner.ArrestEndTime = DateTime.Now.AddSeconds(TotalArrestTime); PrisonCamp.Add(NewPrisoner); } } public override void OnTickGame() { base.OnTickGame(); if (Time.tickCounter() % 34 == 0) // 34 Ticks should be a second { if (PrisonCamp.Count != 0) { foreach (prisonCell pri in PrisonCamp) { foreach (Player aktplayer in GamePlay.gpRemotePlayers()) { if (pri.PrisonerName.Equals(aktplayer.Name())) { TimeSpan RestTime = pri.ArrestEndTime.Subtract(DateTime.Now); if (RestTime.TotalSeconds > 0.0) { GamePlay.gpHUDLogCenter(new Player[] { aktplayer }, "{0} Arrest ends in {1:00} min. {2:00} sec.", new object[] { aktplayer.Name(), RestTime.Minutes, RestTime.Seconds }); } else { GamePlay.gpHUDLogCenter(new Player[] { aktplayer }, "{0} Arrest over - Have Fun!", new object[] { aktplayer.Name() }); pri.Removable = true; } } } } PrisonCamp.RemoveAll(item => item.Removable == true); } } } } |
![]() |
Thread Tools | |
Display Modes | |
|
|