#51
|
|||
|
|||
Can i have the complete mission please?
|
#52
|
||||
|
||||
here it is...
it also would be great if the hurris of the main mission-could be destroyed after a while as well, but they should remain longer on the map then the He's...tried that by myself, but without luck, so i deleted the part again from the script. |
#53
|
|||
|
|||
FG28_Kodiak, it looks like PassThrough trigger works 2 times, when entering the zone and when exiting it. If there are several aircraft they can triger it several time as well. A solution is not to do any calculations or actions in onTrigger method but make them in some other method like OnTickGame if the trigger was active before. It looks like my mission works now with this workaround but it is not very convenient. If you have any advice I will be grateful.
The mission is here http://forum.1cpublishing.eu/showpos...1&postcount=10 Thanks again! |
#54
|
||||
|
||||
Evening Chaps,
got a strange problem using a TTime trigger that isn't firing while being called though a submission that is loaded via the GamePlay.gpPostMissionLoad function. If I load the mission by itself then the TTime trigger works fine. Apparently there's something within the main mission that seems to void a TTime trigger within a submission. I've read through the entire thread but since I'm a noob at coding, I haven't found anything that adresses the issue specifically. I'm sure most here will recognise the basic script. The Bold portion in the script below loads the submission: Code:
using System; using maddox.game; using maddox.game.world; using System.Collections.Generic; public class Mission : AMission { AiAircraft PlayerPlane; // destroys aircraft abandoned by a player. 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); } } 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); int iNumOfEngines = (aircraft.Group() as AiAirGroup).aircraftEnginesNum(); for (int i = 0; i < iNumOfEngines; i++) { aircraft.hitNamed((part.NamedDamageTypes)Enum.Parse(typeof(part.NamedDamageTypes), "Eng" + i.ToString() + "TotalFailure")); } /***Timeout (240, () => {explodeFuelTank (aircraft);} ); * ***/ Timeout (300, () => {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 (300, () => { destroyPlane(aircraft); } ); } public override void OnAircraftLanded (int missionNumber, string shortName, AiAircraft aircraft) { base.OnAircraftLanded(missionNumber, shortName, aircraft); Timeout(300, () => { destroyPlane(aircraft); } ); } ///////////////////////////////////////////////////////////////////////////// //Listen to events of every (sub)mission public override void Init(maddox.game.ABattle battle, int missionNumber) { base.Init(battle, missionNumber); MissionNumberListener = -1; //Listen to events of every mission } ////////////////////////////////////////////////////////////////////////////// // Loads random submissions public override void OnTrigger(int missionNumber, string shortName, bool active) { if ("trigger01".Equals(shortName) && active) { DoDamage(); } GamePlay.gpGetTrigger(shortName).Enable = false; } private void DoDamage() { PlayerPlane = (AiAircraft)GamePlay.gpPlayer().Place(); // Initial Mission - can be any type Random RandomIncident = new Random(); switch (RandomIncident.Next(1, 13)) { case 1: GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/GHSCRIPTED/SUB1.mis"); break; case 2: GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/GHSCRIPTED/SUB2.mis"); break; case 3: GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/GHSCRIPTED/SUB3.mis"); break; case 4: GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/GHSCRIPTED/SUB4.mis"); break; case 5: GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/GHSCRIPTED/SUB5.mis"); break; case 6: GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/GHSCRIPTED/SUB6.mis"); break; case 7: GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/GHSCRIPTED/SUB7.mis"); break; case 8: GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/GHSCRIPTED/SUB8.mis"); break; case 9: GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/GHSCRIPTED/SUB9.mis"); break; case 10: GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/GHSCRIPTED/SUB10.mis"); break; case 11: GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/GHSCRIPTED/SUB11.mis"); break; case 12: GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/GHSCRIPTED/SUB12.mis"); break; } } public override void OnTickGame() { // loads the 1st sub-mission in 5 min and repeates it every 10 min. if (Time.tickCounter() % 18000 == 9000) // 18000 = 10 min repeat. 9000 = 5 min delay. // the 1st figure above must be always larger than 2nd! { Random RandomIncident = new Random(); // Fighter mission generation switch (RandomIncident.Next(1, 7)) { case 1: GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/GHSCRIPTED/SUB1.mis"); break; case 2: GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/GHSCRIPTED/SUB3.mis"); break; case 3: GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/GHSCRIPTED/SUB4.mis"); break; case 4: GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/GHSCRIPTED/SUB9.mis"); break; case 5: GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/GHSCRIPTED/SUB11.mis"); break; case 6: GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/GHSCRIPTED/SUB12.mis"); break; } } // Loads Missions consecutively if (Time.tickCounter() % 756000 == 1800) // 756000 = 420 (7 Hours) min repeat. 1800 = 1 min delay. { GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/GHSCRIPTED/SUB7.mis"); { GamePlay.gpHUDLogCenter("Monday, August 12 1940 08:01 am"); } } /* if (Time.tickCounter() % 108000 == 1800) // 108000 = 60 min repeat. 18000 = 10 min delay. { GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/GHSCRIPTED/SUB6.mis"); { GamePlay.gpHUDLogCenter("Monday, August 12 1940 08:00 am"); } } if (Time.tickCounter() % 108000 == 1800) // 108000 = 60 min repeat. 18000 = 10 min delay. { GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/GHSCRIPTED/SUB6.mis"); { GamePlay.gpHUDLogCenter("Monday, August 12 1940 08:00 am"); } } if (Time.tickCounter() % 108000 == 1800) // 108000 = 60 min repeat. 18000 = 10 min delay. { GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/GHSCRIPTED/SUB6.mis"); { GamePlay.gpHUDLogCenter("Monday, August 12 1940 08:00 am"); } } if (Time.tickCounter() % 108000 == 1800) // 108000 = 60 min repeat. 18000 = 10 min delay. { GamePlay.gpPostMissionLoad("missions/Multi/Dogfight/GHSCRIPTED/SUB6.mis"); { GamePlay.gpHUDLogCenter("Monday, August 12 1940 08:00 am"); } } */ } } Code:
using System; using maddox.game; using maddox.game.world; using System.Collections.Generic; using maddox.GP; public class Mission : AMission { private const int All = -1; private const int Allies = 1; private const int Axis = 2; public override void OnMissionLoaded(int missionNumber) { base.OnMissionLoaded(missionNumber); } public override void OnTrigger(int missionNumber, string shortName, bool active) { base.OnTrigger(missionNumber, shortName, active); //Triggers for RAF actions //Report Examples //SendScreenMessageTo(Allies, "Message to Red"); //SendScreenMessageTo(Axis, "Message to Blue"); if ((shortName == "LW_Spawn_7A") && active) { AiAction action = GamePlay.gpGetAction("LW_Spawn_7A"); //TriggerName if (action != null) { action.Do(); } } if ((shortName == "LW_Spawn_7B") && active) { AiAction action = GamePlay.gpGetAction("LW_Spawn_7B"); //TriggerName if (action != null) { action.Do(); } } if ((shortName == "LW_Spawn_7C") && active) { AiAction action = GamePlay.gpGetAction("LW_Spawn_7C"); //TriggerName if (action != null) { action.Do(); } } if ((shortName == "ALL_Radio_7A") && active) { AiAction action = GamePlay.gpGetAction("ALL_Radio_7A"); //TriggerName SendScreenMessageTo(Allies, "CH reports heavy buildup rallying at AX-16 flying low. We're loosing contact."); SendScreenMessageTo(Axis, "Bodo reports EG210 massing at AX-16. Low level Jabo to attack radar at AP-17 and AR-18."); if (action != null) { action.Do(); } } if ((shortName == "LW_Radio_7A") && active) { AiAction action = GamePlay.gpGetAction("LW_Radio_7A"); //TriggerName SendScreenMessageTo(Axis, "Bodo reports EG210 now AR-16. Attacking AP-17 and AR-18 radar in 5 minutes."); if (action != null) { action.Do(); } } if ((shortName == "GB_Radio_7A") && active) { AiAction action = GamePlay.gpGetAction("GB_Radio_7A"); //TriggerName SendScreenMessageTo(Allies, "SC reporting: Chain home station AP-17 Eastbourne is under attack!"); if (action != null) { action.Do(); } } if ((shortName == "GB_Radio_7B") && active) { AiAction action = GamePlay.gpGetAction("GB_Radio_7B"); //TriggerName SendScreenMessageTo(Allies, "SC reporting: Chain home station AR-18 Rye is under attack!"); if (action != null) { action.Do(); } } if ((shortName == "GB_Radio_7C") && active) { AiAction action = GamePlay.gpGetAction("GB_Radio_7C"); //TriggerName SendScreenMessageTo(Allies, "SC reporting: Chain home station AV-21 Dover is under attack!"); if (action != null) { action.Do(); } } if ((shortName == "GB_Radio_7D") && active) { AiAction action = GamePlay.gpGetAction("GB_Radio_7C"); //TriggerName SendScreenMessageTo(Allies, "SC reporting: Chain home station AS-22 Dunkirk is under attack!"); if (action != null) { action.Do(); } } GamePlay.gpGetTrigger(shortName).Enable = false; } private void SendScreenMessageTo(int army, string message) { if (army == All) { GamePlay.gpHUDLogCenter(message); } else { //Singleplayer (for Testing) if (GamePlay.gpRemotePlayers() == null || GamePlay.gpRemotePlayers().Length <= 0) { if (GamePlay.gpPlayer() != null && GamePlay.gpPlayer().Army() == army) { GamePlay.gpHUDLogCenter(message); } } else // Multiplayer { var playersInArmy = new List<Player>(); foreach (var player in GamePlay.gpRemotePlayers()) { if (player.Army() == army) { playersInArmy.Add(player); } } GamePlay.gpHUDLogCenter(playersInArmy.ToArray(), message); } } } } I'd appreciate any help or suggestions. Danke schön Gromic
__________________
I5-750 @ 3,8GHz / MSI P55-GD65 / MSI GTX570 Twin Frozr II / 4x2GB G.Skill 1600MHz / Corsair TX650 PSU / RAID 0 2x640GB WD Black
W7 Pro x64 SP1 / MS FFB2 +Saitek X45 / Freetrack + NP Clip Pro + PS3 Eye / Samsung BX2450 24" HDMI LED Last edited by Gromic; 02-03-2012 at 07:03 PM. Reason: Format Edit |
#55
|
||||
|
||||
Update
Been doing some "debugging" with a squadie who works in the field and now we're both scratching our heads. We've implimented a gpHUDLogCenter Message just to see if the triggers are actually meeting thier requirements. They definately are and this begs the question why those three flights aren't spawning. This has us both stumped. Code:
public override void OnTrigger(int missionNumber, string shortName, bool active) { //base.OnTrigger(missionNumber, shortName, active); { GamePlay.gpHUDLogCenter(string.Format("Mission {0}, Name {1}, Active={2}", missionNumber, shortName, active)); } //Triggers for RAF actions //Report Examples //SendScreenMessageTo(Allies, "Message to Red"); //SendScreenMessageTo(Axis, "Message to Blue"); if ((shortName == "LW_Spawn_7A") && active) { AiAction action = GamePlay.gpGetAction("LW_Spawn_7A"); //TriggerName if (action != null) { GamePlay.gpHUDLogCenter(string.Format("We have action {0}", action.Name)); action.Do(); } } if ((shortName == "LW_Spawn_7B") && active) { AiAction action = GamePlay.gpGetAction("LW_Spawn_7B"); //TriggerName if (action != null) { GamePlay.gpHUDLogCenter(string.Format("We have action {0}", action.Name)); action.Do(); } } if ((shortName == "LW_Spawn_7C") && active) { AiAction action = GamePlay.gpGetAction("LW_Spawn_7C"); //TriggerName if (action != null) { GamePlay.gpHUDLogCenter(string.Format("We have action {0}", action.Name)); action.Do(); } } Frustrating to say the least.
__________________
I5-750 @ 3,8GHz / MSI P55-GD65 / MSI GTX570 Twin Frozr II / 4x2GB G.Skill 1600MHz / Corsair TX650 PSU / RAID 0 2x640GB WD Black
W7 Pro x64 SP1 / MS FFB2 +Saitek X45 / Freetrack + NP Clip Pro + PS3 Eye / Samsung BX2450 24" HDMI LED |
#56
|
|||
|
|||
Have you tried compiling the whole cs, including the new loaded sub mis into one complete cs?
As it stands the triggers are a little buggy, especially as dedicated style hosting. I suspect the DS is simplified allowing for basic operation and missing many advanced ops awaiting final Dedicated proper to be created. I have been trying to get passthru triggers too work for players, proved to be quite difficult but have something semi functioning now. |
#57
|
||||
|
||||
Fixed.
But don't ask me why as I can't explain it. I figured if it's not the script itself then maybe there's a problem with the trigger itself (although I couldn't find any). So I deleted the 3 triggers (LW_Spawn_7C / LW_Spawn_7B / LW_Spawn_7A) using the FMB, saved the mission, restarted the game and proceeded to create them again using the exact same groups, times, etc. I didn't have much to lose after wasting a day banging my head on the table over this problem. Sure enough. The triggers fired as they had always done with the side effect of the groups actually spawning and the mission purring along as initially intended. At this point my house was filled with loud, booming vocal expletives #censored# because it made absolutly no sense whatsoever and (repeat) - scratch one day with the kind help of CloDs FMB. This morning I decided to compare the mission files themselves since I make regular 2 hour incremental backups with storagecraft and therefore always have a copy of any files past gone. There is no deviation between yesterday (mission not working) and todays (mission working) portions of the mis file that pertain to the triggers except for the listed order. Code:
Excerpt from triggers and actions group in non working .mis: [Trigger] LW_Spawn_7C TTime 15 LW_Spawn_7B TTime 25 LW_Spawn_7A TTime 65 GB_Radio_7B TPassThrough 1 BoB_LW_ErprGr210.22 206231 212690 2000 GB_Radio_7A TPassThrough 1 BoB_LW_ErprGr210.36 178666 197324 2000 LW_Radio_7A TPassThrough 1 BoB_LW_ErprGr210.22 202886 180347 2000 GB_Radio_7D TPassThrough 1 BoB_LW_ErprGr210.02 217559 252014 1900 GB_Radio_7C TPassThrough 1 BoB_LW_ErprGr210.12 246488 235993 2000 ALL_Radio_7A TPassThrough 1 BoB_LW_ErprGr210.12 262178 197723 2000 [Action] LW_Spawn_7C ASpawnGroup 0 BoB_LW_ErprGr210.12 LW_Spawn_7B ASpawnGroup 0 BoB_LW_ErprGr210.02 LW_Spawn_7A ASpawnGroup 0 BoB_LW_ErprGr210.36 GB_Radio_7C ASpawnGroup 0 Empty LW_Radio_7A ASpawnGroup 0 Empty GB_Radio_7A ASpawnGroup 0 Empty GB_Radio_7B ASpawnGroup 0 Empty GB_Radio_7D ASpawnGroup 0 Empty ALL_Radio_7A ASpawnGroup 0 Empty Excerpt from triggers and actions group in working .mis: [Trigger] GB_Radio_7B TPassThrough 1 BoB_LW_ErprGr210.22 206231 212690 2000 GB_Radio_7A TPassThrough 1 BoB_LW_ErprGr210.36 178666 197324 2000 LW_Radio_7A TPassThrough 1 BoB_LW_ErprGr210.22 202886 180347 2000 GB_Radio_7D TPassThrough 1 BoB_LW_ErprGr210.02 217559 252014 1900 GB_Radio_7C TPassThrough 1 BoB_LW_ErprGr210.12 246488 235993 2000 LW_Spawn_7C TTime 15 ALL_Radio_7A TPassThrough 1 BoB_LW_ErprGr210.12 262178 197723 2000 LW_Spawn_7B TTime 25 LW_Spawn_7A TTime 65 [Action] GB_Radio_7C ASpawnGroup 0 Empty LW_Radio_7A ASpawnGroup 0 Empty GB_Radio_7A ASpawnGroup 0 Empty GB_Radio_7B ASpawnGroup 0 Empty LW_Spawn_7C ASpawnGroup 1 BoB_LW_ErprGr210.12 GB_Radio_7D ASpawnGroup 0 Empty ALL_Radio_7A ASpawnGroup 0 Empty LW_Spawn_7A ASpawnGroup 1 BoB_LW_ErprGr210.36 LW_Spawn_7B ASpawnGroup 1 BoB_LW_ErprGr210.02 <sideswipe> Probably the reason why the patch is taking so long </sideswipe> Hats off and cheers to all you masochistic FMB junkies out there Grom
__________________
I5-750 @ 3,8GHz / MSI P55-GD65 / MSI GTX570 Twin Frozr II / 4x2GB G.Skill 1600MHz / Corsair TX650 PSU / RAID 0 2x640GB WD Black
W7 Pro x64 SP1 / MS FFB2 +Saitek X45 / Freetrack + NP Clip Pro + PS3 Eye / Samsung BX2450 24" HDMI LED |
#58
|
|||
|
|||
S!
Try loading an airgroup via loading sub-submission with the airgroup, not via action included into the submision. It may be more reliable. Every time you open a trigger/action window in FMB you have to save it even if you do not edit it. Otherwise it may revert to some default values. Also clearing cache folder may help. Last edited by Ataros; 02-04-2012 at 07:54 AM. |
#59
|
||||
|
||||
Stirling work for the war effort there Gromic. Whilst I was out partying on my 1 day pass into the City I had no idea that you boffins were working so hard at it breaking the Jerry code. Top work and a 3 day pass with skirt thrown in for you.
|
|
|