Jump to content

1para{god-father}

Member
  • Content Count

    2047
  • Joined

  • Last visited

  • Medals

Everything posted by 1para{god-father}

  1. I am spawning in a group , but how can I spawn in another group once this one is all dead , and keep going untill a condition is meet ? _grpINF = [_position, EAST, ["TK_INS_Bonesetter_EP1", "TK_INS_Soldier_2_EP1", "TK_INS_Bonesetter_EP1", "TK_INS_Soldier_2_EP1", "TK_INS_Soldier_4_EP1", "TK_INS_Soldier_AT_EP1"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;
  2. If I have an array how can I see what it holds i.e to screen or .RPT ?
  3. I generate some random markers then add the pos to an array , now i need to place men in those marker but how do I do that using my Array, thought the belkow would work but not as they all spawn on the same spot :( i.e Missionmarkers= [[1550,5650,0],[1650,5750,0],[1250,5850,0],[1250,5850,0],[1650,5650,0],[1450,5850,0]] _count = count Missionmarkers; _markertemp = Missionmarkers; for "_i" from 1 to _count do { _spawngroup = [_markertemp select 0, EAST, ["TK_INS_Soldier_MG_EP1"], [],[],[],[],[1,1]] call BIS_fnc_spawnGroup; _markertemp = _markertemp - [_markertemp select 0]; };
  4. 1para{god-father}

    Spawn using Array

    How would i do that then ? i did try but they all spawned @ the samelocation !
  5. 1para{god-father}

    Spawn using Array

    Ahhh that is better way of doing it ! Thanks
  6. Trying to undestand why my code will not work after I run another .SQF does it simply stop and wait untill that code is completed then carry on the code ? can i get round that ? example.sqf Some code i.e create markers etc... all runs correct then i run another SQF as below that is a loop to check things null = [] execVM "checkloop.sqf"; HINT "THIS will never work ???""" I never grt to see the hint , or any code below the null = [] execVM "checkloop.sqf";
  7. 1para{god-father}

    Advice on running another .sqf from a .sqf

    OK it is working ! I forgot to try without null = So it was waiting for a return value - thanks guys know I know !
  8. OK i have alot of marker zones on my map and have selected a random one, now I need to place a VIP in one of those zones but need it in a house So i thought i would use CBA_fnc_getNearestBuilding I get the following returnedf to use:- [e78f200# 48009: house_k_1_ep1.p3d,6] But now I am stuck how can I now use that to move my VIP into in? I know this example has 6 positions, so how could I random is the position as well? VIP is called vip1 Or is there a easier way , thought i would use CBA as it is installed Thanks
  9. 1para{god-father}

    Advice on running another .sqf from a .sqf

    Thanks, I am running it with showScriptErrors - and get no error at all. Also looked at my .RPT and nothing these as well, well not to do with this. so very confused, as it will not carry on after I start this script. checkloop.sqf mymissionmarkers is array of marker names (this all works BTW) private["_temvariable","_cv","_sc","_vardone","_vardone2","_objects","_marker","_eastside","_westside"]; missioncomp = 0; while {missioncomp == 0} do { _temvariable = []; {if ((count (nearestObjects [(getmarkerpos _x),["MAN"],50])) > 0) then {_temvariable = _temvariable + [_x]};} foreach mymissionmarkers; sleep 0.1; _cv = count _temvariable; if (_cv > 0) then { _sc = 0; _vardone2 = 0; while {_vardone2 == 0} do { if (_sc < _cv) then { _marker = _temvariable select _sc; _objects = nearestObjects [(getmarkerpos _marker),["MAN"],50]; _westside = []; _eastside = []; {if (side _x == WEST) then {_westside = _westside + [_x]};} foreach _objects; {if (side _x == EAST) then {_eastside = _eastside + [_x]};} foreach _objects; if ((count _westside) > (count _eastside)) then { _marker setMarkerColorLocal "ColorGreen"; _marker setMarkerAlphaLocal 0.9; } else { if (count _eastside > 0) then { _marker setMarkerColorLocal mymarkercolour; _marker setMarkerAlphaLocal 0.9; }; }; _sc = _sc + 1; } else { _vardone2 = 1; }; }; }; sleep 0.1; _temvariable = []; {if ((getMarkerColor _x) == "ColorGreen") then {_temvariable = _temvariable + [_x]};} foreach mymissionmarkers; _cv = count _temvariable; if (_cv == (count mymissionmarkers)) then { missioncomp = 1; }; }; {deletemarker _x} foreach mymissionmarkers; mymissionmarkers =[];
  10. 1para{god-father}

    CBA_fnc_getNearestBuilding confused

    Thanks but mymissionmarkers is generated as below, so am i going wrong there then if so what would i need to do to get rid of thoes extra "" ? _houses = [markerpos _marker,700, 2, true] call findHouses; { _pos = _x call getGridPos; _mkr = str _pos; if (getMarkerPos _mkr select 0 == 0) then { _mkr = createMarkerLocal[_mkr, _pos]; _mkr setMarkerShapeLocal "RECTANGLE"; _mkr setMarkerTypeLocal "SOLID"; _mkr setMarkerSizeLocal [50,50]; _mkr setMarkerAlphaLocal 0.9; _mkr setMarkerColorLocal mymarkercolour; [color="#FF0000"]mymissionmarkers set [count mymissionmarkers,_mkr];[/color] }; } forEach _houses;
  11. 1para{god-father}

    CBA_fnc_getNearestBuilding confused

    Ahhh FAB works :) And I understand why, I was using select 1 to put him in the building forgot to start at select 0 ! Thanks ----------------------------------------------- Any idea why this will not work ? Working fine if I set _obj _grp = createGroup RESISTANCE; _pilot = _grp createUnit ["GUE_Soldier_Pilot", _RandomTownPosition, [], 10, "FORM"]; _randomlocation= (mymissionmarkers) call BIS_fnc_selectRandom; _obj = [5250,4750,0] call CBA_fnc_getNearestBuilding; _house = _obj select 0; _housepos = floor (random (_obj select 1)); _pilot setPos (_house buildingPos _housepos); Not working but it is using the same thing only a randon location now mymissionmarkers has the following : - ["[4150,11750,0]","[4150,11850,0]","[4250,11850,0]","[4250,11750,0]","[4150,11450,0]","[3950,11350,0]"] _randomlocation = mymissionmarkers call BIS_fnc_selectRandom; // returns [2050,250,0] in .rpt _grp = createGroup RESISTANCE; _pilot = _grp createUnit ["GUE_Soldier_Pilot", _RandomTownPosition, [], 10, "FORM"]; _obj = _randomlocation call CBA_fnc_getNearestBuilding; _house = _obj select 0; _housepos = floor (random (_obj select 1)); _pilot setPos (_house buildingPos _housepos); .rpt Error in expression <ivate ["_building", "_i"]; _building = nearestBuilding _this; _i = 0; while {s> Error position: <nearestBuilding _this; _i = 0; while {s> Error nearestbuilding: Type String, expected Array,Object
  12. OK I have managed to make some markers at a random town which are over buildings. Now I need a way of changing theses, marker to a different colour / or removing them once a condition is meet i.e no opfor or variable = true. So one of the markers changes colour not all etc.. Creating markers follows:- private ["_mkr","_var","_pos","_houses"]; /// get all houses in location////// _houses = [markerpos "taskarea1",600, 3, true] call findHouses; { _pos = _x call getGridPos; _mkr = str _pos; if (getMarkerPos _mkr select 0 == 0) then { _mkr = createMarkerLocal[_mkr, _pos]; _mkr setMarkerShapeLocal "RECTANGLE"; _mkr setMarkerTypeLocal "SOLID"; _mkr setMarkerSizeLocal [50,50]; _mkr setMarkerAlphaLocal 0.6; _mkr setMarkerColorLocal "ColorGreen"; }; } forEach _houses;
  13. 1para{god-father}

    How to list ARRAY ?

    Perfect thanks guys !
  14. Trying to get a case statement to work. So depending on the color of mymarkercolour I should get the Correct Hint but i do not get anything ? where am i going wrong ? mymarkercolour = ["ColorRed","Coloryellow","ColorGreen","ColorBlue","ColorOrange","ColorRedAlpha","ColorKhaki","ColorBrown","ColorPink"] call BIS_fnc_selectRandom; switch (mymarkercolour) do { case "ColorRed": { hint "Red marker"; }; case "Coloryellow": { hint "yellow"; }; case "ColorGreen": { hint "green"; }; case "Colororange": { hint Orange"; }; case "ColorRedAlpha": { hint "ColorRedAlpha"; }; case "ColorKhaki": { hint "ColorKhaki"; }; case "Colorbrown": { hint "brown"; }; case "Colorpink": { hint "Pink"; }; };
  15. 1para{god-father}

    Case statement Advise

    Ahhhhh thanks Cruel did not spot that I did not get any error which was strange !
  16. Dug this out from a convoy script i used in the past always worked for me might help ?! set to 4000 apart you can change to what ever distance if(!isServer) exitWith{}; _cid = floor(random 10000); _task16 = format["Convoy Start%1",_cid]; /// get town locations _towns = nearestLocations [getPosATL player, ["NameVillage","NameCity","NameCityCapital"], 25000]; ///start location spawn point _pos1 = position (_towns select (floor (random (count _towns)))); _RandomTownPosition1 = [_pos1 select 0,_pos1 select 1,0]; _nRoads = _RandomTownPosition1 nearRoads 10; _rng = 10; while {((count _nRoads) == 0)} do { _rng = _rng * 2; _nRoads = _RandomTownPosition1 nearRoads _rng; }; _RandomTownPosition1 = position (_nRoads select (floor (random (count _nRoads)))); /// convoy end destination _towns = nearestLocations [_RandomTownPosition1, ["NameVillage","NameCity","NameCityCapital"], 25000]; _RandomTownPosition2 = _RandomTownPosition1; { if (((position _x) distance _RandomTownPosition2) > 4000) exitwith {_RandomTownPosition2 = [(position _x) select 0,(position _x) select 1,0]} } foreach _towns; _nRoads = _RandomTownPosition2 nearRoads 10; _rng = 10; while {((count _nRoads) == 0)} do { _rng = _rng * 2; _nRoads = _RandomTownPosition2 nearRoads _rng; }; _RandomTownPosition2 = position (_nRoads select (floor (random (count _nRoads)))); _t = format["Convoy Start%1",_cid]; [_t, _RandomTownPosition1, "Icon", [1,1], "TEXT:", _t, "TYPE:", "Start", "COLOR:", "ColorGreen", "GLOBAL", "PERSIST"] call CBA_fnc_createMarker; _t = format["Convoy End%1",_cid]; [_t, _RandomTownPosition2, "Icon", [1,1], "TEXT:", _t, "TYPE:", "End", "COLOR:", "ColorRed", "GLOBAL", "PERSIST"] call CBA_fnc_createMarker; ////////////////maker CONVOY///////////////////////// ///spawn vehicle _grp = creategroup EAST; _veh1 = ( [_RandomTownPosition1, 001, "Offroad_DSHKM_INS", east] call bis_fnc_spawnvehicle ) select 0; _veh2 = ( [_veh1 modelToWorld [0,10,0], 001, "SUV_TK_EP1", east] call bis_fnc_spawnvehicle ) select 0; ////move vip2 on map into SUV////// vip2 moveInCargo _veh2; vip2 assignAsCargo _veh2; _veh3 = ( [_veh2 modelToWorld [0,10,0], 001, "Offroad_DSHKM_INS", east] call bis_fnc_spawnvehicle ) select 0; _veh4 = ( [_veh3 modelToWorld [0,10,0], 001, "Offroad_DSHKM_INS", east] call bis_fnc_spawnvehicle ) select 0; (units _veh1 + units _veh2 + units _veh3 + units _veh4) joinSilent _grp;
  17. WOW many thanks that will help a lot !! All works Great now ! Next question:- 1) how would I go about deleting the markers once the task is complete? 2) how can i get a list of the array and select say 50% so i can use them to spawn in some groups? Thanks for all your help guys !
  18. Sorry guys but really having issues and need some Expert help as this is a bit over my head :) My mission generates the markers but I need help on the following:- 1) How do I reference the markers so i can use them later to spawn stuff into , and Delete them all once mission has finished 2) How can I change the color of markers when bluefor enter a marker and no opfor are in the marker, and change it back once Opfor enter it again. Task1.sqf private ["_mkr","_var","_pos","_houses"]; mymissionmarkers = []; _gamelogic = center; _towns = nearestLocations [getPosATL _gamelogic, ["NameVillage","NameCity","NameCityCapital"], 25000]; _RandomTownPosition = position (_towns select (floor (random (count _towns)))); _marker = createMarker [format ["mrk%1",random 100000],_RandomTownPosition]; sleep .2; _houses = [markerpos _marker,600, 3, true] call findHouses; { _pos = _x call getGridPos; _mkr = str _pos; if (getMarkerPos _mkr select 0 == 0) then { _mkr = createMarkerLocal[_mkr, _pos]; _mkr setMarkerShapeLocal "RECTANGLE"; _mkr setMarkerTypeLocal "SOLID"; _mkr setMarkerSizeLocal [50,50]; _mkr setMarkerAlphaLocal 0.5; }; mymissionmarkers set [count mymissionmarkers,_mkr]; } forEach _houses; diag_log format[mymissionmarkers, time]; ///Spawn some OPFOR in to some markers get number of markers then use a % of marker to pop////// [color="#FF0000"] _grpOpfor1 = [getmarkerpos xxxx???xxxxxx, EAST, (configFile >> "CfgGroups" >> "EAST" >> "BIS_TK_INS" >> "Infantry" >> "TK_INS_Group")] call BIS_fnc_spawnGroup; [_grpOpfor1, getMarkerPos xxxxx???xxxxxx, 100] call bis_fnc_taskPatrol;[/color] //// Now i need to keep track of markers if no opfor are in markers and bluefor enter change color of marker
  19. Thanks guys:- Never used arrays before so how would I store the markersif generating a lot of them , see Red below is that correct ? [color="#FF0000"]mymissionmarkers = [];[/color] private ["_mkr","_var","_pos","_houses"]; /// get all houses in location////// _houses = [markerpos "taskarea1",600, 3, true] call findHouses; { _pos = _x call getGridPos; _mkr = str _pos; if (getMarkerPos _mkr select 0 == 0) then { _mkr = createMarkerLocal[_mkr, _pos]; _mkr setMarkerShapeLocal "RECTANGLE"; _mkr setMarkerTypeLocal "SOLID"; _mkr setMarkerSizeLocal [50,50]; _mkr setMarkerAlphaLocal 0.6; _mkr setMarkerColorLocal "ColorGreen"; }; [color="#FF0000"] // would I add it here if so is this correct ? mymissionmarkers = mymissionmarkers +_mkr;[/color] } forEach _houses;
  20. Yep taken from Insurgency and just tweaked to just do a random town. I did think about 1 trigger but it will not work on what i am trying to accomplish as I need the separate markers to change colour or be removed. Just cannot work out how to Ref them?
  21. But how would I know which one to change and how would it check all the time? i.e say it has 6 markers all red bluefor enter 1 marker and there is No Opfor in that marker ,how can i change it to blue ?
  22. 1para{god-father}

    Create markers sround a random town

    Owww nice one that is great so far ! So I have a random Town, and a grid over the town , now I need is to work out how big the grid should be to cover the town and houses. Anyone have any idea how to work that out as I need to cover the whole town and surrounding building within say 200 away if (isServer) then { _gamelogic = center; _towns = nearestLocations [getPosATL _gamelogic, ["NameVillage","NameCity","NameCityCapital"], 25000]; _RandomTownPosition = position (_towns select (floor (random (count _towns)))); _marker = createmarker ["taskarea",_RandomTownPosition]; _center = markerpos "taskarea"; _size = 4; // 4x4 50m markers _x = (((_center select 0)-((_center select 0)mod 100))-50); _y = (((_center select 1)-((_center select 1)mod 100))-50); _origy = _y; for "_a" from 0 to _size-1 do { _pos = [_x,_y]; _m=createMarker [format ["mrk%1",random 100000],_pos]; _m setMarkerShape "RECTANGLE"; _m setMarkerSize [50,50]; _m setMarkerBrush "SolidBorder"; _m setMarkerAlpha 0.2; _m setMarkerColor "ColorRed"; for "_b" from 0 to _size-2 do { _y = _y + 100; _pos = [_x,_y]; _m=createMarker [format ["mrk%1",random 100000],_pos]; _m setMarkerShape "RECTANGLE"; _m setMarkerSize [50,50]; _m setMarkerBrush "SolidBorder"; _m setMarkerAlpha 0.2; _m setMarkerColor "ColorRed"; }; _y = _origy; _x = _x + 100; }; };
  23. Hi Guys, I need a way to create some zones around a random Village like insurgency markers, not 1 big marker but say 5-10 depending on size of the town , anyone point me in the right direction or has done something like this before. Thanks
  24. This might help, I use it all the time to put guys in buildings example : //spawn group _grpbuild1 = [getmarkerpos "xx", RESISTANCE, (configFile >> "CfgGroups" >> "Guerrila" >> "GUE" >> "Infantry" >> "GUE_InfSquad")] call BIS_fnc_spawnGroup; //Place in buildings _grpbuild1 execVM "PlaceInBuilding.sqf"; That will then place them in random Buildings you can change the _check_distance to what you like PlaceInBuilding.sqf /* ================================================== ======================== Place infantry groups in buildings script Place group leader near building of choice, then: syntax for scripts: group execVM "PlaceInBuilding.sqf" syntax for init field for the leader of the desired group: _script = group this execVM "PlaceInBuilding.sqf" Extra info: - Removes hand grenades, otherwise dumb infantry try and throw a grenade from inside a building and frag themselves - Will delete group if no building position is found - Buildings id being searched near group leader's position - All members of the group are each joined into another newly created groups to prevent them from getting back into formation - You can change _check_distance variable to change search distance for entrable buildings ================================================== ======================== ================================================== ======================== */ if (isServer) then { _mode = ["YELLOW", "RED"] call BIS_fnc_selectRandom; _grp setBehaviour "AWARE"; _grp setCombatMode _mode; }; _group = _this; _leader = leader _group; _check_distance = 100; // Change this to tweak building searching distance _arr_buildings = nearestObjects [_leader, ["HOUSE"], _check_distance]; _buildingcount = count _buildings; _arr_positions = []; { _i = 0; _positions_checked = FALSE; while {not _positions_checked} do { _position = _x buildingPos _i; _coord_x = _position select 0; _coord_y = _position select 1; _coord_z = _position select 2; _coord_sum = _coord_x + _coord_y + _coord_z; if (_coord_sum == 0) then { _positions_checked = TRUE; } else { _arr_positions = _arr_positions + [_position]; _i = _i + 1; }; }; } foreach _arr_buildings; { _newgroup = createGroup side _leader; [_x] join _newgroup; if (count _arr_positions == 0) then { deleteVehicle _x; }; _position = _arr_positions select random count _arr_positions; _x setPos _position; _x setDir random 360; _x removeWeapon "HandGrenade_East"; _x removeMagazines "HandGrenade_East"; _x removeWeapon "HandGrenade_West"; _x removeMagazines "HandGrenade_West"; _x removeWeapon "HandGrenade"; _x removeMagazines "HandGrenade"; _x setUnitPos "UP"; } foreach units _group;
  25. NP, Ill take a look tonight and send it back :) OK just had a look , and it works for me !? I removd the call compile preprocessFileLineNumbers "scripts\Init_UPSMON.sqf"; inm Missis Init as you do not need ocallit again. They spawn @ 0,0,0 then move to the marker as they should , what results are you getting ?
×