Jump to content
damsous

Repetable trigger condition

Recommended Posts

Hello im trying to do something, but i can do it one time im not able to do it repeatedly.

 

Just an exemple of what i want to do :

I want to deliver 2 item in one place for create one, for exemple an Offroad + a static HMG and that create an Offroad Hmg.

 

So i use 3 trigger to do this :

1st trigger :

trigger name : offroad

condition : {typeof _x isEqualTo "C_Offroad_01_F"} count thisList > 0

activation : _vehicles = nearestObjects [offroad, ["C_Offroad_01_F"], 100];
 {deleteVehicle _x} forEach thisList;

 

2nd trigger :

trigger name : hmg

condition : {typeof _x isEqualTo "B_HMG_01_high_F"} count thisList > 0

activation : _vehicles = nearestObjects [hmg, ["B_HMG_01_high_F"], 100];
 {deleteVehicle _x} forEach thisList;

 

3rd trigger :

no name

condition : TriggerActivated offroad AND TriggerActivated hmg;

activation : _veh = "B_G_Offroad_01_armed_F" createVehicle getMarkerPos "veh";

 

 

When i deliver the vehicle and the static weapon i got an offroad hmg that spawn, but not work on repeat trigger.

 

My question it is possible to do that with one trigger, a working line for multiple condition.

 

Share this post


Link to post
Share on other sites

When you delete vehicle, repeated trigger deactivates so 3rd trigger never fires. Move both deleteVehicle to the 3rd trigger activation.

  • Thanks 1

Share this post


Link to post
Share on other sites

Don't forget thisList refers to the pre-established conditions, like BLUFOR present, ANYBODY present, ANYPLAYER present, etc.

So, if you filter that with vehicle class, even it's OK, that can be tricky to have 2 such repeatable triggers (different sides), activated simultaneously with one player.

You can try instead: vehicles findIf { typeof _x isEqualTo "C_Offroad_01_F" && _x inArea thisTrigger} >= 0

 

  • Thanks 1

Share this post


Link to post
Share on other sites
5 hours ago, killzone_kid said:

When you delete vehicle, repeated trigger deactivates so 3rd trigger never fires. Move both deleteVehicle to the 3rd trigger activation.

Thats work, but now i got an other issue i want to do the same thing with wreck, ammobox and few object but the trigger dont want to detect it.

 

For exemple a single trigger to detect an Ammo box don't work but its weird cause the trigger detect if the object is not present.

 

My exemple :

condition : {_x iskindof "Land_PaperBox_open_full_F"} count thislist == 1

activation : hint "work";

the trigger didnt detect the object.

 

If i try with this line for absent detection thats work even if the ammo box is in the trigger :  {_x iskindof "Land_PaperBox_open_full_F"} count thislist == 0.

I also try with this line without success : {typeof _x isEqualTo "Land_PaperBox_open_full_F"} count thisList > 0.

 

There is something special to detect the static object ?

 

 

 

Share this post


Link to post
Share on other sites
21 minutes ago, damsous said:

thislist

 

Please familiarise yourself with what is what if you want to use triggers: https://community.bistudio.com/wiki/Magic_Variables#thisList
 

Quote

defines an array of objects that have been detected by the trigger  (same as what is returned by the list command)


If object is not detectable by trigger it will not be in the trigger list

Also read @pierremgi comment

  • Thanks 1

Share this post


Link to post
Share on other sites

I have trying this, but now that detect every object inside the trigger, i start to loose my hair :)

 

{vehicle _x in thislist || (!(vehicle _x isEqualTo "Land_PaperBox_open_full_F") && !(vehicle _x isEqualTo "Land_Wreck_Slammer_hull_F"))} count thislist == 1

Share this post


Link to post
Share on other sites

Forget thisList for objects and read what already explained: ....  inArea thisTrigger

Share this post


Link to post
Share on other sites
15 minutes ago, pierremgi said:

Forget thisList for objects and read what already explained: ....  inArea thisTrigger

Yeah i have tried to your exemple but its not work for static object :

vehicles findIf { typeof _x isEqualTo "C_Offroad_01_F" && _x inArea thisTrigger} >= 0   (its work)

vehicles findIf { typeof _x isEqualTo "Land_PaperBox_open_full_F" && _x inArea thisTrigger} >= 0 (not work)

 

Share this post


Link to post
Share on other sites
27 minutes ago, damsous said:

Yeah i have tried to your exemple but its not work for static object :

vehicles findIf { typeof _x isEqualTo "C_Offroad_01_F" && _x inArea thisTrigger} >= 0   (its work)

vehicles findIf { typeof _x isEqualTo "Land_PaperBox_open_full_F" && _x inArea thisTrigger} >= 0 (not work)

 

Normal "Land_PaperBox_open_full_f" is nor a vehicle (landVehicle, plane,helo, tank...) class

so you need to name your objects paperbox1 for example and use paperbox1 inArea thisTrigger, if possible, or,

use some other command like nearobjects.

  • Like 1

Share this post


Link to post
Share on other sites
4 minutes ago, damsous said:

Yeah i have tried to your exemple but its not work for static object :

vehicles findIf { typeof _x isEqualTo "C_Offroad_01_F" && _x inArea thisTrigger} >= 0   (its work)

vehicles findIf { typeof _x isEqualTo "Land_PaperBox_open_full_F" && _x inArea thisTrigger} >= 0 (not work)

 

try  entities

Share this post


Link to post
Share on other sites

Im not able to make it working but thank you for your answer

Share this post


Link to post
Share on other sites

then try this for condition:

getPos thisTrigger nearestObject "Land_PaperBox_open_full_F" inArea thisTrigger

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
9 hours ago, killzone_kid said:

then try this for condition:

getPos thisTrigger nearestObject "Land_PaperBox_open_full_F" inArea thisTrigger

Its work thanks a lot :)

Share this post


Link to post
Share on other sites
1 hour ago, Grumpy Old Man said:

Nice idea, definitely didn't see anything similar yet, heh.

 

Cheers

I want to create a system where the player need a vehicle to transport the item to build something big, remove the ability tu run when carry heavy item, create a rare crafting component and make vehicle avaibility more complicated for post apocalyptic scenario.

For exemple the pile of junk its a common material that need to be decomposed near a workbench, each decomposed pile of junk will create : 1 tin fence, 1 stack of palet, 1 plank and 1 tin fence pole.

The player can already use this material for make basic defense or build other item like a slumhouse with 4 tin fence, 4 tinfence pole and 10 stack of palet.

Or a Grey metal shed with more tin fence + tinfence pole (do not need palet).

 

Or an other exemple with more rare item, 20 concrete pillar + 20 satck of brick + 1 stack of palet = an unfinished building, the building can be customise with plank, fence....

5 concrete pillar can be build with 1 stack of cinder block, a concrete wall can be build with 5 concrete pillar.

 

 

  • Like 1

Share this post


Link to post
Share on other sites

I have an other issue i don't know if its possible to count the number of element with the condition you give me :

getPos thisTrigger nearestObject "Land_PaperBox_open_full_F" inArea thisTrigger

 

I would like to activate the trigger if for exemple there 3 "Land_PaperBox_open_full_F" inside the activation area.

 

Share this post


Link to post
Share on other sites

count ((getpos thisTrigger nearObjects ["Land_PaperBox_open_full_F",200]) select {_x inArea thisTrigger}) >2

  • Like 1
  • Thanks 1

Share this post


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

count ((getpos thisTrigger nearObjects ["Land_PaperBox_open_full_F",200]) select {_x inArea thisTrigger}) >2

Its not working i put 2 box inside the trigger nothing happen, no script error.

  • Sad 1

Share this post


Link to post
Share on other sites

try

{_x inArea thisTrigger} count (getPos thisTrigger nearObjects ["Land_PaperBox_open_full_F", 200]) >= 3

  • Thanks 1

Share this post


Link to post
Share on other sites
49 minutes ago, killzone_kid said:

try

{_x inArea thisTrigger} count (getPos thisTrigger nearObjects ["Land_PaperBox_open_full_F", 200]) >= 3

Its working thank you so much :)

 

Share this post


Link to post
Share on other sites
2 hours ago, damsous said:

Its not working i put 2 box inside the trigger nothing happen, no script error.

Really? can't you adapt a little bit when you read a "count  something >2" ? and when you asked for 3 boxes as example?

Share this post


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

Really? can't you adapt a little bit when you read a "count  something >2" ? and when you asked for 3 boxes as example?

No i try with 2 box with your exemple

 

Share this post


Link to post
Share on other sites
4 hours ago, damsous said:

No i try with 2 box with your exemple

 

Do you absolutely have to do it via triggers? Stuff that goes beyond if XY in thisList is done more conveniently with a simple script snippet.

 

What @pierremgi meant was that the condition won't fire with 2 objects, because it requires >2 objects, means more than 2, other than >=2, which will fire with 2 objects, or more. A simple thing to tweak on your own, really.

 

Cheers

Share this post


Link to post
Share on other sites

I would ditch the inAreaTrigger and use distance2d check in the select expression. In combination with nearObjects or some other.

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

×