PDA

View Full Version : How to delay a passthrough trigger becoming "live"?



No601_Swallow
Nov-10-2013, 10:44
Hi all!

I'm sorry to come straight in here with my first or second ATAG post and ask for help, but I'm ignorant about scripting and trying to understand it... and need some help! :recon:

I'm having success using passthrough triggers in the DF/"coop" missions I'm putting together for my squadron, and am using a script (I think from Kodiak on the Banana forums) to stop passthrough triggers being repeatedly activated by people re-entering the zones.

What I'd like to do is put down a passthrough trigger in the FMB but delay it going "live" until some time after "Start Battle" has started the mission. (Basically, I want to arrange for a squadron to activate the trigger when they return to base, so they can be thoroughly bounced at the end of the mission! :devilish:)

So what I would like to know is whether there is a way to do this in a script? (somethingticker?...)

Many thanks in advance and apologies if this has been asked before.

ATAG_Lolsav
Nov-10-2013, 12:57
I dont know the proper language for coding, but it seems to me you have to 2 possible solutions.

1 - A timeout (most likely the easyest way)

2 - A "meet condition" scope, ie,

IF A THEN {

stuff here you want to do

};

EDIT: Proper example from Salmo coding



public override void OnActorCreated(int missionNumber, string shortName, AiActor actor)
{
base.OnActorCreated(missionNumber, shortName, actor);

AiAircraft a = actor as AiAircraft;
Timeout(1.0, () => // wait 1 second for human to load into plane
{
if (a != null && isAiControlledPlane(a))
{
//do stuff because it's an AI controlled plane
}
});
}

bolox
Nov-10-2013, 13:15
So what I would like to know is whether there is a way to do this in a script?

should be doable. Something like this would be my first attempt- (tho how mission is designed can play a part in dictating the choice of method used)

use a TTime trigger set to say 10mins and query if this is true. Use this to set a bool to true (say call it '10mins') in your script.
Then in the script query for the spawn trigger you are planning put an if statement to query if 10mins is true-
'If 10mins = true; do devilish things:devilish:,
else return; '
- very pseudo code but this would trigger the spawn only when both the 10mins are up and plane passes through trigger- not trigger the spawn x mins after plane passes through

No601_Swallow
Nov-11-2013, 03:44
Cheers Gents!

Some pointers to pursue even for someone as tech-challenged as me! I'll have a fiddle and see what works!
:thumbsup:

SoW Reddog
Nov-11-2013, 05:19
A couple more options for you:

1) Create the trigger via script at the appropriate time, so you don't need to "ignore" it, it won't exist until it's relevant.

2) Add a custom menu to your player only to trigger the event. That way it happens when you want it to.

No601_Swallow
Nov-11-2013, 09:43
Thanks Reddog!

Screwing on my "Brainiac" head, though, I'm having trouble with the phrase "create the trigger via script". Assuming you don't just mean the time trigger in the FMB interface, but actually magicking a pass-through trigger with the C++ language thingy... um... Would that be a straightforward thing to do? It feels a bit like Mallory scaling Everest - over each ridge something else looms, bigger and more terrifying! [Except of course Mallory was an astonishingly gifted climber, etc, etc...]

I've just downloaded a big folder of samples put together by Ateros on the Banana Forum. Let's see what examples they hold! I'd better get a thermos of coffee ready, and a bottle or two of oxygen: it's going to be a heady climb...

SoW Reddog
Nov-11-2013, 10:21
Thanks Reddog!

Screwing on my "Brainiac" head, though, I'm having trouble with the phrase "create the trigger via script". Assuming you don't just mean the time trigger in the FMB interface, but actually magicking a pass-through trigger with the C++ language thingy... um... Would that be a straightforward thing to do? It feels a bit like Mallory scaling Everest - over each ridge something else looms, bigger and more terrifying! [Except of course Mallory was an astonishingly gifted climber, etc, etc...]

I've just downloaded a big folder of samples put together by Ateros on the Banana Forum. Let's see what examples they hold! I'd better get a thermos of coffee ready, and a bottle or two of oxygen: it's going to be a heady climb...

Well I have spent the past month or so working on a single mission which ended up with a script file of around 1500 lines of C#! I'm just starting to get my head around what is and isn't possible and the language specific nuances as I'm used to working in different languages.

By creating the trigger via script I do indeed mean using C# to achieve that end. I believe it'd be fairly easy to do, all you'd need is the location you want to create the trigger at, a timer to dictate when, and the code to create a sub-mission on the fly and load it. You'd then need something to link the event of it going off, to the action you want to happen, but you'd need that anyway.

Have a play with your examples and see where you get, if you need any help then I will if I can.

1lokos
Nov-11-2013, 11:52
What I'd like to do is put down a passthrough trigger in the FMB but delay it going "live" until some time after "Start Battle" has started the mission. (Basically, I want to arrange for a squadron to activate the trigger when they return to base, so they can be thoroughly bounced at the end of the mission! :devilish:)


Without C++ knowledge you are (like my :D ) limited to only four basic scrips in FMB:

TTime
TGroupDestroyed
TGroundDestroyed
TPassThrough

But for your example mission "TTime" do what you want, e.g. 30 minutes after mission start trigger a attacking group.

Or use a "TPassThrough" on one RTB waypoint to trigger this attacking group.

Sokol1

1lokos
Nov-17-2013, 22:41
Other option "OdenCoop" method.

http://forum.1cpublishing.eu/showthread.php?t=34932&highlight=COOP

Sokol1