gobi42 15 Posted July 29, 2014 (edited) So I'm try to set up a trigger that spawns a group of independent soldiers that are a opfor group when a blufor player enters a trigger area. I'm trying to use one script for the 17 checkpoint triggers I have set up. I can get the trigger to call the script, but using the in game editor I haven't figured out how to take the name of my marker and store it in a variable, then pass that variable to the script. My script call looks like this. null=[] execVM "custom\checkpoint. Sqf"; i know to pass the variable I need to put it in the square brackets like ["spawnpos"]. But it doesn't seem to be passing it to my sqf file. When I declare it in the act. Part of the trigger I declare it like this. Spawnpos = spawn1 (this is my marker name), I have also tried "spawn1" but that didn't work either. I'm sure it's a syntax thing I'm missing, any idea's? Thanks Edited July 29, 2014 by gobi42 Share this post Link to post Share on other sites
jshock 513 Posted July 31, 2014 Is the marker the position the independent units will spawn? Share this post Link to post Share on other sites
barbolani 198 Posted July 31, 2014 (edited) editor placed trigger and editor placed marker??? BTW when you are referring to markers, anything must be between brackets, except of course if you assign them to a variable, the variable doesn't need brackets. Example: _myMarker = "MyMarker"; deleteMarker _myMarker; is the same than deleteMarker "MyMarker"; If both are editor ones, just do it by hand. One trigger, one marker, on act of the trigger nul=["nameofthemarker"] execVM "whatever.sqf"; Edited July 31, 2014 by barbolani Share this post Link to post Share on other sites
jshock 513 Posted July 31, 2014 (edited) If I understand this now, just re-read it again and again, you want to spawn a group of units on a marker based on the activation of a trigger, and all you would need to do is something like this: _spawnMrk = (_this select 0); _enemyGroup = [(getMarkerPos _spawnMrk), INDEP, (ConfigFile >> "CfgGroups" >> "INDEP" >> "IND_F" >> "Infantry" >> "HAF_InfSquad")] call BIS_fnc_spawnGroup; With this you put the marker name (i.e. "SpawnPos") in the brackets: nul = ["SpawnPos"] execVM "Script.sqf"; And put that in the trigger onAct field. That would be the entire script, it will spawn a squad of independent soldiers at that marker when the trigger conditions are met. Reference this page for more information on other groups to spawn: https://community.bistudio.com/wiki/BIS_fnc_spawnGroup The (_this select 0) is how you can pass the variables you put in the call brackets into the script. You can look at this page to find out more information on that as well: http://forums.bistudio.com/showthread.php?100559-Beginners-guide-Arrays Edited July 31, 2014 by JShock Share this post Link to post Share on other sites
gobi42 15 Posted July 31, 2014 Thanks guys I've give this a shot when I get a chance. Share this post Link to post Share on other sites
gobi42 15 Posted August 2, 2014 so i got that part working now i have another issue how do i delete the group i made when the player leaves the trigger zone? Share this post Link to post Share on other sites
jshock 513 Posted August 2, 2014 You could try something like this: _leftArea = (_this select 0); _spawnMrk = (_this select 1); if (_leftArea) then {deleteGroup _enemyGroup;} else {_enemyGroup = [(getMarkerPos _spawnMrk), INDEP, (ConfigFile >> "CfgGroups" >> "INDEP" >> "IND_F" >> "Infantry" >> "HAF_InfSquad")] call BIS_fnc_spawnGroup; }; So in the triggers OnAct the call line would look like: nul = [false, "SpawnMrk"] execVM "Script.sqf"; And the OnDeac would be: nul = [true] execVM "Script.sqf"; I think this will work but I'm unsure... Share this post Link to post Share on other sites
gobi42 15 Posted August 2, 2014 That doesn't delete every unit in the group, and groups range for 2 units to 8 units. I need a way to delete them all regardless of size of the group Share this post Link to post Share on other sites
barbolani 198 Posted August 2, 2014 on Deact, assuming you want to despawn AAF units: {unit = _x; if ((side unit == independent) and (unit distance player > sizeofyourtrigger)) then {deleteVehicle unit; if ({alive _x} count (units group unit) == 0) then {deleteGroup group unit};}} forEach allUnits; Share this post Link to post Share on other sites
gobi42 15 Posted August 2, 2014 I got it to work with a simple delete vehicle but I like your idea Barbolani about checking and only deleting the alive units Share this post Link to post Share on other sites
barbolani 198 Posted August 4, 2014 uhm, the snippet I gave you has a failure. It won't despawn units all the units inside the trigger, If they are closer to the player than triggersize,they will keep alive forever, while if the player enters again, it will spawn again units + the non deleted ones. Better use this, inside of a trigger independent, repeatedly, on deact: {unit = _x; if ((side unit == independent) and (unit in thislist)) then {deleteVehicle unit; if ({alive _x} count (units group unit) == 0) then {deleteGroup group unit};}} forEach allUnits; Make sure, the AO is smaller than the trigger size, so the player won't see them spawning and despawning. I make this kind of things with UPSMon, marker size at least half of the triggersize, indeed I don't use triggers I use distance checks to the marker center. Share this post Link to post Share on other sites
gobi42 15 Posted August 5, 2014 Thanks for the update, there is alot I have left to learn but gotta start some where, and thanks for your time Share this post Link to post Share on other sites
CptDezusa 31 Posted April 11, 2017 Hi so the units is spawning in the town even if i'm not around the aria. SpawnZonePU = [ [ [ ( configFile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> "OIA_InfTeam" ), "markerTherisa", "T8u_fnc_rmNVG_TEST" ], [ "PATROL_URBAN" ]] ]; SpawnFerry = [ [ [ ( configFile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> "OIA_InfTeam" ), "markerFerry", "T8u_fnc_rmNVG_TEST" ], [ "PATROL_URBAN" ]] ]; SpawnRautake = [ [ [ ( configFile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> "OIA_InfTeam" ), "markerRautake", "T8u_fnc_rmNVG_TEST" ], [ "PATROL_URBAN" ]], [ [ _groupArrayT_APC, "markerRautake", false ], [ "PATROL_URBAN" ]] ]; // [ _unitsArray, _marker, _owner, _actSide, _distance, _condition, _onAct, _onDeAct ] call T8U_fnc_Zone [ "SpawnZonePU", "markerTherisa", "EAST", "ANY", 200 ] spawn T8U_fnc_Zone; // [ _unitsArray, _marker, _owner, _actSide, _distance, _condition, _onAct, _onDeAct ] call T8U_fnc_Zone [ "SpawnRautake", "markerRautake", "EAST", "ANY", 200 ] spawn T8U_fnc_Zone; // [ _unitsArray, _marker, _owner, _actSide, _distance, _condition, _onAct, _onDeAct ] call T8U_fnc_Zone [ "SpawnFerry", "markerFerry", "EAST", "ANY", 200 ] spawn T8U_fnc_Zone; wil ANY spawn if its a object in the aria ? Share this post Link to post Share on other sites
CptDezusa 31 Posted April 11, 2017 this is a wrong post ..ops :) Share this post Link to post Share on other sites