febriannas 10 Posted October 17, 2014 isTouchingGround, empty object type "toolkit", count 2, for trigger condition? i want to make a trigger, so when 2 object type "toolkit" is detected on the ground, it will create an action or maybe without the istouchingground thing, how to make condition that will detect "object type" with certain amount (ex;2) of them in the trigger area? Share this post Link to post Share on other sites
dreadedentity 278 Posted October 17, 2014 (edited) ({("ToolKit" in (itemCargo _x))}count (nearestObjects [trgTrigger1, ["GroundWeaponHolder"], triggerRadius])) == 2 Also, try to learn some scripting language. Editor is fun, but you'll see it's limitations soon. Edited October 17, 2014 by DreadedEntity Share this post Link to post Share on other sites
Heeeere's johnny! 51 Posted October 17, 2014 (edited) I don't know what you mean by "toolbox" as there's no such class in the Arma 3 Assets, but anyway, this should work: [color=#FF8040][color=#1874CD]_trigger_toolboxes[/color] [color=#8B3E2F][b]=[/b][/color] [color=#191970][b]createTrigger[/b][/color] [color=#8B3E2F][b][[/b][/color][color=#7A7A7A]"EmptyDetector"[/color][color=#8B3E2F][b],[/b][/color] [color=#191970][b]getPosATL[/b][/color] [color=#000000]player[/color][color=#8B3E2F][b]][/b][/color][color=#8B3E2F][b];[/b][/color] [color=#1874CD]_trigger_toolboxes[/color] [color=#191970][b]setTriggerActivation[/b][/color] [color=#8B3E2F][b][[/b][/color][color=#7A7A7A]"ANY"[/color][color=#8B3E2F][b],[/b][/color] [color=#7A7A7A]"PRESENT"[/color][color=#8B3E2F][b],[/b][/color] [color=#000000]false[/color][color=#8B3E2F][b]][/b][/color][color=#8B3E2F][b];[/b][/color] [color=#1874CD]_trigger_toolboxes[/color] [color=#191970][b]setTriggerStatements[/b][/color] [color=#8B3E2F][b][[/b][/color][color=#7A7A7A]"this && {{(typeOf _x) isEqualTo 'Item_ToolKit'} count thisList >= 2}"[/color][color=#8B3E2F][b],[/b][/color] [color=#7A7A7A]"hintSilent 'It works.'"[/color][color=#8B3E2F][b],[/b][/color] [color=#7A7A7A]""[/color][color=#8B3E2F][b]][/b][/color][color=#8B3E2F][b];[/b][/color][/color] Kudos to Killzone_Kid for his SQF to BBCode Converter. Don't forget to set the other parameters like trigger area and such. Edited October 17, 2014 by waltenberg Share this post Link to post Share on other sites
TKTom 10 Posted October 17, 2014 My version... You will need to change the top line _position = position <some object you want to put the tool kits by>; _position = position player; while {true} do { //hint str _position; _groundEquipmentArray = nearestObjects [_position,["GroundWeaponHolder"],10]; { _added = _x getVariable ["ActionAdded",false]; if !(_added) then { if (({"ToolKit" == _x} count (itemCargo _x))>1) then { _x addAction ["Use Toolkits!",{hint "You used the toolkits!"}]; _x setVariable["ActionAdded",true]; }; }; } forEach _groundEquipmentArray; sleep 1; }; Share this post Link to post Share on other sites
febriannas 10 Posted October 17, 2014 hey guys and walten you always there for me when i need it. that was a type slip,hehe i mean toolkit Share this post Link to post Share on other sites
dreadedentity 278 Posted October 17, 2014 (edited) wrote some more code that will make this extra good ({("Toolkit" in (itemCargo _x)) && {[getPos _x, thisTrigger] call BIS_fnc_inTrigger}}count (nearestObjects [thisTrigger, ["GroundWeaponHolder"], if ((triggerArea thisTrigger) select 0 >= (triggerArea thisTrigger) select 1) then [{(triggerArea thisTrigger) select 0}, {(triggerArea thisTrigger) select 1}]])) == 2 just put that whole thing in the condition for the trigger EDIT: It looks like something is wrong with triggers because this code should work, yet it doesn't. But running it in the debug console shows it works just fine. Triggers broken Edited October 18, 2014 by DreadedEntity Share this post Link to post Share on other sites
Heeeere's johnny! 51 Posted October 17, 2014 (edited) Hmm, counter question: What is wrong with that code? [color=#FF8040][color=#1874CD]_trigger_toolboxes[/color] [color=#8B3E2F][b]=[/b][/color] [color=#191970][b]createTrigger[/b][/color] [color=#8B3E2F][b][[/b][/color][color=#7A7A7A]"EmptyDetector"[/color][color=#8B3E2F][b],[/b][/color] [color=#191970][b]getPosATL[/b][/color] [color=#000000]player[/color][color=#8B3E2F][b]][/b][/color][color=#8B3E2F][b];[/b][/color] [color=#1874CD]_trigger_toolboxes[/color] [color=#191970][b]setTriggerActivation[/b][/color] [color=#8B3E2F][b][[/b][/color][color=#7A7A7A]"ANY"[/color][color=#8B3E2F][b],[/b][/color] [color=#7A7A7A]"PRESENT"[/color][color=#8B3E2F][b],[/b][/color] [color=#000000]false[/color][color=#8B3E2F][b]][/b][/color][color=#8B3E2F][b];[/b][/color] [color=#1874CD]_trigger_toolboxes[/color] [color=#191970][b]setTriggerStatements[/b][/color] [color=#8B3E2F][b][[/b][/color][color=#7A7A7A]"this && {count (thisTrigger nearestObjects [thisTrigger, ['Item_ToolKit'], 10]) >= 2}"[/color][color=#8B3E2F][b],[/b][/color] [color=#7A7A7A]"hintSilent 'It works.'"[/color][color=#8B3E2F][b],[/b][/color] [color=#7A7A7A]""[/color][color=#8B3E2F][b]][/b][/color][color=#8B3E2F][b];[/b][/color] [/color] Kudos and stuff ... The compiler tells me: Error in expression <this && {count (thisTrigger nearestObjects [thisTrigger, [> Error position: <nearestObjects [thisTrigger, [> Error Missing ) But I can't see where I'm missing that ")"... I mean, it's obviously not that, it's probably the "thisTrigger" itself or some weird shit with "nearestObjects" inside a trigger condition, but I have no idea... Edited October 17, 2014 by waltenberg Share this post Link to post Share on other sites
febriannas 10 Posted October 17, 2014 hi guys,dread and walten its still not working guys, the situatation is, i already got a trigger inside the editor, want to place the condition inside it that will check for certain object type "toolkit" with certain amount of it "2" on the ground of area size of the trigger Share this post Link to post Share on other sites
Heeeere's johnny! 51 Posted October 17, 2014 Well, be aware that I usually post code which is intended to be put inside an SQF file and then executed. You'd only need the first string after "setTriggerStatements", but I just realized that the trigger will not fire as it does not detect the toolkits for whatever reason. Further more, the workaround I posted minutes ago produces a strange error which I still can't figure out. To cut it short: Put DreadedEntity's code into your condition part. Honestly, I don't know what his code does :p, but if it doesn't work, ... well, we'll see. Share this post Link to post Share on other sites
febriannas 10 Posted October 17, 2014 wierd.. its not working, maybe any other workaraound for this, dread and walt? Share this post Link to post Share on other sites
Heeeere's johnny! 51 Posted October 17, 2014 (edited) @allReaders, this is NOT a Dread and Johnny exclusive thread, you may still participate and write your mind. ;) Edited November 12, 2014 by Heeeere's Johnny! Share this post Link to post Share on other sites
f2k sel 164 Posted October 17, 2014 (edited) I'm not really sure what your trying to do but if I want to count objects using the trigger condition then I use something like this in the condition _trigger_toolboxes setTriggerStatements ["this && (count nearestObjects [thisTrigger, ['Item_ToolKit'],10]) >=2", "hintSilent 'It works.'", ""]; Not sure if 'Item_ToolKit' is a correct object name as I haven't checked it. Edited October 18, 2014 by F2k Sel Share this post Link to post Share on other sites
TKTom 10 Posted October 18, 2014 Just got to point out that my code is fully working and will do anything that could be done in a trigger... You just need to identify what position you want it on and put the effects in the action. Share this post Link to post Share on other sites
dreadedentity 278 Posted October 18, 2014 I'm not really sure what your trying to do but if I want to count objects using the trigger condition then I use something like this in the condition _trigger_toolboxes setTriggerStatements ["this && (count nearestObjects [thisTrigger, ['Item_ToolKit']],10]) >=2", "hintSilent 'It works.'", ""]; Not sure if 'Item_ToolKit' is a correct object name as I haven't checked it. The problem with this is that dropped items are put into an invisible and empty container called "GroundWeaponHolder" so you have to check for containers, then check the contents. And toolkits are called "ToolKit" (note the capital 'K'). My code did this, and I tested it working in the debug console, but when I added it to a trigger it stopped working, suggesting triggers are broken in some way. Share this post Link to post Share on other sites
f2k sel 164 Posted October 18, 2014 I get it now, your code can't work as intrigger function isn't being called correctly your not passing the name of the trigger in the array. Share this post Link to post Share on other sites
dreadedentity 278 Posted October 18, 2014 your not passing the name of the trigger in the array. Good catch, Sel, I edited the original post with an update, unfortunately it still didn't work when I tested it in the editor. Share this post Link to post Share on other sites