Jump to content
pappagoat

trigger activated by vehicle from array of class names?

Recommended Posts

Trying to get a trigger to be activate whenever certain types of aircraft enter the trigger area. I have tried the below, as well as isKindof for just a single aircraft config and nothing has worked. Any ideas?

 

Trigger Condition: (bluefor present)
this && ({ _x in thislist} count ["uns_f100b_CAS", "uns_f100b_BMB"] > 0) 

 

 

The second part is I then want the trigger to execute a script upon the aircraft that activated the trigger, something like the below, hoping the _x denominator carries over from trigger condition to On Activation:

 

On Activation:

result = [_x, "uns_f100_silver", nil] call bis_fnc_initVehicle;

Share this post


Link to post
Share on other sites
this && (thisList findIf {(typeOf _x) in ["uns_f100b_CAS", "uns_f100b_BMB"]} > -1)
result = [(thisList select {(typeOf _x) in ["uns_f100b_CAS", "uns_f100b_BMB"]}), "uns_f100_silver"] call BIS_fnc_initVehicle; 

I did not test...

  • Like 1

Share this post


Link to post
Share on other sites
12 hours ago, sarogahtyp said:

this && (thisList findIf {(typeOf _x) in ["uns_f100b_CAS", "uns_f100b_BMB"]} > -1)

result = [(thisList select {(typeOf _x) in ["uns_f100b_CAS", "uns_f100b_BMB"]}), "uns_f100_silver"] call BIS_fnc_initVehicle; 

I did not test...


Thanks.. why -1?

Share this post


Link to post
Share on other sites
1 hour ago, pappagoat said:


Thanks.. why -1?

Look at description of the return value of findIf!

Share this post


Link to post
Share on other sites

 

19 hours ago, sarogahtyp said:

this && (thisList findIf {(typeOf _x) in ["uns_f100b_CAS", "uns_f100b_BMB"]} > -1)

result = [(thisList select {(typeOf _x) in ["uns_f100b_CAS", "uns_f100b_BMB"]}), "uns_f100_silver"] call BIS_fnc_initVehicle; 

I did not test...

 

Ok first part works great, second part gives me an error 'expected object' as if its not returning the config name as the answer.

Edited by pappagoat

Share this post


Link to post
Share on other sites
Quote

 

'...





Error Params: Type Array, expected Object
File Jonzie_Code\functions\BIS\Vehicles\fn_initVehicle.sqf

[BIS_fnc_initVehicle], line 96

 

 

 

BIS_fnc_initVehicle does otherwise work. I have tested it using the name assigned to a vehicle, ie "jet1"

Share this post


Link to post
Share on other sites
39 minutes ago, sarogahtyp said:

complete error message pls

...

Share this post


Link to post
Share on other sites

uh. i have it but im on mobile. may take several minutes until i post

Share this post


Link to post
Share on other sites
{result = [_x, "uns_f100_silver"] call BIS_fnc_initVehicle;}
count (thisList select {(typeOf _x) in ["uns_f100b_CAS", "uns_f100b_BMB"]})

 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
12 hours ago, sarogahtyp said:

{result = [_x, "uns_f100_silver"] call BIS_fnc_initVehicle;}
count (thisList select {(typeOf _x) in ["uns_f100b_CAS", "uns_f100b_BMB"]})

 

 

 

Works beautifully, thanks!

Share this post


Link to post
Share on other sites

Hmm actually, if more than one F-100 is spawned at the same time, only the first one has its texture changed... maybe that is more to do with the way the trigger is activated. Maybe I should put the second part into a loop.

Share this post


Link to post
Share on other sites
7 minutes ago, pappagoat said:

Hmm actually, if more than one F-100 is spawned at the same time, only the first one has its texture changed... maybe that is more to do with the way the trigger is activated. Maybe I should put the second part into a loop.


Nope.. that didn't work, looped it but it still just changes the first F-100 when several are spawned at the same time or in rapid succession. I do have repeat on in the trigger, so once the trigger zone is empty and they spawn again, again the texture of the first one changes.

Share this post


Link to post
Share on other sites
Quote

{result = [_x, "uns_f100_silver", nil] call BIS_fnc_initVehicle;} forEach (nearestObjects [USAFskinstrg,["uns_f100b_CAS", "uns_f100b_BMB"],8000]);

 

Tried this in the activation as well and it gave the same result, only first aircraft skin changes... wondering if it is to do with the air support script im using

Share this post


Link to post
Share on other sites

Yeah both work when I test with two static aircraft, but when interacting with the air support script only the first jets skin changes... humph

Share this post


Link to post
Share on other sites

First of all thisList will return the "picture" of what satisfies the condition of the trigger. More exactly within the 0.5 sec slot which cadences the condition of the trigger. So, check your on act/on deact scripts. If the trigger is not yet fired (by the condition) and if the 2 jets enter the trigger both, within 0.5 sec, thisList will return the 2 jets. If one jet is "late", the first one will fire the trigger and the second one will not be in thisList while running the act. code. Simple as that. If you make the trigger repeatable, you need to deact, then react in this case. (So, both jets must enter within 0.5 sec or the first jet must be out of trigger before the second enters.

Two ways to workaround:

  • deact/rearm the trigger by a toggling variable as soon as it fires;
  • make an act. code more general like you did with the nearestObjects. But I wonder why you take a 8000 m radius! It's absolutely laggy and weird to repeat.

You should reconsider what exactly you want, at what time/condition. Using a trigger like this is not a good idea. Is it a kind of paint shop for jets?

 

If you want to "catch" all spawned jets by a module, I suggest you a simple trigger (no area, repeatable):

In cond field:

count (vehicles select {typeOf _x in ["uns_f100b_CAS", "uns_f100b_BMB"] && isNil {_x getVariable "passedF100b"}}) >0

In on act field:

{_x setVariable ["passedF100b",true]; [_x, "uns_f100_silver", nil] call BIS_fnc_initVehicle;} forEach (vehicles select {typeOf _x in ["uns_f100b_CAS", "uns_f100b_BMB"] && isNil {_x getVariable "passedF100b"}})

 

If you want to white list some f100b (for any reason), just add in init field: this setVariable ["passedF100b",true];

 

 

 

 

  • Thanks 1

Share this post


Link to post
Share on other sites
1 hour ago, pierremgi said:

First of all thisList will return the "picture" of what satisfies the condition of the trigger. More exactly within the 0.5 sec slot which cadences the condition of the trigger. So, check your on act/on deact scripts. If the trigger is not yet fired (by the condition) and if the 2 jets enter the trigger both, within 0.5 sec, thisList will return the 2 jets. If one jet is "late", the first one will fire the trigger and the second one will not be in thisList while running the act. code. Simple as that. If you make the trigger repeatable, you need to deact, then react in this case. (So, both jets must enter within 0.5 sec or the first jet must be out of trigger before the second enters.

Two ways to workaround:

  • deact/rearm the trigger by a toggling variable as soon as it fires;
  • make an act. code more general like you did with the nearestObjects. But I wonder why you take a 8000 m radius! It's absolutely laggy and weird to repeat.

You should reconsider what exactly you want, at what time/condition. Using a trigger like this is not a good idea. Is it a kind of paint shop for jets?

 

If you want to "catch" all spawned jets by a module, I suggest you a simple trigger (no area, repeatable):

In cond field:

count (vehicles select {typeOf _x in ["uns_f100b_CAS", "uns_f100b_BMB"] && isNil {_x getVariable "passedF100b"}}) >0

In on act field:

{_x setVariable ["passedF100b",true]; [_x, "uns_f100_silver", nil] call BIS_fnc_initVehicle;} forEach (vehicles select {typeOf _x in ["uns_f100b_CAS", "uns_f100b_BMB"] && isNil {_x getVariable "passedF100b"}})

 

If you want to white list some f100b (for any reason), just add in init field: this setVariable ["passedF100b",true];

 

 

 

 

Interesting, will try.

 

Yes basically for my missions want to make it so that certain aircraft (F-4, F-100, F-105) spawn with with their pre-SEA camo textures if the year is 1965 or before (I already added the year part to the trigger conditions).
Trying to use it with the GX support module as its the only module that I've found that supports UNSUNG aircraft for CAS, but as I mentioned there are issues with it not working on all aircraft when calling in CAS with more than one jet at a time.

Share this post


Link to post
Share on other sites

My last code should work. Make the trigger repeatable. You don't need an area because you're filtering all F100b without a specific variable (then added when customized). I quickly tested the UNSUNG CAS module but it threw an error for the caller (I didn't take time to see how it works, my bad). F100b are fine to pilot. Just one bug for canopy floating in the air after ejection. (The seat falls on ground but not the canopy). Have fun with this mod!

Share this post


Link to post
Share on other sites

 I've been using this for CAS. It needs updating but calling in A-1H and F-100 still works. I did try editing it but can't get it to repack - keeps on kicking back errors or not packing correctly. Unsure why at the moment. 

Share this post


Link to post
Share on other sites
1 hour ago, pierremgi said:

First of all thisList will return the "picture" of what satisfies the condition of the trigger. More exactly within the 0.5 sec slot which cadences the condition of the trigger. So, check your on act/on deact scripts. If the trigger is not yet fired (by the condition) and if the 2 jets enter the trigger both, within 0.5 sec, thisList will return the 2 jets. If one jet is "late", the first one will fire the trigger and the second one will not be in thisList while running the act. code. Simple as that. If you make the trigger repeatable, you need to deact, then react in this case. (So, both jets must enter within 0.5 sec or the first jet must be out of trigger before the second enters.

Two ways to workaround:

  • deact/rearm the trigger by a toggling variable as soon as it fires;
  • make an act. code more general like you did with the nearestObjects. But I wonder why you take a 8000 m radius! It's absolutely laggy and weird to repeat.

You should reconsider what exactly you want, at what time/condition. Using a trigger like this is not a good idea. Is it a kind of paint shop for jets?

 

If you want to "catch" all spawned jets by a module, I suggest you a simple trigger (no area, repeatable):

In cond field:

count (vehicles select {typeOf _x in ["uns_f100b_CAS", "uns_f100b_BMB"] && isNil {_x getVariable "passedF100b"}}) >0

In on act field:

{_x setVariable ["passedF100b",true]; [_x, "uns_f100_silver", nil] call BIS_fnc_initVehicle;} forEach (vehicles select {typeOf _x in ["uns_f100b_CAS", "uns_f100b_BMB"] && isNil {_x getVariable "passedF100b"}})

 

If you want to white list some f100b (for any reason), just add in init field: this setVariable ["passedF100b",true];

 

 

 

 

Result! Great. Works perfectly.

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×