![]() |
|
#1
|
|||
|
|||
![]() Quote:
Also possible, but I assume the casual player will spawn, curse, ESC, Spawn, curse, repaeat... and get loud, which would lead to a lot of planes spawing and therefore lags, but if it`s only feasible this route, would be ok also. ![]() I like designing missions, but I don´t have time and the nerves to get myself into C# beyond just taking what I find and copy it together... ![]() Quote:
But anyhow, if someone of the scripters would get his hands on a such lines, I`ll buy him a beer. ![]()
__________________
http://cornedebrouwer.nl/cf48e |
#2
|
|||
|
|||
![]()
Thinking about it, I would even consider Ataros suggestion with blocking the players fuel pump as penalty as the best solution.
__________________
http://cornedebrouwer.nl/cf48e |
#3
|
|||
|
|||
![]()
My quick and dirty solution
![]() 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 Player Prisoner { get; set; } public DateTime JailTime { 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 (PrisonCamp.Count != 0) { foreach (prisonCell pri in PrisonCamp) { if (pri.Prisoner == player) { TimeSpan ArrestTime = DateTime.Now.Subtract(pri.JailTime); if (ArrestTime.TotalSeconds < TotalArrestTime) { GamePlay.gpLogServer(null, "Player: {0} is under Arrest\n", new object[] { player.Name() }); GamePlay.gpHUDLogCenter(new Player[] { player }, "{0} you are under Arrest!", new object[] { player.Name() }); (actor as AiAircraft).hitNamed(part.NamedDamageTypes.FuelPumpFailure); } 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()) { GamePlay.gpLogServer(null, "Player: {0} get a {1} sec. penalty for leaving Airplane in flight\n", new object[] { player.Name(), TotalArrestTime }); prisonCell NewPrisoner = new prisonCell(); NewPrisoner.Prisoner = player; NewPrisoner.JailTime = DateTime.Now; PrisonCamp.Add(NewPrisoner); } } } Last edited by FG28_Kodiak; 09-09-2011 at 11:56 AM. |
#4
|
|||
|
|||
![]()
PrisonCamp!
![]() Great idea! Thank you! Programming can be very creative ![]() Will do my best to enforce it on Repka servers. Since the script builds a list of prisoners anyway may I ask to add a message "player ... is killed by ..." instead of "AI was killed by..." as described by adonys here when you have some time? http://forum.1cpublishing.eu/showthread.php?t=25817 ps. Does the script excludes pilots who bailed-out from list of prisoners? Last edited by Ataros; 09-09-2011 at 12:35 PM. |
#5
|
|||
|
|||
![]()
Yes please someone try and work with this..
Nothing more annoying than everyone you shoot creating another plane and you've shot down 'AI' again.....really!? I've done this myself and its just annoying so I at least try an bail.. Any aircraft destroyed should be a kill and any aircraft your in that is destroyed or you bail from should be a death counted against you.. The stats have no meaning at all...As you know that everyone on the list has been shot down numerous times but has just created another plane when they've got themselves in trouble.. Everyone likes to know who they have shot down..come on Its also adds to the enjoyment of the game as your finishing them off or trying to evade to stay alive...instead of taking lote of hit, giving up and respawning Last edited by Ze-Jamz; 09-09-2011 at 01:21 PM. |
#6
|
|||
|
|||
![]() Quote:
![]() |
#7
|
|||
|
|||
![]()
Thank you indeed Kodiak! I will try this as soon as I am home again (should not be before Sunday evening).
If you tell me how to extend this script with a kind of death-penalty (maybe "You are on Cloud 7 - Wait for the bells!")? As a return I could offer a personalized 109 skin, maybe not the best, but certainly unique... ![]() ![]()
__________________
http://cornedebrouwer.nl/cf48e |
#8
|
|||
|
|||
![]()
Corrected Script after Ataros hint with bail out:
if the player bailed out OnPlaceLeave is also called and then OnPlaceEnter is called but the Actor is null. So i remove the player from prison if that's the case. 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 Player Prisoner { get; set; } public DateTime JailTime { 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 him from prison { if (PrisonCamp.Count != 0) { foreach (prisonCell pri in PrisonCamp) { if (pri.Prisoner == player) { pri.Removable = true; } } PrisonCamp.RemoveAll(item => item.Removable == true); } } if (PrisonCamp.Count != 0) { foreach (prisonCell pri in PrisonCamp) { if (pri.Prisoner == player) { TimeSpan ArrestTime = DateTime.Now.Subtract(pri.JailTime); if (ArrestTime.TotalSeconds < TotalArrestTime) { GamePlay.gpLogServer(null, "Player: {0} get a {1} sec. penalty for leaving Airplane in flight\n", new object[] { player.Name(), TotalArrestTime }); GamePlay.gpHUDLogCenter(new Player[] { player }, "{0} you are under Arrest!", new object[] { player.Name() }); (actor as AiAircraft).hitNamed(part.NamedDamageTypes.FuelPumpFailure); } 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.Prisoner = player; NewPrisoner.JailTime = DateTime.Now; PrisonCamp.Add(NewPrisoner); } } } Last edited by FG28_Kodiak; 09-09-2011 at 03:49 PM. |
#9
|
|||
|
|||
![]()
So for simpletons what does this mean..
A: If player bails out from plane after taking Dmg =? B: If player creates another plane after Dmg which AI now fly the plane =? Thanks for your work ~S~ |
#10
|
|||
|
|||
![]()
Thank you. Implemented this into my mission script and put it online, currently running on the III/JG27 Server. Unfortunatly I have no chance to test it.
But I got it to the "plane-destroy-after-ESCleaving-script" with its OnPlaceLeave- and OnPlayerEnter- Call-ups, without putting out error messages, so far. So the plane is destroyed after abandoming and the player should get 10mins break, by blocked fuel pump in the next 10mins (I increased the time and that was what I thought the script does) If someone is able to test it on our server, please report back. My Mission-Skript looks following: ...Well, 169574 characters and only 50000 allowed....
__________________
http://cornedebrouwer.nl/cf48e Last edited by SNAFU; 09-09-2011 at 03:57 PM. |
![]() |
|
|