orb1975 11 Posted March 25, 2020 (VERSION EN ESPAÑOL) Hola chicos! Mi nombre es Omar y soy de Argentina. Este es mi primer posteo, así que desde ya pido disculpas por mi sintaxis y sobre todo por mi inglés que es pobre. 1) Quiero crear un código que se pueda usar en cualquier mapa; no importa si es Stratis, Takistan, Altis, Chernarus, o cualquier otro mapa, oficial y no oficial. 2) Que sea SOLO CODIGO. No quiero que haya ningún elemento u objetos en el mapa en el momento de la edición, a excepción de nuestro personaje. 3) Este código que estará en un archivo SQF debe poder leer todo el mapa y encontrar solo las locaciones "NameVillage", "NameCity" y "Name City Capital", guardando en un Vector todas estas locaciones. 4) Con cada locación que vaya encontrando, deberá agregar en ella, un Gatillo y un Marcador (ambos dos en el mismo lugar, en la zona cero de esa locación). 5) Que ese Gatillo, se active cuando cualquier jugador entre en la zona del gatillo. 6) Que al activarse ese Gatillo, llame a otro archivo SQF. Aquí les muestro lo que llegué a hacer, pero quedo trabado en la parte de activación del gatillo: Hasta aquí llegué. Creo que hice todo bien, pero se me escapa algo, dado que, cuando ejecuto el mapa y entro a un pueblo no se activa ningún gatillo y eso me frustra un poco. Desde ya agradezco mucho por la posible ayuda que pueda recibir de ustedes. Gracias. (MY POOR ENGLISH VERSION) Hello guys! My name is Omar and I am from Argentina. This is my first post, so from now on I apologize for my syntax and especially for my poor English. 1) I want to create a code that can be used on any map; it doesn't matter if it's Stratis, Takistan, Altis, Chernarus, or any other map, official and unofficial. 2) Make it ONLY CODE. I don't want any items or objects to be on the map at the time of editing, except for our character. 3) This code that will be in an SQF file must be able to read the entire map and find only the locations "NameVillage", "NameCity" and "Name City Capital", saving all these locations in a Vector. 4) With each location you find, you must add a Trigger and a Marker to it (both in the same place, at ground zero of that location). 5) That Trigger is activated when any player enters the trigger zone. 6) That when that Trigger is activated, call another SQF file. Here I show you what I got to do, but I get stuck in the trigger activation part: I am done. I think I did everything right, but something escapes me, since when I run the map and enter a town no trigger is activated and that frustrates me a bit. I already thank you very much for the possible help I can receive from you. Thank you. _All_Locations = nearestLocations [getPos player, ["NameVillage","NameCity","NameCityCapital"], 30000]; _Locations_Count = (count _All_Locations); _Counter = -1; // An Array start with cero. for "_i" from 1 to (_Locations_Count) do { _Counter = (_Counter + 1); _Location = _All_Locations select _Counter; // Triggers creation _trigger = createTrigger ["EmptyDetector", getpos _Location]; _trigger setTriggerArea [300, 300, 0, false]; _trigger setTriggerActivation ["ANYPLAYER", "PRESENT", true]; // Markers creation _createdMarker = [str(_Location), _trigger] call BIS_fnc_markerToTrigger; _createdMarker setMarkerShape "ELLIPSE"; _createdMarker setMarkerSize [300,300]; _createdMarker setMarkerColor "ColorOrange"; _createdMarker setMarkerBrush "SolidFull"; _createdMarker setMarkerAlpha 0.5; if (triggerActivated _trigger) then { hintc "TRIGGER ACTIVATED"; null = [] execVM "Mi_Loot_Init.sqf"; }; }; Share this post Link to post Share on other sites
RCA3 593 Posted March 25, 2020 _trigger setTriggerStatements ["this", "[west, 'HQ'] sideChat 'Trigger Activated'; null = [] execVM 'Mi_Loot_Init.sqf';", ""]; Untested... When you're are using : 1 hour ago, orb1975 said: if (triggerActivated _trigger) then { ...your script is just running through the code and _trigger is not activated yet making that part useless. Use setTriggerStatements as above. Share this post Link to post Share on other sites
orb1975 11 Posted March 25, 2020 (edited) 7 minutes ago, RCA3 said: _trigger setTriggerStatements ["this", "[west, 'HQ'] sideChat 'Trigger Activated'; null = [] execVM 'Mi_Loot_Init.sqf';", ""]; Untested... When you're are using : ...your script is just running through the code and _trigger is not activated yet making that part useless. Use setTriggerStatements as above. Thanks dude... this is the new code with your modification, and when i enter in the zone, nothign happend.... no hint, no call, no nothing. Can u test this in your arma? Im in Malden map in Le Port Town. Thanks. _All_Locations = nearestLocations [getPos player, ["NameVillage","NameCity","NameCityCapital"], 30000]; _Locations_Count = (count _All_Locations); _Counter = -1; // An Array start with cero. for "_i" from 1 to (_Locations_Count) do { _Counter = (_Counter + 1); _Location = _All_Locations select _Counter; // Triggers creation _trigger = createTrigger ["EmptyDetector", getpos _Location]; _trigger setTriggerArea [300, 300, 0, false]; _trigger setTriggerActivation ["ANYPLAYER", "PRESENT", true]; if (triggerActivated _trigger) then { _trigger setTriggerStatements ["this", "[west, 'HQ'] sideChat 'Trigger Activated'; null = [] execVM 'Mi_Loot_Init.sqf';", ""] hint "TRIGGER ACTIVATED"; }; // Markers creation _createdMarker = [str(_Location), _trigger] call BIS_fnc_markerToTrigger; _createdMarker setMarkerShape "ELLIPSE"; _createdMarker setMarkerSize [300,300]; _createdMarker setMarkerColor "ColorOrange"; _createdMarker setMarkerBrush "SolidFull"; _createdMarker setMarkerAlpha 0.5; }; Edited March 25, 2020 by orb1975 ortography Share this post Link to post Share on other sites
RCA3 593 Posted March 25, 2020 You misunderstood me: // Triggers creation _trigger = createTrigger ["EmptyDetector", getpos _Location]; _trigger setTriggerArea [300, 300, 0, false]; _trigger setTriggerActivation ["ANYPLAYER", "PRESENT", true]; _trigger setTriggerStatements ["this", "[west, 'HQ'] sideChat 'Trigger Activated'; null = [] execVM 'Mi_Loot_Init.sqf';", ""] 58 minutes ago, orb1975 said: if (triggerActivated _trigger) then { This will never fire. Only at script initialization, never on trigger activation. Delete that. Share this post Link to post Share on other sites
orb1975 11 Posted March 25, 2020 Sorry about that. U are the Man!!!! its working dude! THANKS!!!! 1 Share this post Link to post Share on other sites
Larrow 2820 Posted March 26, 2020 There are a couple of handy BI functions that make trigger/marker based on marker/trigger. eg. // Triggers creation _trigger = createTrigger ["EmptyDetector", getpos _Location]; _trigger setTriggerArea [300, 300, 0, false]; _trigger setTriggerActivation ["ANYPLAYER", "PRESENT", true]; _trigger setTriggerStatements[ "this", "", "" ]; //Replace activation to script call // Markers creation //Create marker based on trigger size and shape _createdMarker = [ str _location, _trigger ] call BIS_fnc_markerToTrigger; _createdMarker setMarkerColor "ColorOrange"; _createdMarker setMarkerBrush "SolidFull"; _createdMarker setMarkerAlpha 0.5; And the opposite BIS_fnc_triggerToMarker 1 1 Share this post Link to post Share on other sites
orb1975 11 Posted March 26, 2020 (edited) This is my code now. Can U show me, your example with this code? Thanks // Creamos los Triggers _trigger = createTrigger ["EmptyDetector", getpos _Location]; _trigger setTriggerArea [300, 300, 0, false]; _trigger setTriggerActivation ["ANYPLAYER", "PRESENT", false]; _trigger setTriggerStatements ["this", "[west, 'HQ'] sideChat 'ESTAS ENTRANDO EN ZONA DE LOOTEO'; null = [] execVM 'Mi_Loot_Init.sqf';", ""]; // Creamos los Marcadores _createdMarker = [str(_Location), _trigger] call BIS_fnc_markerToTrigger; _createdMarker setMarkerShape "ELLIPSE"; _createdMarker setMarkerSize [300,300]; _createdMarker setMarkerColor "ColorOrange"; _createdMarker setMarkerBrush "SolidFull"; _createdMarker setMarkerAlpha 0.5; Thanks dude... Edited March 26, 2020 by orb1975 mistake in the write Share this post Link to post Share on other sites
Larrow 2820 Posted March 26, 2020 1 hour ago, orb1975 said: _createdMarker setMarkerShape "ELLIPSE"; _createdMarker setMarkerSize [300,300]; Just remove these two lines. The function handles size and shape for you by making the marker the same as the trigger. Share this post Link to post Share on other sites
orb1975 11 Posted March 26, 2020 1 minute ago, Larrow said: Just remove these two lines. The function handles size and shape for you by making the marker the same as the trigger. Thanks abaut that! 1).. in your last post you put this _trigger setTriggerStatements[ "this", "", "" ]; //Replace activation to script call i dont know how can i do it. 2) Can u teach me, how can i put a desactivation scritp (example: when the player leave the trigger area). Thanks Share this post Link to post Share on other sites
Harzach 2517 Posted March 26, 2020 The Biki is your friend!setTriggerStatements Quote _trigger setTriggerStatements[ "this", " <ACTIVATION CODE GOES HERE> ", " <DEACTIVATION CODE GOES HERE> " ]; 1 Share this post Link to post Share on other sites
orb1975 11 Posted March 26, 2020 12 minutes ago, Harzach said: The Biki is your friend!setTriggerStatements Thanks dude! Share this post Link to post Share on other sites
orb1975 11 Posted March 26, 2020 3 hours ago, Harzach said: The Biki is your friend!setTriggerStatements Thats the way? Isnt work for me. What is wrong whit this? I cant make it happend with the desactivation part... _trigger setTriggerStatements ["this", "[west, 'HQ'] sideChat 'ESTAS ENTRANDO EN ZONA DE LOOTEO'; null = [] execVM 'Mi_Loot_Init.sqf'", "hint 'ESTAS SALIENDO'"]; Share this post Link to post Share on other sites
Harzach 2517 Posted March 26, 2020 Your trigger must be repeatable, I think. _trigger setTriggerActivation ["ANYPLAYER", "PRESENT", true]; If you don't want it to repeat, you can tack this on the end of the deactivation code: thisTrigger enableSimulation false; 1 Share this post Link to post Share on other sites
orb1975 11 Posted March 26, 2020 1 hour ago, Harzach said: Thanks for your help, i will prove this... I'll tell you later. Share this post Link to post Share on other sites
orb1975 11 Posted March 27, 2020 4 hours ago, Harzach said: Your trigger must be repeatable, I think. _trigger setTriggerActivation ["ANYPLAYER", "PRESENT", true]; If you don't want it to repeat, you can tack this on the end of the deactivation code: thisTrigger enableSimulation false; Dude..this is my code (dont work)... i need to configurate this line: _trigger setTriggerActivation ["ANYPLAYER", "PRESENT", true]; _trigger setTriggerStatements ["this", "[west, 'HQ'] sideChat 'you are in'; null = [] execVM 'Mi_Loot_Init.sqf'", "hint 'you are out'"]; Isnt working (the desactivation red part ), and i dont know why... Share this post Link to post Share on other sites
Harzach 2517 Posted March 27, 2020 Working fine here. Share your full code. Share this post Link to post Share on other sites
orb1975 11 Posted March 27, 2020 5 hours ago, Harzach said: This is the code: _trigger = createTrigger ["EmptyDetector", getpos _Locacion]; _trigger setTriggerArea [300, 300, 0, false]; _trigger setTriggerActivation ["ANYPLAYER", "PRESENT", true]; _trigger setTriggerStatements ["this", "[west, 'HQ'] sideChat 'you are in'; null = [] execVM 'Mi_Loot_Init.sqf'", "hint 'you are out'; {deletevehicle _x} foreach units _Patrulla;"]; the ({deletevehicle _x} foreach units _Patrulla;) part is not working for me dude.... i dont know what happend. Share this post Link to post Share on other sites
Harzach 2517 Posted March 27, 2020 _Patrulla is undefined. Share this post Link to post Share on other sites