SAS_Storebror Posted March 16, 2018 Posted March 16, 2018 Hi folks, I'd like to spawn an AI plane on my mission and respawn it once it has been "killed", which means it's "out of business" in whatever way. For instance the pilot could be dead, have bailed out, or the plane could have crash landed or could be completely destroyed. The problem I have is: I can point all these events like "OnPlaneDestroyed" to an MCU, and let that MCU trigger a respawn, however by doing so I sometimes seem to get multiple respawns, i.e. first the AI pilot gets shot, then the plane crash lands and finally it hits a tree - that seems to trigger all three events, hence 3 times respawn. So I thought I'd somehow "buffer" these events, but so far I'm unsuccessful. If I put a counter inbetween and disable it for a certain amount of time, it seems not to be able to re-enable it in a way that it would trigger again later on. If there'd be one singe event that will always fire on a dead plane, and that will reliably fire only once, then this would be great, but so far I fail to find one. On the other hand, if there'd be a possibility to somehow filter out these multiple events, that'd be cool as well, but I'm running out of ideas how to achieve that. Any clue from you ME experts? Cheers! Mike
JimTM Posted March 16, 2018 Posted March 16, 2018 Try this mission: JimTM - Test Enemy Spawn.zip I haven't tested it yet though.
Gambit21 Posted March 16, 2018 Posted March 16, 2018 I don't understand " not to be able to re-enable it in a way that it would trigger again later on. " since you simply re-activate the same spawn MCU and it works in the same way. I built a 5 on 5 perpetual dogfight group where each aircraft will re-spawn after it's been killed in the way you describe. Try "on critical damage" and "pilot ejected" targeted to the "disable Spawn? and reactivated with "on Killed" Really though you should just keep it simple and stick with "on Killed" and forget the other events since any event will result in "On Kllled" being fired anyway. KISS.
Habu Posted March 16, 2018 Posted March 16, 2018 Storebror, use a counter. I have some group which patrol all the mission. When a patrol is killed, a new one spawn. Here is the logic : For exemple 3 planes. as we work with spawn, each plane is indivudual. Plane 1/2/3 ---> Event kill/destroyed ... ---> Timer (2s) --> Counter (set on 3 for 3 planes) ---> Timer (2s) ----> Delete ---> Plane to be sure that everithing is off the game. |----> Timer (5s) ----> Spawn ----> Plane 1/2/3 If it's not clear, i can provide you my groups.
No601_Swallow Posted March 16, 2018 Posted March 16, 2018 Or just get the spawn MCU to disable itself (after it's fired once), and then re-enable it with an "OnSpawned" event/report?
SAS_Storebror Posted March 17, 2018 Author Posted March 17, 2018 12 hours ago, JimTM said: Try this mission: JimTM - Test Enemy Spawn.zip I haven't tested it yet though. Will do and report back, takes a few hours - RL stuff you know 11 hours ago, Gambit21 said: I don't understand " not to be able to re-enable it in a way that it would trigger again later on. " since you simply re-activate the same spawn MCU and it works in the same way. I built a 5 on 5 perpetual dogfight group where each aircraft will re-spawn after it's been killed in the way you describe. Try "on critical damage" and "pilot ejected" targeted to the "disable Spawn? and reactivated with "on Killed" Really though you should just keep it simple and stick with "on Killed" and forget the other events since any event will result in "On Kllled" being fired anyway. KISS. If it's definitely sure that the "OnKilled" Event will always get fired when a plane dies, then this would basically be good enough. I'm afraid though that situations may exist where e.g. a pilot gets shot, but the plane keeps flying for hours and no "OnKilled" event gets fired. Or where a plane gets shot to pieces, so that the game counts it as "destroyed" and the pilot doesn't engage anymore, yet the plane keeps flying for hours again and no "OnKilled" event gets fired. That'd be a worst case scenario. Disabling Spawn at "OnCriticalDamage" ("pilot ejected" is no availabled event) seems unnecessary cause in that case I could just remove those event links completely to the same effect. 11 hours ago, Habu said: Storebror, use a counter. I have some group which patrol all the mission. When a patrol is killed, a new one spawn. Here is the logic : For exemple 3 planes. as we work with spawn, each plane is indivudual. Plane 1/2/3 ---> Event kill/destroyed ... ---> Timer (2s) --> Counter (set on 3 for 3 planes) ---> Timer (2s) ----> Delete ---> Plane to be sure that everithing is off the game. |----> Timer (5s) ----> Spawn ----> Plane 1/2/3 If it's not clear, i can provide you my groups. I see the intention. I did use a counter already, even though as I'm gonna respawn the planes individually too, this might not be necessary. In your scheme you are monitoring the kill and destroyed events. What happens in case the pilot gets killed and the plane keeps flying? What happens when the plane belly lands and keeps lying on the ground? Does any of the two events get fired in those cases? And furthermore, what happens when on one plane both the "kill" and "destroyed" event get fired, e.g. 3 seconds after each other? In my book, this would trigger the counter two times, for one plane. That's exactly what I'd like to avoid. My scheme currently is like this: Plane --> Event OnPilotKilled/OnPlaneCrashed/OnPlaneDestroyed/OnKilled --> [Filter out multiple Events] -> wait 30 seconds -> Delete -> wait 2 seconds -> Respawn Plane The critical part is filtering out multiple events. For instance I've tried using a self-resetting "1" counter which I've deactivated right after firing it, and tried to reactivate the counter from an "OnPlaneSpawned" event of the plane. Doesn't work. Once the counter got deactivated, the reactivation doesn't seem to work and the counter will never fire again. And without that counter deactivation, I get the "multiple respawn issue" as expected. A plane gets the pilot killed, crashes and finally gets destroyed and therefore killed -> All 4 events fire and as a result, for that single plane downed, 4 new planes spawn. 6 hours ago, No601_Swallow said: Or just get the spawn MCU to disable itself (after it's fired once), and then re-enable it with an "OnSpawned" event/report? That's illogical in itself. How can a deactivated Spawner spawn a plane that fires an "OnSpawned" event to reactivate itself? Cheers! Mike
Habu Posted March 17, 2018 Posted March 17, 2018 (edited) 16 minutes ago, SAS_Storebror said: In your scheme you are monitoring the kill and destroyed events. What happens in case the pilot gets killed and the plane keeps flying? What happens when the plane belly lands and keeps lying on the ground? Does any of the two events get fired in those cases? Yes, that's why i have the delete command, to delete planes wich are destroyed but still flying, etc.. For the other questions, i have to have a look to my groups. Edited March 17, 2018 by Habu
No601_Swallow Posted March 17, 2018 Posted March 17, 2018 (edited) 4 hours ago, SAS_Storebror said: That's illogical in itself. How can a deactivated Spawner spawn a plane that fires an "OnSpawned" event to reactivate itself? Cheers! Mike Apologies for the lack of logic. I envisaged something along the lines shown below: But I see now this particular arrangement would not address your needs (in fact it probably wouldn't address any needs at all!) Edited March 17, 2018 by No601_Swallow
[DBS]Tx_Tip Posted March 17, 2018 Posted March 17, 2018 Use Complete Damage MCU for the "On Events" along with Counter and Timer Gates to Re and De Activate the logic. Working Group Here. AIDamageRespawn Logic.zip Tip
SAS_Storebror Posted March 17, 2018 Author Posted March 17, 2018 Thanks Tip, that looks very interesting. I'm afraid the outcome is not always what it's intended to. For instance "OnPilotWounded" triggers the damage gate, so as soon as one hits the pilot, first the "command Damage" would smash the plane and then a second later the "Trigger Delete" would remove it from the map. That would come as a surprise to most players spraying some bullets into an AI plane's cockpit I'm afraid. The idea of having a self-deactivating Damage Gate is something that came up my mind as well, but I'm uncertain what will happen to the Timer Trigger in case multiple Events get fired from the plane in short terms. For instance if the plane fires all the events OnPilotKilled/OnPlaneCrashed/OnPlaneDestroyed/OnKilled at the same time, would it be safe to assume that the self-deactivating Damage Gate would fire only once? That question boils down to: If I cross-link a Deactivate Trigger to such a 0 second Timer, and the input event comes in multiple times at the same time, will the Timer fire once before it gets deactivated, or may it fire multiple times? And if it only fires once, then gets deactivated, and then the other Events rush in: Will the Timer immediately fire again when it gets Re-Activated or will it simply ignore the input events which came in in the meantime? The same questions basically apply to a Counter too, but for a timer let me extend the proposal a bit by slightly modifying the damage gate: As you can see, I'm immediately deactivating a second gate as soon as any event comes in on the first one, but the second gate would fire with 1 second delay. I expect that initially, regardless whether one or multiple events come in from the plane, the second damage gate would get closed fast enough so that further events forwarded from the 0.0 gate would not make it to the 1.0 gate before it got closed. Therefore I'd expect the 1.0 to reliably only fire once, regardless of the number of events coming from the plane. But now comes the catch: Is this true? Or will there still be multiple output triggers from the 1.0 gate? Or maybe even none at all because it gets closed before getting triggered? And even if it's true, what will happen when I Re-Activate the 1.0 damage gate after it received several triggers from the 0.0 damage gate in deactivated state? Will that cause the 1.0 gate to get triggered on the "pending" events from the 0.0 gate? It would be much easier for me to answer this to myself if we had any way to reliably simulate such situations and even more, if there was some kind of log we could write debug messages to, but neither of this we have, unless I missed something obvious. Thanks for all your help and cheers! Mike
[DBS]Tx_Tip Posted March 17, 2018 Posted March 17, 2018 ??? The group is presented as an example which works. Easily modified to the Mission Designers needs. The "On events" within can be changed to whatever the Mission Designer wishes. To lengthen the time before Complete Damage. Place a Timer Gate between id: 101 and id: 103 making sure it is < (less than) id: 106 Having done so you would need to lengthen the time before the Aircraft Deletes and then Respawns. To do that you would change id:106 to however long you want but make sure that it is < (less than) id: 113 and > (greater than) the New Timer Gate. Good Luck with you Mission Design. Tip
Gambit21 Posted March 17, 2018 Posted March 17, 2018 16 hours ago, SAS_Storebror said: If it's definitely sure that the "OnKilled" Event will always get fired when a plane dies, then this would basically be good enough. I'm afraid though that situations may exist where e.g. a pilot gets shot, but the plane keeps flying for hours and no "OnKilled" event gets fired. Or where a plane gets shot to pieces, so that the game counts it as "destroyed" and the pilot doesn't engage anymore, yet the plane keeps flying for hours again and no "OnKilled" event gets fired. That'd be a worst case scenario. Disabling Spawn at "OnCriticalDamage" ("pilot ejected" is no availabled event) seems unnecessary cause in that case I could just remove those event links completely to the same effect. ??? I'm telling you what works based on experience and groups already built and in use.
SAS_Storebror Posted March 18, 2018 Author Posted March 18, 2018 (edited) 12 hours ago, [DBS]Tx_Tip said: ??? The group is presented as an example which works. Sorry Tip, don't want to be mad at you but it simply doesn't. As I explained in my reply to your group proposal, the Damager will cause the plane to explode and be removed from the running mission as soon as any of the events gets triggered. I've setup a test mission using your group and recorded a track with it, the mission can be found attached to this post and the track is here: http://www.mediafire.com/file/a2r73u7j3i7xecu At the end of the track, I have shot a few rounds in the 109's left wing and it's engine. At the moment the engine stops, the plane will explode and immediately vanish, long time after I put my last shot in. Any "kill" on that track is hit->plane explodes->plane is gone. 9 hours ago, Gambit21 said: ??? I'm telling you what works based on experience and groups already built and in use. Again don't want to be mad at you either Gambit, but your proposal might work once the "OnKilled" event gets fired, but this doesn't cover situations where the plane simply belly lands on a field or the pilot gets killed but the plane keeps flying. Simply doesn't do the trick like that. Sorry I stand corrected here. Triggering "OnKilled" only, without any dealing with other events, seems to be the key. Regardless what happens to the plane, as soon as it's out of action, the "OnKilled" event seems to fire. At least this is what I see in my latest tests. Now I only have to find a way to deal with "OnPlaneLanded" and the AI Return to Base Decision (for bingo fuel and/or ammo), but that's a different story. Cheers! Mike Respawn Test v1 Test Mission.zip Edited March 18, 2018 by SAS_Storebror
coconut Posted March 18, 2018 Posted March 18, 2018 19 minutes ago, SAS_Storebror said: Again don't want to be mad at you either Gambit, but your proposal might work once the "OnKilled" event gets fired, but this doesn't cover situations where the plane simply belly lands on a field or the pilot gets killed but the plane keeps flying. Simply doesn't do the trick like that. Have you verified this? I went into the same thought patterns you are going through a couple of times. I have made a few missions with waves of incoming AI planes, and using OnKilled has worked for me. It's hard to reliably cause the AI to belly land, or to snipe a pilot and have the plane keep flying for ever, making it difficult to verify that OnKilled is always fired, but as far as I can tell, it is. I haven't found the other events to be very very useful, they are not always fired when I would expect them to. A useful trick few people may know is the use of 1x auto-reset counters. If you trigger one when disabled, it won't fire, but it will remember to fire when activated again. I use that to prevent spawning duplicates before the old plane is deleted. Any condition that (re)spawns a plane has to go through that counter, which gets deactivated every time the associated plane is spawned, and activated again whenever a plane is killed or explicitly deleted (e.g. after completing its return flight, and getting away from other planes).
SAS_Storebror Posted March 18, 2018 Author Posted March 18, 2018 (edited) Thanks for your reply coconut. Yes I know about the counter trick, however that logic of triggering immediately once it gets Re-Activated is not always helpful and in this case I think it's rather undesired. The plane deletion is not a big issue to me. If it's up to me, a killed plane can do whatever it wants after being killed. From what I saw, the "OnKilled" event gets fired exactly when in "Normal" difficulty setting a plane Icon turns white (or pale grey) on the map and the HUD plane marker disappears and the "<xxx> killed <yyy>" message appears in chat. That's when the plane in question is out of action, whatever happens afterwards (e.g. it could possibly belly land thereafter), and it doesn't depend on what caused the plane to be taken out of action, be it severe controls damage, a pilot kill, a dead engine, the pilot bailing out or whatever else. The only thing I'm not quite sure of at the moment is whether it's possible that a plane would trigger the "AI Return to Base Decision" some time after the "OnKilled" event happened. That'd be a bummer, because for the sake of realism I'd like the AI planes to RTB if they are running out of fuel or ammo, and that should spawn a new AI opponent then, but of cause I don't want an already "killed" AI plane to cause a new spawn twice because of this. Cheers! Mike Edited March 18, 2018 by SAS_Storebror
SAS_Storebror Posted March 19, 2018 Author Posted March 19, 2018 Sorry for getting back on this, but I'm facing the next problem with the same thing. So... now we know that whenever an AI plane is taken out of action, an "OnKilled" event will get fired. That's fine and it can reliably serve as a trigger for respawning AI planes in case they got shot one way or the other. Now however I'd like the AI planes also to RTB in case they run out of ammo and/or fuel. Problem is: On their way back to base they might get killed, so I still have to monitor the "OnKilled" event even if the planes abort the fight. If however they manage to land, successful or not, they will fire an "OnPlaneDestroyed" Event (yes, it's not the "OnPlaneLanded" Event, at least not as much as I could see in all my tests so far. Irritating but true), but no "OnKilled" Event. Therefore I'd have to trigger a respawn from the "OnPlaneDestroyed" Event too - but that one also gets fired when a plane is getting shot, and in that case it can come at any arbitrary time before the "OnKilled" event comes - sometimes there's half a minute inbetween, sometimes they come simultaneously. So the question is: How can I let the AI plane reliably respawn once when it's getting shot or lands somewhere? Cheers! Mike
Gambit21 Posted March 19, 2018 Posted March 19, 2018 If they're firing "on killed" after landing then we have a bug. I haven't seen this - I'll test later.
SAS_Storebror Posted March 19, 2018 Author Posted March 19, 2018 (edited) Not "OnKilled". They fire "OnPlaneDestroyed" once the plane gets removed after (crash/belly/normal) landing. And that also seems to be the solution: The "OnPlaneDestroyed" event gets fired when the plane is removed from the mission. If I select "Delete After Death", then reliably latest 30s after a plane gets killed (regardless how), it will be removed and the "OnPlaneDestroyed" gets fired. So I can just catch "OnPlaneDestroyed" instead of "OnKilled". This seems to work well, however... On that occasion, I've also noticed that I cannot seem to get planes to land normally by using the "OnPlaneBingoFuel" event. Planes seem to depart from a fight in time when I let AI decide on RTB, however that's not feasible as they will try to land on the nearest base, and that's often times no place to land - maybe it's an airspawn base, maybe it's a tank base. So I thought I'd catch the "OnPlaneBingoFuel" event and make them land myself. Catching the event works. Cancelling the current command in that case works as well. However if I guide them directly to the landing point, they will instead belly land somewhere in the wild. If I set a waypoint on the next base first, and target this to the "land" command, the plane will go back to base correctly, but run out of fuel right before touchdown and therefore belly land a few hundred meters before runway. Is it just me or is this flawed? Cheers! Mike Edited March 19, 2018 by SAS_Storebror
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now