Lua Question

Post new mods and scenarios here.

Moderator: MOD_Command

Post Reply
Dannyp19
Posts: 202
Joined: Sun Oct 20, 2013 3:34 pm

Lua Question

Post by Dannyp19 »

I'm starting to really delve into the editor and make some scenarios(small personal ones ATM)

Lua reminds me of a custom programming logic script I used to do a long time ago working on building management controls.

Anyway I was wondering is there a way to write a script for when an aircraft gets shot down an ejected pilot shows up in the general area where it was downed.

Baloogan has a downed pilot script but the link was bad.

My plan is to have it occur randomly and a CSR team gets in the area and picks them up.

Any advice would be appreciated.

Thanks

OOPS...somebody just posted in the general and I wasnt looking. I got it.....I think.
ckfinite
Posts: 208
Joined: Fri Jul 19, 2013 10:33 pm

RE: Lua Question

Post by ckfinite »

Sure. You just add a "Unit Destroyed" trigger, and then have something like the following inside it:

local unit = ScenEdit_UnitX()
ScenEdit_AddUnit({ ... pilot information ..., latitude = unit.latitude, longitude = unit.longitude})


When the unit gets shot down, it'll call that trigger and add the pilot in. Remember to replace the "... pilot information ..." with something meaningful.

CSAR scripts are considerably more annoying to write. Let me know when you get to that.
Dannyp19
Posts: 202
Joined: Sun Oct 20, 2013 3:34 pm

RE: Lua Question

Post by Dannyp19 »

Thanks

Dannyp19
Posts: 202
Joined: Sun Oct 20, 2013 3:34 pm

RE: Lua Question

Post by Dannyp19 »

Hi Ckfinite

That worked good. Now what I would like to do is draw 4 RPs around the downed pilot to set up a CSAR mission.

What my plan is
1. Helo gets shot down (this will have probability check)
2. Insert downed pilot
3. Draw RP's around pilot (4 minimum )
4. Activate CSAR mission

This is all done on player side. Once CSAR mission is triggered active then player can choose what A/C's to assign.
Any help would be great

User avatar
Gunner98
Posts: 5880
Joined: Fri Apr 29, 2005 12:49 am
Location: The Great White North!
Contact:

RE: Lua Question

Post by Gunner98 »

A player aid to this would be to insert a radio beacon in the area that the AC gets shot down. Helps the player focus on where things are. You need to delete it when the CSAR is complete though. I tried a bunch of these in NF 4. It was clumsy and with ships - pre lua days but taking a look there might help.

B
Check out our novel, Northern Fury: H-Hour!: http://northernfury.us/
And our blog: http://northernfury.us/blog/post2/
Twitter: @NorthernFury94 or Facebook https://www.facebook.com/northernfury/
User avatar
wqc12345
Posts: 176
Joined: Mon Dec 07, 2015 2:56 pm
Location: San Francisco, CA

RE: Lua Question

Post by wqc12345 »

There is an excellent lua script here that does exactly what you want... its about three posts down, called Task Force Normandy, just do a search on my posts and look for the attachment for the script.
Post Reply

Return to “Mods and Scenarios”