HaggisRoll 1 Posted September 29, 2016 Hi Folks. Trying something basic i think for a random IED spawn using garbage. Have trigger and its going off without fail, but i have a couple of issue's i was hoping to get a bit of help with. Here's what i have in my script: // Array of of whats going to go BOOM!! _shellArray = [ "G_40mm_Smoke", "Bo_GBU12_LGB" ]; _shell = _shellArray Call BIS_fnc_selectRandom; // This should select a shell from above and the array will call it randomly. // Whats going to be used as the explosive device??? _explosion = _shell createVehicle position IED ; // IED is a garbage pile placed in the area i want for placement purposes. sleep 2; deleteVehicle IED; --------------------------- Got 2 problems as far as i can tell. 1. The 2nd bomb ie smoke wont go off. if i move it to the top it will and then the 2nd bomb wont go off. 2. I have a few empty markers put down and have them set random start linked to the garbage(IED). But they dont sem to be randomly spawning on mission start. Is there something i'm missing? Please dont say a brain, i know. Thanks for any help given.. Share this post Link to post Share on other sites
Newsparta 1 Posted September 29, 2016 If i am understanding your problem correctly, you wish to have both "_shellArray" variables created on your "IED" position. In the code you have you are only calling one vehicle to be created. You have to make 2 separate createVehicle functions in order to have both spawned also you have a redundant variable. You can call a random shell using only 1 variable more simply _shell = [ "G_40mm_Smoke", "Bo_GBU12_LGB" ] call BIS_fnc_selectRandom; _explosion = _shell createVehicle position IED; sleep 2; deleteVehicle IED; I have tried the code above and it calls one of the two shells randomly however if you want both simultaneously you need _explosion1 = "G_40mm_Smoke" createVehicle position IED; _explosion2 = "Bo_GBU12_LGB" createVehicle position IED; sleep 2; deleteVehicle IED; Share this post Link to post Share on other sites
HaggisRoll 1 Posted September 29, 2016 Thanks for confirming. Seems to be working for me also now. In relation to the random placement of the IED itself. What would be the best way to make it spawn in 1 of 3 locations using markers, or should i be doing it another way? Share this post Link to post Share on other sites
Newsparta 1 Posted September 29, 2016 As for random unless you want it in a very specific location, you can do something like this _spawnLocation = [ getMarkerPos "markerName", // location of marker in the center of desired spawn area 1, // minimum chosen distance from marker 100, // maximum chosen distance from marker 3, // distance from nearest object 0, // not in water 20, // max terrain gradient of 20 0 // does not have to be on shore ] call BIS_fnc_findSafePos; IED = "Land_Garbage_square3_F" createVehicle _spawnLocation; _shell = [ "G_40mm_Smoke", "Bo_GBU12_LGB" ] call BIS_fnc_selectRandom; _explosion = _shell createVehicle position IED; sleep 2; deleteVehicle IED; If you want specific locations you can also just make an array of locations and then call a random location from that, personally I like just using the findSafePos command Share this post Link to post Share on other sites
HaggisRoll 1 Posted September 29, 2016 On 9/29/2016 at 10:37 PM, Newsparta said: As for random unless you want it in a very specific location, you can do something like this _spawnLocation = [ getMarkerPos "markerName", // location of marker in the center of desired spawn area 1, // minimum chosen distance from marker 100, // maximum chosen distance from marker 3, // distance from nearest object 0, // not in water 20, // max terrain gradient of 20 0 // does not have to be on shore ] call BIS_fnc_findSafePos; IED = "Land_Garbage_square3_F" createVehicle _spawnLocation; _shell = [ "G_40mm_Smoke", "Bo_GBU12_LGB" ] call BIS_fnc_selectRandom; _explosion = _shell createVehicle position IED; sleep 2; deleteVehicle IED; Thanks. I will try and use this. Nice. This is the tutorial i was following, but not sure if its able to run due to the age of the vid. He places markers down and then groups them to the IED. When mission starts it selects one randomly to spawn at? https://www.youtube.com/watch?v=bynzzMt7Fg4 Share this post Link to post Share on other sites
Newsparta 1 Posted September 29, 2016 I can't view the video. To be honest, your best bet in mission design is to learn how to make functions and use scripted commands and sqf files for a lot of stuff. using the 3D editor is very nice, but it doesnt offer as much control as an sqf file with scripts. https://community.bistudio.com/wiki/Category:Arma_3:_Functions https://community.bistudio.com/wiki/Category:Scripting_Commands_Arma_3 are great tools for seeing what you can do, as well as these forums for examples of what other people have done or help. 1 Share this post Link to post Share on other sites
davidoss 552 Posted September 29, 2016 Creating ammo generates immediately an explosion. You need to set trigger first. if (isServer) then { // ieds count, change the number to desired one but below markers count private _iedCount = 6; //set markers classnames private _markers = ["m_ied_1","m_ied_2","m_ied_3","m_ied_4","m_ied_5","m_ied_6","m_ied_7","m_ied_8","m_ied_9","m_ied_10"]; //set fake objects classnames private _piles = ["IEDUrbanBig_F","IEDUrbanSmall_F","IEDLandBig_F","IEDLandSmall_F"]; private _iedfake = []; private _trapTriggers = []; for "_i" from 1 to _iedCount do { private _thismarker = selectRandom _markers; _iedfake pushBack createVehicle [selectRandom _piles, getMarkerPos _thismarker, [], 0, 'NONE']; _markers = _markers - [_thismarker]; }; { _trapTriggers pushBack createTrigger ["EmptyDetector", position _x, false]; 0 = [_x, ["<t color='#ff9900'>" + Localize "STR_DMSK_ADDACTION_DISSARM_IED" + "</t>", { 0 = [(_this select 0), (_this select 1)] spawn { params ["_target", "_caller"]; _caller playMove "AinvPknlMstpSnonWnonDnon_medic_1"; sleep 5; deleteVehicle _target; }; },nil,6,true,true,"","(_this distance _target) < 3"]] remoteExec ["addAction", [0,-2] select isDedicated, _x]; } forEach _iedfake; { private _thisObject = ((nearestObjects [position _x, _piles, 10]) select 0); _x setVariable ["rmobj", _thisObject, false]; _x setTriggerArea [1, 1, 360, false, -1]; _x setTriggerActivation ["NONE", "PRESENT", false]; _x setTriggerStatements [" (count ( vehicles select { _x isKindOf 'LandVehicle' && (getNumber (configFile >> 'CfgVehicles' >> (typeOf _x) >> 'side')) == 1 && (_x distance thisTrigger) < 15 } ) > 0) || isNull (thisTrigger getVariable 'rmobj') ", " if (isServer) then { if (!isNull (thisTrigger getVariable 'rmobj')) then { null = [thisTrigger] spawn { params ['_thisTrigger']; private _shellArray = [ 'Bo_GBU12_LGB_MI10', 'Bo_GBU12_LGB', 'Bo_Mk82', 'HelicopterExploSmall', 'M_Mo_82mm_AT_LG', 'HelicopterExploBig', 'M_Air_AA_MI02' ]; private _trap = createVehicle [selectRandom _shellArray, getPos _thisTrigger, [], 0, 'NONE']; private _torem = _thisTrigger getVariable 'rmobj'; {deleteVehicle _x} foreach [_torem, _thisTrigger]; }; } else { deleteVehicle thisTrigger; }; }; ", ""]; } foreach _trapTriggers; }; Share this post Link to post Share on other sites
HaggisRoll 1 Posted September 30, 2016 This seems a bit complex for what i need, but i guess you know what you're doing. I think once i understand whats happening when calling the arrays and functions i'll get it. Just wanted to try something basic enough to understand how its working Share this post Link to post Share on other sites
davidoss 552 Posted September 30, 2016 That is very basic indeed. You need to create some markers where the ieds will possible be. Next you need to update markers array with created markers names and the piles array with class names of the fake objects that will be randomly created. Last execute the code in for example init.sqf. Thats all. What the code does? Creates pile in pos of random marker Creates there a trigger with 15m activation radius When trigger activate create explosion and deletes trigger and pile Share this post Link to post Share on other sites
theend3r 83 Posted September 30, 2016 If you want to place them on roads, use the nearRoads command. For example, I wrote this to create tripwire mines in the Tanoa jungles: _trigger = _this select 0; _number = _this select 1; _triggerW = triggerArea _trigger select 0; _paths = []; { if !( isOnRoad getPos _x || [ "bridge", getModelInfo _x select 0 ] call BIS_fnc_inString ) then { //select only small paths, not roads _nul = _paths pushBack _x; }; } forEach (getPos _trigger nearRoads _triggerW); for "_i" from 1 to _number do { _path = selectRandom _paths; _paths = _paths - [_path]; _mine = createMine ["APERSTripMine", position _path, [], 0]; _closestPath = ([_paths,[],{_path distance _x},"ASCEND"] call BIS_fnc_sortBy) select 0; _direction = [_path, _closestPath] call BIS_fnc_DirTo; _mine setDir _direction; _mine setVectorUp [0,0,1]; }; Share this post Link to post Share on other sites
HaggisRoll 1 Posted September 30, 2016 Thanks for explaining it. Is there a certain way I should join arrays together. What go's first. The bomb or the markers, or does it not make a difference. Share this post Link to post Share on other sites