LUA Question - Activate/Deactivate Event?

Post new mods and scenarios here.

Moderator: MOD_Command

Post Reply
User avatar
cf_dallas
Posts: 303
Joined: Thu Apr 13, 2006 3:35 pm
Location: Grapevine, TX

LUA Question - Activate/Deactivate Event?

Post by cf_dallas »

Is it possible to activate/deactivate an event? I'm assuming using a LUA script, but I'm open to other ideas.

If so, how? I didn't see anything on a quick scan through the various LUA resources.

I'm building a scenario that involves the "non-kinetic" intercept of AEW aircraft... ie, you go chase them away but you don't shoot them. When an AEW plane is intercepted, I can make him run for home, and I can make a fighter escort launch to shepherd him home safely.

I want the escorts to deactivate and land when the AEW plane is safely home, so I set up a "Unit Enters Area" trigger keyed to the AEW plane getting home. It triggers. Every. Single. Second. that the AEW plane is at its home base. Including at scenario start, when the AEW plane hasn't even launched yet.

I'd like to set it so the "Unit Enters Area" event is only active during the "intercept/RTB" cycle, and once the AEW plane gets home safely the event (or just the trigger) is no longer firing.

Any suggestions?

I'm using Buld 678 (v1.07) so if there's something applicable in the newer builds, please let me know.
Formerly cwemyss
User avatar
Mgellis
Posts: 2162
Joined: Sat Aug 18, 2007 2:45 pm
Contact:

RE: LUA Question - Activate/Deactivate Event?

Post by Mgellis »

ORIGINAL: cf_dallas

Is it possible to activate/deactivate an event? I'm assuming using a LUA script, but I'm open to other ideas.

If so, how? I didn't see anything on a quick scan through the various LUA resources.

I'm building a scenario that involves the "non-kinetic" intercept of AEW aircraft... ie, you go chase them away but you don't shoot them. When an AEW plane is intercepted, I can make him run for home, and I can make a fighter escort launch to shepherd him home safely.

I want the escorts to deactivate and land when the AEW plane is safely home, so I set up a "Unit Enters Area" trigger keyed to the AEW plane getting home. It triggers. Every. Single. Second. that the AEW plane is at its home base. Including at scenario start, when the AEW plane hasn't even launched yet.

I'd like to set it so the "Unit Enters Area" event is only active during the "intercept/RTB" cycle, and once the AEW plane gets home safely the event (or just the trigger) is no longer firing.

Any suggestions?

I'm using Buld 678 (v1.07) so if there's something applicable in the newer builds, please let me know.

I don't think you can use lua this way yet.

One possible fix...the trigger isn't "Unit enters area" but "Unit remains in area."

1. Set up relative reference points around AEW aircraft. This defines an area close to the AEW aircraft that indicates a "close approach/interception" Since the reference points are relative to the AEW aircraft, they move with it. Of course, since the AEW plane is on another side, you don't see the reference points when you're playing.

2. Set up another zone right across the border in the AEW's country's territory...the "rendevous after retreat" area.

3. If your planes get close enough to AEW, that triggers a new mission--the AEW now goes to a support mission in the "rendevous after retreat" zone, so it is clearly running away and crosses the border back into its own country's airspace.

4. Now, set up a trigger based on "unit remains in area." (The area should surround the reference points for the rendervous support mission.) Once the AEW remains in the rendevous point long enough (probably only a few minutes--even if it crosses it by accident going out, it won't stay there long enough to activate the trigger). If you need to, to make sure it stays there long enough, you can put a tanker there, too.

Does this make sense? I hope this helps.

User avatar
cf_dallas
Posts: 303
Joined: Thu Apr 13, 2006 3:35 pm
Location: Grapevine, TX

RE: LUA Question - Activate/Deactivate Event?

Post by cf_dallas »

Makes sense, looks like a good workaround.

I think I can also fix it by moving my "enters area" box off the base itself and putting it a couple miles out on the final approach heading. Landing AEW planes will trigger it, but the ones paled on the field won't.
Formerly cwemyss
User avatar
Primarchx
Posts: 1954
Joined: Sun Jan 20, 2013 9:29 pm

RE: LUA Question - Activate/Deactivate Event?

Post by Primarchx »

I've used some creative moving of RPs (and their associated zones) with Lua to implement 'unit in zone' triggers so that it is only possible at certain times or after certain other triggers have occurred.
Tomcat84
Posts: 1952
Joined: Wed Jul 10, 2013 5:13 pm

RE: LUA Question - Activate/Deactivate Event?

Post by Tomcat84 »

Also if you want RPs to apply relative to a unit on the player's side, but you don't want the player to see them, you can add the RPs on a different non-player side, enable god's eye and that way make the RPs relative to the player side unit.
My Scenarios and Tutorials for Command

(Scenarios focus on air-warfare :) )
User avatar
cf_dallas
Posts: 303
Joined: Thu Apr 13, 2006 3:35 pm
Location: Grapevine, TX

RE: LUA Question - Activate/Deactivate Event?

Post by cf_dallas »

ORIGINAL: Primarchx

I've used some creative moving of RPs (and their associated zones) with Lua to implement 'unit in zone' triggers so that it is only possible at certain times or after certain other triggers have occurred.

Brilliant, I think that's the way to go for what I'm doing.
Formerly cwemyss
Post Reply

Return to “Mods and Scenarios”