Results 1 to 3 of 3

Thread: help with spawning distance

  1. #1
    Staff Sergeant hogmason's Avatar
    Join Date
    Mar 30 2012
    Location
    Newcastle, Australia
    Posts
    398

    help with spawning distance

    i use this script

    Code:
    	_dis = 180;
    	_ang = random 360;
    	_dx = sin(_ang)*_dis;
    	_dy = cos(_ang)*_dis;
            _positionToSpawnIn = [((getmarkerpos "taskarea") select 0) + _dx, ((getmarkerpos "taskarea") select 1) + _dy, 0];
    	_armourgrp1 = [getmarkerpos "taskarea", east,["T72_TK_EP1", "BRDM2_ATGM_TK_EP1"],[[-3,-3], [3,3]]]  call BIS_fnc_spawnGroup;
    	[(units _armourgrp1) select 0, "taskarea","spawned","nofollow","random","nowait","delete:",120] execVM "scripts\upsmon.sqf";
    to create manned armor all works fine but they all spawn on top of each other cuasing major destruction and tanks flying in the air lol
    my question is how can i get them to spawn in say a diamater of 190 from the center of the taskarea marker.

    taskarea marker is created by

    Code:
    _Taskarea = createmarker ["taskarea",getpos _task1];
    _Taskarea setmarkershape "ELLIPSE";
    _Taskarea setmarkersize [190,190];
    //"taskarea" setMarkerAlpha 0;  /// unmark to not show
    the whole script just in case it helps

    Code:
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////                                                           ////////////////////////////////////                                                            
    ///////////////////////  Scud Mission Script For Operation HOG SOCOMD Command     /////////////////////////////////////
    //////////////////////                                                           //////////////////////////////////////                                                              
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    if isserver then {
    
    sleep 10; 
    
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //                                                                                                                   //
    //                      ----------      Setup target    ----------                                                   //
    //                                                                                                                   //
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    _task1=task1;
    _name = "MAZ_543_SCUD_TK_EP1" createVehicle getpos _task1;
    
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //                                                                                                                   //
    //                 ----------      Only Allow Satchel To Destroy Target      ----------                              //
    //                                                                                                                   //
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    _name setVehicleInit "_name addEventHandler [""HandleDamage"",{(_this select 4) == ""PipeBomb""}]" ;format ["%1 = this; this setVehicleVarName ""%1""",_unitname];
    processInitCommands;
    
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //                                                                                                                   //
    //                          ----------      Setup Markers       ----------                                           //
    //                                                                                                                   //
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    _Taskarea = createmarker ["taskarea",getpos _task1];
    _Taskarea setmarkershape "ELLIPSE";
    _Taskarea setmarkersize [190,190];
    //"taskarea" setMarkerAlpha 0;  /// unmark to not show
    sleep .5;
    
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //                                                                                                                   //
    //                           ----------      Spawn Enemy       ----------                                            //
    //                                                                                                                   //
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //if ((paramsarray select 19) == 1) then { 
    
    	_upsgrp1 = [1,getmarkerpos "taskarea",1,["taskarea","spawned","random","fortify","nomove","delete:",120]] execVM "SCRIPTS\UPSMON\MON_SPAWN.SQF";
    	sleep .2;
    	_upsgrp1 = [1,getmarkerpos "taskarea",1,["taskarea","spawned","random","fortify","nomove","delete:",120]] execVM "SCRIPTS\UPSMON\MON_SPAWN.SQF";
    	sleep .2;
    	_upsgrp1 = [1,getmarkerpos "taskarea",1,["taskarea","spawned","random","delete:",120]] execVM "SCRIPTS\UPSMON\MON_SPAWN.SQF";
    	sleep .2;
    	_upsgrp1 = [1,getmarkerpos "taskarea",1,["taskarea","spawned","random","delete:",120]] execVM "SCRIPTS\UPSMON\MON_SPAWN.SQF";
    	sleep .2;
    	_upsgrp1 = [1,getmarkerpos "taskarea",1,["taskarea","spawned","random","fortify","nomove","delete:",120]] execVM "SCRIPTS\UPSMON\MON_SPAWN.SQF";
    	sleep .2;
    	_upsgrp1 = [1,getmarkerpos "taskarea",1,["taskarea","spawned","random","delete:",120]] execVM "SCRIPTS\UPSMON\MON_SPAWN.SQF";
    	_dis = 180;
    	_ang = random 360;
    	_dx = sin(_ang)*_dis;
    	_dy = cos(_ang)*_dis;
            _positionToSpawnIn = [((getmarkerpos "taskarea") select 0) + _dx, ((getmarkerpos "taskarea") select 1) + _dy, 0];
    	_armourgrp1 = [getmarkerpos "taskarea", east,["T72_TK_EP1", "BRDM2_ATGM_TK_EP1"],[[-3,-3], [3,3]]]  call BIS_fnc_spawnGroup;
    	[(units _armourgrp1) select 0, "taskarea","spawned","nofollow","random","nowait","delete:",120] execVM "scripts\upsmon.sqf";
    	_dis = 180;
    	_ang = random 360;
    	_dx = sin(_ang)*_dis;
    	_dy = cos(_ang)*_dis;
            _positionToSpawnIn = [((getmarkerpos "taskarea") select 0) + _dx, ((getmarkerpos "taskarea") select 1) + _dy, 0];
    	_armourgrp2 = [getmarkerpos "taskarea", east,["T34_TK_EP1", "BRDM2_ATGM_TK_EP1"],[[-3,-3], [3,3]]]  call BIS_fnc_spawnGroup;
    	[(units _armourgrp2) select 0, "taskarea","spawned","nofollow","random","nowait","delete:",120] execVM "scripts\upsmon.sqf";
    	_dis = 180;
    	_ang = random 360;
    	_dx = sin(_ang)*_dis;
    	_dy = cos(_ang)*_dis;
            _positionToSpawnIn = [((getmarkerpos "taskarea") select 0) + _dx, ((getmarkerpos "taskarea") select 1) + _dy, 0];
    	_armourgrp3 = [getmarkerpos "taskarea", east,["T72_TK_EP1", "LandRover_MG_TK_EP1"],[[-3,-3], [3,3]]]  call BIS_fnc_spawnGroup;
    	[(units _armourgrp3) select 0, "taskarea","spawned","nofollow","random","nowait","delete:",120] execVM "scripts\upsmon.sqf";
    	_dis = 180;
    	_ang = random 360;
    	_dx = sin(_ang)*_dis;
    	_dy = cos(_ang)*_dis;
            _positionToSpawnIn = [((getmarkerpos "taskarea") select 0) + _dx, ((getmarkerpos "taskarea") select 1) + _dy, 0];
    	_armourgrp4 = [getmarkerpos "taskarea", east,["T34_TK_EP1", "BRDM2_ATGM_TK_EP1"],[[-3,-3], [3,3]]]  call BIS_fnc_spawnGroup;
    	[(units _armourgrp4) select 0, "taskarea","spawned","nofollow","random","nowait","delete:",120] execVM "scripts\upsmon.sqf";
    	_dis = 180;
    	_ang = random 360;
    	_dx = sin(_ang)*_dis;
    	_dy = cos(_ang)*_dis;
            _positionToSpawnIn = [((getmarkerpos "taskarea") select 0) + _dx, ((getmarkerpos "taskarea") select 1) + _dy, 0];
    	_armourgrp5 = [getmarkerpos "taskarea", east,["T72_TK_EP1", "LandRover_MG_TK_EP1"],[[-3,-3], [3,3]]]  call BIS_fnc_spawnGroup;
    	[(units _armourgrp5) select 0, "taskarea","spawned","nofollow","random","nowait","delete:",120] execVM "scripts\upsmon.sqf";
    
    
    //};
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //                                                                                                                   //
    //                      ----------      Wait for Target To Be Destroyed       ----------                             //
    //                                                                                                                   //
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
    waitUntil{!alive _name }; 
    
     
    
    ["task1","succeeded"] call SHK_Taskmaster_upd;
    [] call SHK_addTask;
    
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //                                                                                                                   //
    //                                ----------      Clean Up       ----------                                          //
    //                                                                                                                   //
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
    deletemarker "taskarea";
    
    
    
    };

    Operation HOG TaskForce 66 Combat Ops COMING SOON!!! -- CooP x dynamic mission with over 50 different random tasks
    HOG MHQ v1.0
    HOG Mechanic v1.0

  2. #2
    I shall not insult moderators
    Join Date
    Nov 25 2010
    Posts
    1,576
    Specify more relative positions with greater spacing? You only have 2 listed and 3m might not be enough space?
    Last edited by PELHAM; May 28 2012 at 13:23.

  3. #3
    Staff Sergeant hogmason's Avatar
    Join Date
    Mar 30 2012
    Location
    Newcastle, Australia
    Posts
    398
    Author of the Thread
    thanks pelham, that code was given to me so im just working it out ,

    dont spouse you would fill me in on what the bold part below means im asuming the 190,190 are the distances from the taskarea marker. what are the -3

    _armourgrp1 = [getmarkerpos "taskarea", east,["T72_TK_EP1", "BRDM2_ATGM_TK_EP1"],[[-3,-3], [190,190]]] call BIS_fnc_spawnGroup;

Similar Threads

  1. Reveal all enemy units closer then 25m distance to all friendly units in 50m distance
    By Wiggum in forum ARMA 2 & OA : MISSIONS - Editing & Scripting
    Replies: 32
    Last Post: Sep 23 2011, 10:51
  2. Waite until distance this > distance that?
    By Peppy in forum ARMA 2 & OA : MISSIONS - Editing & Scripting
    Replies: 5
    Last Post: Jan 31 2011, 19:24
  3. Any way to set view distance to same view distance in user settings?
    By galzohar in forum ARMA 2 & OA : MISSIONS - Editing & Scripting
    Replies: 0
    Last Post: Jul 31 2009, 22:30
  4. Distance trigger not working after sufficiently large distance
    By xaoslaad in forum ARMA 2 & OA : MISSIONS - Editing & Scripting
    Replies: 3
    Last Post: Jul 14 2009, 15:04
  5. Re Spawning?
    By LukeyJ in forum ARMA - MULTIPLAYER
    Replies: 3
    Last Post: Mar 3 2007, 22:32

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •