Lua script to trigger when plane is hit and downed airmen

Take command of air and naval assets from post-WW2 to the near future in tactical and operational scale, complete with historical and hypothetical scenarios and an integrated scenario editor.

Moderator: MOD_Command

Post Reply
User avatar
wqc12345
Posts: 176
Joined: Mon Dec 07, 2015 2:56 pm
Location: San Francisco, CA

Lua script to trigger when plane is hit and downed airmen

Post by wqc12345 »

I noticed that someone on baloogan's wiki posted a lua script for SAR operations, and I was curious if it's possible to assign this script to the location of a downed airmen. The logic would look something like this:

- A/C gets intercepted by SAM/AAA
- script fires to determine a true/false event for pilot living
- if true, SAR script runs and sets a location near/close to A/C intercept
- SAR mission runs as normal but for that location instead of random generated one
- if the pilot living event rolls false, then NO SAR event

Not sure if this kind of conditional logic is available to scripters, but it seems like something that would add some realism to the scenario.
mikmykWS
Posts: 7185
Joined: Tue Mar 22, 2005 4:34 pm

RE: Lua script to trigger when plane is hit and downed airmen

Post by mikmykWS »

Somebody worked on this some time ago.

http://forum.baloogancampaign.com/viewt ... f=10&t=165

Thanks

Mike
User avatar
Randomizer
Posts: 1497
Joined: Sat Jun 28, 2008 8:31 pm

Scripting rescues at sea

Post by Randomizer »

Not a real fan of combat SAR in air-oriented scenarios because it can become a major distraction and from a command and control perspective, these operations will generally be Somebody Else's Problem.

However, adding the rescue problem to units at sea may be more representative of missions that might be expected, particularly in very local situations, crisis' or operations other than war. Using events and minimal Lua scripting, adding survivors to ships is actually pretty easy.

The attached scenario is an example and was a proof of concept test run for a scenario that has not yet been completed. This technique makes the survivors neutral to the player so that you basically need line of sight to locate the life rafts.

About 10-minutes into the test scenario, a friendly merchant will be sunk. A message will appear advising the Player that the crew is abandoning ship. You then need to search for the life raft and when you close within 70-yards or so, it will disappear (representing the actual rescue) and you get awarded 100-VP for the rescue.

For variation you can add a message about the actual rescue or require some specific time to be in the vicinity of the life raft before the rescue event fires. For disasters at sea, you can have multiple life rafts spawning from a single vessel. The life rafts will wander away from their start points and so if some time passes between the sinking than the rescue, you may have to actually conduct a search.

Have not seen a better or easier system to model rescue at sea so apologies if there is a more elegant solution out there. That said, using the Clone Events utility creating survivors for multiple ships is pretty easy once you get the hang of it.

Not for every situation or scenario but handy for piracy scenarios or escalating crisis's.

-C
Attachments
SARTest.zip
(11.08 KiB) Downloaded 25 times
User avatar
wqc12345
Posts: 176
Joined: Mon Dec 07, 2015 2:56 pm
Location: San Francisco, CA

RE: Lua script to trigger when plane is hit and downed airmen

Post by wqc12345 »

I have seen this one..

I don't think it triggers on the plane being downed and run a bool to see if the pilot lives.. secondly, I don't think this script locates the SAR mission in the location of the downed plane, it seems to be a random generation of location.. correct me if I'm wrong?

I would use this script, but was curious if it would be possible to:

1) store the result of an event, for example, a plane is downed, a trigger fires to see if the pilot lives, store this value
2) if this value is true, run the SAR script and generate a SAR location in the vicinity of the downed plane
3) if this value is false, keep on trucking..

Does this make sense?
User avatar
wqc12345
Posts: 176
Joined: Mon Dec 07, 2015 2:56 pm
Location: San Francisco, CA

RE: Scripting rescues at sea

Post by wqc12345 »

Thanks Randomizer.. I'll give it a look.
mikmykWS
Posts: 7185
Joined: Tue Mar 22, 2005 4:34 pm

RE: Lua script to trigger when plane is hit and downed airmen

Post by mikmykWS »

ORIGINAL: wqc12345

I have seen this one..

I don't think it triggers on the plane being downed and run a bool to see if the pilot lives.. secondly, I don't think this script locates the SAR mission in the location of the downed plane, it seems to be a random generation of location.. correct me if I'm wrong?

I would use this script, but was curious if it would be possible to:

1) store the result of an event, for example, a plane is downed, a trigger fires to see if the pilot lives, store this value
2) if this value is true, run the SAR script and generate a SAR location in the vicinity of the downed plane
3) if this value is false, keep on trucking..

Does this make sense?

I gave you the link to help out. [:)]

Good luck with the script.

Mike


User avatar
Dysta
Posts: 1909
Joined: Fri Aug 07, 2015 9:32 pm

RE: Lua script to trigger when plane is hit and downed airmen

Post by Dysta »

Unless the pilot is critically important for the scenario's task (like pre-war/conflict situation to provide evidence of innocence to the court IRL), SAR will be both secondary and become some other department to matter with. Maybe can also add the friendly AI side with rescue vessel/aircraft to roam around the crash site, and add secondary task to player to protect them.
User avatar
michaelm75au
Posts: 12455
Joined: Sat May 05, 2001 8:00 am
Location: Melbourne, Australia

RE: Lua script to trigger when plane is hit and downed airmen

Post by michaelm75au »

ORIGINAL: wqc12345

I have seen this one..

I don't think it triggers on the plane being downed and run a bool to see if the pilot lives.. secondly, I don't think this script locates the SAR mission in the location of the downed plane, it seems to be a random generation of location.. correct me if I'm wrong?

I would use this script, but was curious if it would be possible to:

1) store the result of an event, for example, a plane is downed, a trigger fires to see if the pilot lives, store this value
2) if this value is true, run the SAR script and generate a SAR location in the vicinity of the downed plane
3) if this value is false, keep on trucking..

Does this make sense?
You can do all that with LUA scripting in actions as part of the same 'event' trigger.
Michael
Rory Noonan
Posts: 2418
Joined: Thu Dec 18, 2014 1:53 am
Location: Brooklyn, NY

RE: Lua script to trigger when plane is hit and downed airmen

Post by Rory Noonan »

I added a CSAR feature to a small scenario I made: tm.asp?m=4061677

Feel free to pull it apart in the editor and learn from that.

As others have said, it would probably get tedious/annoying in a large scenario or if repeated over and over. It would be very simple to add a % probability condition to the trigger to reduce predictability/repeating occurences.
Image
User avatar
wqc12345
Posts: 176
Joined: Mon Dec 07, 2015 2:56 pm
Location: San Francisco, CA

RE: Lua script to trigger when plane is hit and downed airmen

Post by wqc12345 »

This script, Task Force Normandy was exactly what I was referring to.. Thanks man!! This is great
Post Reply

Return to “Command: Modern Operations series”