cb65 85 Posted June 23, 2022 Hello, I've got a trigger question, I'm using this code in the condition of the trigger. (({_x in thisList} count allUnits > 0) or ((damage %1) > 0.1)) This works perfectly if a unit walks into the trigger area but if he drives through in a vehicle the trigger wont work. I tried. objArray = allUnits + vehicles. and put this in the trigger condition area instead of allUnits. ({_x in thisList} count _objArray > 0) but didn't work. Can anyone tell me how to set off the trigger with a vehicle in play ? cb65. Share this post Link to post Share on other sites
pierremgi 4817 Posted June 23, 2022 thisList concerns vehicles and infantry matching the preset condition (like Blufor present). The fact is the array is made of vehicles and infantry units but not crews. On the other hand, allUnits is an array of units, not vehicles, so your condition can be wrong (I don't know what you want to do). damage %1 ??? has no sense. objArray vs _objArray ??? If you want more help, describe what you want to do. Your code is wrong at multiple points. Share this post Link to post Share on other sites
cb65 85 Posted June 23, 2022 @pierre MGI Here's my script it's for my ied's mod, works fine with infantry units but if the units driving a vehicle the trigger wont fire. Spoiler /* IED trigger script Author of code: cb65 Date: 2018 */ params ["_obj","_exp"]; // Object/IED and Type of explosion (0 = large or 1 = small) private ["_pos","_num","_name","_activate","_initcode","_trigger"]; // Set object position _pos = position _obj; _obj setPosATL _pos; // Check if object array has been created or not if (isNil "objectArray") then {objectArray = [];}; // Add object to the object array objectArray pushBack _obj; // Count the objects in the object array _num = count objectArray; // Name the object _name = ""; _name = format ["ied_%1",_num]; _obj setVehicleVarName _name; _obj call compile format ["%1 = _this;publicVariable ""%1""",_name]; _activate = format ["(({_x in thisList} count allUnits > 0) or ((damage %1) > 0.1))",_name]; _initcode = ""; // Large explosion if (_exp == 0) then { _initcode = format ["0 = [%1,%2] spawn fnc_ied_explosion_lge;",_pos,_name]; }; // Small explosion if (_exp == 1) then { _initcode = format ["0 = [%1,%2] spawn fnc_ied_explosion_sml;",_pos,_name]; }; // Create trigger and attach it to the object _trigger = createTrigger ["EmptyDetector",_pos]; _trigger setTriggerArea [6,6,0,true]; _trigger setTriggerActivation ["ANY","PRESENT",false]; _trigger setTriggerTimeout [0,0,0, true]; _trigger setTriggerStatements [_activate,_initcode,""]; _trigger setPos getPos _obj; _trigger attachTo [_obj,[0,0,0]]; cb65. Share this post Link to post Share on other sites
pierremgi 4817 Posted June 23, 2022 Your script?? _activate = format ["(({_x in thisList} count allUnits > 0) or ((damage %1) > 0.1))",_name]; if I'm right, matches for 2 conditions: damage IED > 0.1 (not sure that works in MP because setVehicleVarName is EL perhaps you should remoteExec this command) and ({_x in thisList} count allUnits > 0) is a filter for infantry. If you don't like it, just remove it!... More exactly, as "Anybody present" is tracking also crates, rabbits and funny things, replace it by: ({driver _x iskindOf "CAManBase"} count thisList > 0) 1 1 Share this post Link to post Share on other sites
cb65 85 Posted June 23, 2022 11 hours ago, pierremgi said: replace it by: ({driver _x iskindOf "CAManBase"} count thisList > 0) I replaced it like this. _activate = format ["(({driver _x iskindOf "CAManBase"} count thisList > 0) or ((damage %1) > 0.1))",_name]; And it gives me a script error message format type string expected array. cb65. Share this post Link to post Share on other sites
Harzach 2516 Posted June 23, 2022 You have a string inside of a string. The inner string needs single quotes: _activate = format ["(({driver _x iskindOf 'CAManBase'} count thisList > 0) or ((damage %1) > 0.1))",_name]; 1 1 Share this post Link to post Share on other sites
cb65 85 Posted June 23, 2022 39 minutes ago, Harzach said: You have a string inside of a string. The inner string needs single quotes: _activate = format ["(({driver _x iskindOf 'CAManBase'} count thisList > 0) or ((damage %1) > 0.1))",_name]; Thanks Harzach I missed that. The trigger is working now thanks guys. now I've just got to check if this part of the code ((damage %1) > 0.1) works in MP. cb65. Share this post Link to post Share on other sites