Jump to content

sabot10.5mm

Member
  • Content Count

    124
  • Joined

  • Last visited

  • Medals

Everything posted by sabot10.5mm

  1. i would like to create a function that gets all hill locations and randomly selects a range of locations that are 2000 meters apart. could someone help me with this? really appreciate it. _nearbyLocations = nearestLocations [position player, ["hills"], 25000]; select a random range of 1 to 4 locations that are at least > 2000 meters apart return the value
  2. i want a way of randomly selecting 4 hills that are 2000 meters apart. the way I'm doing it now is, manually putting down objects on the map and randomly selecting a hill in a 2000 meter radius. instead of having to place objects down as a reference, i would rather have a function find random hill at least 2000 meters apart
  3. generic error in expression |#|sleep 2; error missing ; if (!(count _nearLoc ==0)) then {hint "Array contains things"}; else |#|{hint "array is empty";}; what I'm trying to do is, if the player is 100 from nearest location - spawn ai 10% chance ever 5 second. _myGroup = group player; _RanNum = ""; _position = getPos player; _nearLoc = nearestLocations [position player, ["NameCity","FlatAreaCity"], 100]; hint format ["city %1",_nearloc]; sleep 2; while {true} do { _RanNum = floor random 10; if (!(count _nearLoc ==0)) then {hint "Array contains things"}; else {hint "array is empty";}; if (_RanNum = 0) then {_tempSoldier = _myGroup createUnit [ "B_Protagonist_VR_F", _position, [], 0, "NONE" ];}; sleep 5; }; may of answered one of my questions if (!(count _nearLoc ==0)) then {hint "Array contains things"}; else |#|{hint "array is empty";}; ";"is ending the statement too soon? another question though. if i generate a random number and i want a condition to be true if the randomly gen number is 0 - would if (_ranNum = 0) work for that purpose? finished script script to randomly spawn infantry or motorized units around the player if atleast 500 meters away from cities or airports
  4. sabot10.5mm

    [solved] script syntax help

    not the best coding skills but I'm trying. spawns radio tower when near hills and creates objective. spawns roadblock when near roads. spawns troop patrols when away from any location _spwmgrp = compile preprocessfilelinenumbers "scripts\fn_spwngrp.sqf"; private ["_cargo","_ANIM","_grpBul","_grpBul1","_grpSpwn","_tower","_marker","_pPos","_locPos","_loc1","_task1","_ofr1","_fndLoc","_nearest","_CaseCnt"]; // loop sleep 5; //systemChat "loop start"; _grps =[]; _mgguys = []; _cargo = objnull; while {true} do { _grps = []; _grpBul = false; _grpBul1 = false; _threshold = 3000; _nearest = []; _fndLoc = ""; _loc1 = 0; _CaseCnt = 99; _locPos = player getPos [300,random (120)-60]; _pPos = getPos player; if (count (nearestLocations [_pPos, ["NameCity","NameLocal","NameCityCapital"], 600]) == 0) then { {if( player distance _x < _threshold) exitWith {_nearestpos = getpos _x; _nearest append _nearestpos;};} forEach [radio1,radio2,radio3,radio4]; _nearest; hint "1"; if !(count (_nearest)==0) then {_fndLoc = (selectrandom (nearestLocations [_nearest, ["hill"], 1999])); hint "2"; _locPos = locationPosition _fndLoc; if (player inArea [_locPos, 3000, 3000, 45, false, 3000]) then { _loc1 = _fndLoc; _CaseCnt = 0;};}; _fndLoc = player nearRoads 330; if (count (_fndLoc) > 0 && _CaseCnt == 99) then {_CaseCnt = 1; _loc1 = _fndLoc select 0; _locPos = getpos _loc1;}; systemChat format ["UAV:%1",_CaseCnt]; hint "3"; switch (_CaseCnt) do { case 0: { hint "1.1"; systemChat format ["UAV:%1 %2",_fndLoc,_loc1]; _randPos = [_locPos , 0, 200, 12, 0, 0.4, 0] call BIS_fnc_findSafePos; if (((_randPos distance _locPos) > 210)) then {_randPos = [_locPos , 0, 200, 12, 0, 0.6, 0] call BIS_fnc_findSafePos;}; _cargo = "Land_Cargo_HQ_V1_F" createVehicle _randPos; //***tower _randPos2 = [_locPos , 20, 100, 0, 0, 0.6, 0] call BIS_fnc_findSafePos; _tower = "Land_TTowerBig_2_F" createVehicle _randPos2; _tower setVectorUp surfaceNormal position _tower; _tower setVectorUp [0,0,1]; // Make sure the tower is not leaning. //*** Task for player task1 = player createSimpleTask ["Destroy the Cell Tower"]; task1 setSimpleTaskDescription ["The Enemy are using the Antenna for Propaganda Purposes, it needs to be Destroyed","Destroy Antenna","Destroy Antenna"]; task1 setsimpletaskdestination _randPos2; task1 setTaskState "Assigned"; player setCurrentTask task1; if (true) then{ _tower addEventHandler ["Killed", {["task1", "Succeeded"] call BIS_fnc_taskSetState; ;}];}; _towerbox = "Land_spp_Transformer_F" createVehicle _randPos2; _towerbox setVectorUp surfaceNormal position _towerbox; _towerbox setVectorUp [0,0,1]; _towerbox2 = "Land_TTowerSmall_1_F" createVehicle _randPos2; _towerbox2 setVectorUp [0,0,1]; _tower setVehicleVarName "tower1"; tower1 = _tower; _genny = _tower getRelPos [7, 9]; //*** bunkers _randPos12 = _cargo getRelPos [105, 180]; _randPos121 =[_randPos12 , 20, 100, 5, 0, 0.4, 0] call BIS_fnc_findSafePos; if (((_randPos121 distance _randPos) > 201)) then {_randPos121 = _randPos12}; _bunker1 = "Land_BagBunker_Small_F" createVehicle _randPos121; _bunker1 setVectorUp surfaceNormal position _bunker1; _randPos13 = _cargo getRelPos [105, 0]; _randPos131 =[_randPos13 , 20, 100, 5, 0, 0.4, 0] call BIS_fnc_findSafePos; if (((_randPos131 distance _randPos) > 201)) then {_randPos131 = _randPos13}; _bunker2 = "Land_BagBunker_Small_F" createVehicle _randPos131; _bunker2 setDir 180; _randPos14 = _bunker2 getRelPos [0, 0]; _bunker2 setVectorUp surfaceNormal position _bunker2; _mg13 = createVehicle ["O_HMG_01_high_F", _randPos14, [], 0, "CAN_COLLIDE"]; _randPos15 = _bunker1 getRelPos [0, 180]; _mg14 = createVehicle ["O_HMG_01_high_F", _randPos15, [], 0, "CAN_COLLIDE"]; _bnkrOcup = [_locPos, EAST, ["O_Soldier_F","O_Soldier_F","O_Soldier_F"],[],[],[],[],[],232] call BIS_fnc_spawnGroup; _grps pushBack _bnkrOcup; systemChat format ["UAV: Enemy Antenna Spotted %1 Degrees",floor(player getDir _tower)]; ((units _bnkrOcup) select 0) moveInGunner _mg13; ((units _bnkrOcup) select 1) moveInGunner _mg14; _mg14 setDir 180; _ofr1 = ((units _bnkrOcup) select 2); _ofr1 setPosATL (_cargo buildingPos 4); _ofr1 disableAI "PATH"; _ofr1 addEventHandler ["Killed", {player addRating 3000; _score = rating player; systemChat format ["Player Score %1 ",_score];}]; //*** create HQ Marker _marker = createMarkerLocal ["opfor_hq.", position player ]; _marker setMarkerPos _randPos; _marker setMarkerShape "ICON"; _marker setMarkerColor "ColorOPFOR"; _marker setMarkerType "loc_Bunker"; _marker setMarkerText "Enemy CP"; _marker setMarkerSizeLocal [2.5, 2.5]; }; case 1: { hint "2.2"; _roadsSorted = [_fndLoc,[],{_loc1 distance _x},"ASCEND"] call BIS_fnc_sortBy; systemChat format ["UAV:%1 %2",_fndLoc,_loc1]; _nearestRoad = _roadsSorted select 0; _roadConnectedTo = roadsConnectedTo _nearestRoad; _connectedRoad = _roadConnectedTo select 0; _roadCenter = getPos _nearestRoad; _cargo = _roadCenter; _roadDir = [_nearestRoad, _connectedRoad] call BIS_fnc_DirTo; //***roadblock _bunker1 = "Land_BagBunker_Small_F" createVehicle _roadCenter; _bunker1 setDir _roadDir; _bunkerpos = _bunker1 getRelPos [10, 90]; _bunker1 setpos _bunkerpos; _bunker1 setVectorUp surfaceNormal position _bunker1; _gate = "Land_BarGate_F" createVehicle _cargo; _gate setDir _roadDir; _gate setpos [(getpos _gate select 0)+4,getpos _gate select 1, getpos _gate select 2]; _randPos15 = _bunker1 getRelPos [0, 0]; _mg14 = createVehicle ["O_HMG_01_high_F", _randPos15, [], 0, "CAN_COLLIDE"]; _bnkrOcup = [_locPos, EAST, ["O_Soldier_F","O_Soldier_F"],[],[],[],[],[],232] call BIS_fnc_spawnGroup; _grps pushBack _bnkrOcup; _ANIM = (units _bnkrOcup) select 1; _AnimPos = _gate getRelPos [6, 90]; _ANIM setpos _AnimPos; ((units _bnkrOcup) select 0) moveInGunner _mg14; [_ANIM, "WATCH2", "RANDOM"] call BIS_fnc_ambientAnimCombat; _ANIM addeventhandler ["AnimChanged", { if (behaviour ((units _bnkrOcup) select 0) == "combat") then { (_this select 0) call BIS_fnc_ambientAnim__terminate; (_this select 0) removeAllEventHandlers "AnimChanged";}}]; _mg14 setDir _roadDir - 180; }; }; waituntil {sleep 5; ((player distance _locPos) < 800) or ((player distance _locPos) > 3001) }; _grps = [_CaseCnt,_cargo] call _spwmgrp; _grp0 = _grps select 0; _grp1 = ((units _grp0) select 0); _grp1Ldr = getPos _grp1; waitUntil {sleep 5;((player distance _grp1Ldr) > 900)}; sleep 3; {{deleteVehicle _x} forEach units _x}foreach _grps; if (_CaseCnt == 0) then { _objs = nearestObjects [_grp1Ldr, ["Building","StaticWeapon"], 410]; {deleteVehicle _x} forEach _objs; player removeSimpleTask task1; deleteMarker _marker; _tower removeAllEventHandlers "killed"; _ofr1 removeAllEventHandlers "killed"; }; if (_CaseCnt == 1) then { _ANIM call BIS_fnc_ambientAnim__terminate; _objs = nearestObjects [_grp1Ldr, ["Building","StaticWeapon"], 410]; {deleteVehicle _x} forEach _objs; }; sleep 1; {deleteGroup _x} forEach allGroups; _cargo = objnull; }; sleep 10; }; fn_spwngrp.sqf params[ ["_CaseCnt", 99,[]] , ["_cargo",[objNull,[]]]]; for "_i" from 1 to 4 do { _Xrnd = random [20,80,200]; _Xrnd1 = random [250,250,500]; if !(_CaseCnt == 99) then [{_grpSpwn = _cargo getPos [_Xrnd,random (360)]} , {_grpSpwn = player getPos [_Xrnd1,random (120)-60]}]; _mot = "UInfantry"; _rnFr = selectRandomWeighted ["Infantry",0.3,"UInfantry",1]; _rnSq = if (_rnFr == _Mot) then [ {"OIA_GuardSentry"} , {selectRandomWeighted ["OIA_InfTeam",4,"OIA_InfTeam_AT",0.4,"OIA_InfTeam_AA",0.2]} ]; _grp = [_grpSpwn ,EAST,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> _rnFr >> _rnSq)] call BIS_fnc_spawnGroup; [_grp,_grpSpwn,150] call bis_fnc_taskPatrol; _grps pushBack _grp; sleep 0.35; }; //systemChat format ["**%1 **%2",_grpBul,_grpBul1]; _grps
  5. sabot10.5mm

    enemies spawning as objects

    Maybe dynamic simulation is stewing it up Dynamic Simulation is a feature that extends the possibilities to define and control object simulation. It's goal is to allow designer to increase number of objects and AI units that can be present in the mission without destroying game performance. This is achieved by selectively simulating only what is needed. Features Affects both SP and MP scenarios. Can be selectively applied to entities and groups. Easy to setup. Silent background operation; no lag spikes or fps drops. Limitations No line of sight detection; designer needs to make sure player cannot see transition between enabled/disabled states. No support for moving entities; entities will stop moving when disabled. No backward compatibility with other older systems like are the scripted Sites or FPS Manager
  6. when looking at your updateArsenal it requires a whitelist? ""WEST"" and fn_createlist adds gear by side, I don't see how it would add all gear [AirHQ1, "Arsenal", [ WEST, blacklist1 ], false ] call LARs_fnc_updateArsenal; fn_createlist case ( typeName sideUnknown ) : { //Add sides gear to the list _newList = _newList + ( LARs_sideGear select ( _x call BIS_fnc_sideID )); }; look here. no weapon item accessories in allgear lasers scopes bipods copytoclipboard srt Lars_allGear LARs_sideGear does though anyways. That "if _whitelist true" I wrote above works for what I need. Only thing I ran into was sidegear doesn't find addon mod weapons. So what I did was "_whitelist = _oldwhite + blacklist1" blacklist1 has all weapons including modded
  7. omg it works!!! I made this at work and thought- naa this isn't the way you do it. ah i feel so good. type it like this [AirHQ1, "Arsenal", [ true, blacklist1 ], false ] call LARs_fnc_updateArsenal;
  8. Thanks but i have 2 problems first Lars_allgear array doesn't include any of the weapon accessories like scopes and lasers bipods. etc. could i just pull weapons from weapons cfg or LARs_sideGear from(fn_sidegear) and use that inplace of Lars_allgear from (fn_allgear) or is Lars_allgear a structured array for arsenal the other is; fn_updatearsenal creates a list by side again. would the below work for a workaround? fn_updateArsenal.sqf line 18 _lists params[ [ "_whiteList", [ [], "", sideUnknown, true ] ], [ "_blackList", [] ] ]; _oldWhite = _box getVariable [ format[ "LARs_arsenal_%1_data", _arsenalName ], [] ]; if !( _whiteList isEqualType [] ) then { _whiteList = if ( _whiteList isEqualType true ) then { if ( _whiteList ) then { LARs_sideGear; }else{ if !( _whiteList isEqualType [] ) then { _whiteList = _oldWhite + [ _whitelist ]; }else{ _whiteList = _oldWhite + _whitelist; }; }; }; };
  9. sabot10.5mm

    Enemy occupation system (eos)

    Enable EOS integration null = [["BAS_zone_1"],[3,1],[2,1],[2],[0,0],[0,0,EAST],[10,2,20,***TRUE***,TRUE]] call Bastion_Spawn; Simulates capturing of areas. If TRUE the marker will act as a normal EOS zone if the player leaves the bastion zone. If *FALSE then bastion zone will turn red on the map but will not contain any units.
  10. I made an eventhandler that deletes a few array elements for blacklist1, and updates arsenal to reflect that if (count blacklist1 > 0) then{ _tower addEventHandler ["Killed", {[blacklist1 deleterange [0,7]; AirHQ1, "Arsenal", [ west, blacklist1 ], _targets ] call LARs_fnc_updateArsenal; [ ammos, "Arsenal", [ west, blacklist1 ], _targets ] call LARs_fnc_updateArsenal;[ ammoCrate_1, "Arsenal", [ west, blacklist1 ], _targets ] call LARs_fnc_updateArsenal;}];}; you can also populate blacklist using //A blacklist that removes all secondary weapons and all weapon/respawn/special backpacks _allWeaponTypes = ["Shotgun","MissileLauncher","Launcher","RocketLauncher","SniperRifle","MachineGun","AssaultRifle","Rifle","SubmachineGun","HandGun"]; // Other types (if you like them to include): GrenadeLauncher,Launcher,MissileLauncher,Mortar,RocketLauncher //Full List: https://community.bistudio.com/wiki/BIS_fnc_itemType -> section Weapon _allBannedWeapons=[]; //add banned weapons (eg M107_epoch), make shure to use the base version of the weapon //Main Script blacklist1 = []; _wpList = (configFile >> "cfgWeapons") call BIS_fnc_getCfgSubClasses; { if (getnumber (configFile >> "cfgWeapons" >> _x >> "scope") == 2) then { _itemType = _x call bis_fnc_itemType; if (((_itemType select 0) == "Weapon") && ((_itemType select 1) in _allWeaponTypes)) then { _baseName = _x call BIS_fnc_baseWeapon; if (!(_baseName in blacklist1) && !(_baseName in _allBannedWeapons)) then { blacklist1 = blacklist1 + [_baseName]; }; }; }; } foreach _wpList; reverse blacklist1; if !( isServer ) exitWith {}; _ammoBox1 = _this; //[ box, [ white, black ], targets, name, condition ] JIPID = [ _ammoBox1, [west, "blacklist1"], 0, "Arsenal", { true } ] call LARs_fnc_blacklistArsenal; JIPID = [ ammoCrate_1, [west, "blacklist1"], 0, "Arsenal", { true } ] call LARs_fnc_blacklistArsenal; JIPID = [ AIRHQ1, [west, "blacklist1"], 0, "Arsenal", { true } ] call LARs_fnc_blacklistArsenal; I Have a question though. what if I wanted to forgo the whitelist? I heard Larrow say type true in the whitelist but I get "error type bool expected array, side, string JIPID = [ AIRHQ1, [true, "blacklist1"], 0, "Arsenal", { true } ] call LARs_fnc_blacklistArsenal;
  11. the ai knows about a vehicle, it relentlessly tries to dive bomb in a vtol. anyway to make pilot careless mode and gunners aware? _crew = creategroup west; _locPos = player getPos [1500,random (360)]; //veh = createVehicle ["B_T_vtol_01_armed_F", position player, [], 1500, "FLY"]; veh = [_locPos, 0, "B_T_vtol_01_armed_F", _crew] call bis_fnc_spawnVehicle; //createVehicleCrew veh; //sleep 1; //_crew = group ((crew _vehicle) select 0) //_crew = veh select 2; _wp=veh select 2 addWaypoint [position player, 0]; _wp setWaypointType "loiter"; _wp setWaypointLoiterType "Circle_L"; _wp setWaypointLoiterRadius 500; veh select 0 flyInHeight 500; {veh select 2 reveal _x} forEach allUnits; https://steamuserimages-a.akamaihd.net/ugc/924795891776256085/8ED84B790EE0EE65BFE89FCF57807825E9B6A3A4/ vtol should be loitering 500 meters yet he seems to like to dive the tank
  12. sabot10.5mm

    ai dive bomb in vtol

    can the pilot be careless and the rest of the crew aware? maybe giving separate groups would do this? i will try it
  13. sabot10.5mm

    Enemy occupation system (eos)

    http://steamcommunity.com/sharedfiles/filedetails/?id=911839421 its my mission with eos running hope you have tanoa
  14. sabot10.5mm

    Enemy occupation system (eos)

    made small addiction since I like my uavs to activate eos [] spawn { private "_pos","_list1","_pos1"; while {true} do { list1 = {}; _pos = getpos player; _pos1 = getConnectedUAV player; list1 = _pos nearObjects ["EmptyDetector", 700]; if !(isNull _pos1) then {_pos = getConnectedUAV player; _list1 = _pos nearObjects ["EmptyDetector", 1000]; list1 append _list1;}; //systemChat format ["UAV: %1",list1]; if (count (list1) > 0) then { { _x enableSimulation true; } forEach list1; }; sleep 5; }; }; [] spawn { while {true} do { waituntil {sleep 3;(count (list1) == 0)}; sleep 1; //systemChat format ["UAV: hi"]; _alltriggers = allMissionObjects "EmptyDetector"; { _x enableSimulation false; } forEach _alltriggers; waituntil {sleep 3;(count (list1) > 0)}; }; }; this script allows uavs to activate eos. the code that makes it happen is this {_actCond="{vehicle _x in thisList && isplayer _x || ({_player = _x; {getConnectedUAV _player == _x} count [uav, uav1, uav2, uav3] > 0} count allPlayers > 0 && ({_x in thislist} count [uav, uav1, uav2, uav3] > 0))} count allUnits > 0"; }; eos_core
  15. sabot10.5mm

    Enemy occupation system (eos)

    just copy the script into a sqf file and run it null=execvm "blah.sqf";
  16. sabot10.5mm

    Enemy occupation system (eos)

    made a small script that turns on and off triggers when player isn't near since I use about 100 of them [] spawn { while {true} do { list1 = player nearObjects ["EmptyDetector", 500]; if (count (list1) > 0) then { { _x enableSimulation true; } forEach list1; }; sleep 5; }; }; [] spawn { while {true} do { waituntil {sleep 5;(count (list1) == 0)}; _alltriggers = allMissionObjects "EmptyDetector"; { _x enableSimulation false; } forEach _alltriggers; }; };
  17. sabot10.5mm

    [solved] script syntax help

    this script will wait for player to be 601 meters away from cities befor checking to see if any hills near player, then spawn a base and delete the base once player is 700 meter away. alternatively if no hills nearby, it will spawn troops 300 meters in a 30 degree spread infront of the player. I will try to add to it later private ["_cargo","_grpBol","_grpSpwn","_tower","_marker"]; // loop sleep 5; systemChat "loop start"; _grps =[]; _grpBul = false; while {true} do { _pPos = getPos player; if (count (nearestLocations [_pPos, ["NameCity","NameLocal"], 500]) == 0 && random 4 < 1) then { systemChat "loop start"; _locPos = player getPos [300,random (120)-60]; _fndLoc = nearestLocations [_pPos, ["Hill","NameVillage"], 600]; //*************************************************************************** if (count (_fndLoc) > 0) then { _loc1 = _fndLoc select 0; _locPos = locationPosition _loc1; _randPos = [_locPos , 0, 200, 12, 0, 0.4, 0] call BIS_fnc_findSafePos; _cargo = "Land_Cargo_HQ_V1_F" createVehicle _randPos; _randPos14 = _cargo getRelPos [9, 12]; _mg13 = createVehicle ["O_GMG_01_high_F", _randPos14, [], 0, "CAN_COLLIDE"]; _mgguy13 = [_randPos14, EAST, ["O_Soldier_F"],[],[],[],[],[],232] call BIS_fnc_spawnGroup; ((units _mgguy13) select 0) moveInGunner _mg13; _mg13 setPosATL (_cargo buildingPos 4); _randPos15 = _cargo getRelPos [9, 180]; _mg14 = createVehicle ["O_GMG_01_high_F", _randPos15, [], 0, "CAN_COLLIDE"]; _mgguy14 = [_randPos15, EAST, ["O_Soldier_F"],[],[],[],[],[],232] call BIS_fnc_spawnGroup; ((units _mgguy14) select 0) moveInGunner _mg14; _mg14 setPosATL (_cargo buildingPos 7); _mg14 setDir 180; _randPos2 = [_cargo , 15, 200, 10, 0, 0.6, 0] call BIS_fnc_findSafePos; _tower = "Land_TTowerBig_1_F" createVehicle _randPos2; _tower setVectorUp [0,0,1]; // Make sure the tower is not leaning. _tower addEventHandler ["Killed", {player addRating 2000; task1 setTaskState "Succeeded"; systemChat format ["good job."];}]; _towerbox = "Land_spp_Transformer_F" createVehicle _randPos2; _towerbox setVectorUp [0,0,1]; _towerbox2 = "Land_TTowerSmall_1_F" createVehicle _randPos2; _towerbox2 setVectorUp [0,0,1]; _tower setVehicleVarName "tower1"; tower1 = _tower; _genny = _tower getRelPos [7, 9]; //*** create HQ Marker _marker = createMarkerLocal ["opfor_hq.", position player ]; _marker setMarkerPos _randPos; _marker setMarkerShape "ICON"; _marker setMarkerColor "Default"; _marker setMarkerType "loc_Bunker"; _marker setMarkerText "HQ"; //*** Task for player task1 = player createSimpleTask ["Destroy the Cell Tower"]; task1 setSimpleTaskDescription ["The Enemy are using the Antenna for Propaganda Purposes, it needs to be Destroyed","",""]; task1 setsimpletaskdestination _randPos2; task1 setTaskState "Assigned"; player setCurrentTask task1; _grpBul = true; }; for "_i" from 1 to 4 do { _grps =[]; _Xrnd = random [0,100,200]; if (_grpBul) then [{_grpSpwn = _cargo getPos [_Xrnd,random (360)]} , {_grpSpwn = _locPos getPos [_Xrnd,random (360)];}]; _mot = "Mechanized"; _rnFr = selectRandomWeighted ["Infantry",3,"Mechanized",0.1]; _rnSq = if (_rnFr == _Mot) then [ {"OIA_MechInfSquad"} , {selectRandomWeighted ["OIA_InfTeam",0.9,"OIA_InfTeam_AT",0.4,"OIA_InfSquad",0.1,"OIA_InfAssault",0.1,"OIA_ReconSquad",0.1]} ]; _grp = [_grpSpwn ,EAST,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> _rnFr >> _rnSq)] call BIS_fnc_spawnGroup; [_grp,_grpSpwn,150] call bis_fnc_taskPatrol; _grps pushBack _grp; sleep 0.3; }; _grp1 = _grps select 0; _grp1Ldr = leader _grp1; _grp1 = getpos _grp1Ldr; //systemChat format ["grps %1 |grp1 |%2 |_grp1Ldr %3 ",_grps,_grp,_grp1Ldr]; systemChat format ["UAV: Multiple Enemies Sighted at %1 Degrees be Advised",floor(player getDir _locPos)]; Sleep 1; waitUntil {sleep 50;((player distance _grp1) > 900)}; {if (side _x == east) then {deleteVehicle _x};} foreach allunits; _objs = nearestObjects [_locPos, [], 410]; {deleteVehicle _x} forEach _objs; player removeSimpleTask task1; deleteMarker _marker; _tower removeAllEventHandlers "killed"; sleep 1; {deleteGroup _x} forEach allGroups; //{deleteVehicle _x} forEach allUnitsUAV; _grpBul = false; }; sleep 60; };
  18. sabot10.5mm

    [solved] script syntax help

    while {true} do { if (count (nearestLocations [position player, ["NameCity","NameLocal"], 601]) == 0) then { // chance 10% systemChat "loop start"; _locPos = player getPos [300,random (60)-30]; if (count (nearestLocations [position player, ["Hill","NameVillage"], 301]) >= 1) then { _loc = nearestLocations [position player, ["Hill","NameVillage"], 301]; _loc1 = _loc select 0; _locPos = locationPosition _loc1; }; _location1 = _locPos getPos [100,random (360)]; _mot = "Motorized_MTP"; _rnFr = selectRandomWeighted ["Infantry",0.9,"Mechanized",0.1]; _rnSq = if (_rnFr == _Mot) then [ {"OIA_MechInfSquad"} , {selectRandomWeighted ["OIA_InfSquad",0.3,"OIA_InfAssault",0.3,"OIA_ReconSquad",0.2,"OIA_InfTeam",0.1,"OIA_InfTeam_AT",0.1]} ]; _grp = [_location1 ,EAST,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> _rnFr >> _rnSq)] call BIS_fnc_spawnGroup; _grp1 = leader _grp; _grpPos = getpos _grp1; systemChat format ["UAV: Enemy Sighted at %1 Degrees",floor(player getDir _grp1)]; //systemChat format ["%1", _loc1]; [_grp,_locPos,80] call bis_fnc_taskPatrol; waitUntil {sleep 50;((_grp1 distance player) > 600)}; {if (side _x == east) then {deleteVehicle _x};} foreach allunits; sleep 1; {deleteGroup _x} forEach allGroups; }; //sleep 1; sleep 50; }; how can I spawn 2 groups at a time and still reference their group? using "for loop" to spawn groups I cant reference any spawned groups and so finding the leaders' pos is not possible
  19. sabot10.5mm

    [solved] script syntax help

    i got away with one waitUntil {sleep 50;((player distance _grp1) > 500)};
  20. sabot10.5mm

    [solved] script syntax help

    thanks to pierremgi and Lucullus script to randomly spawn infantry or motorized units around the player if atleast 500 meters away from cities or airports // first a variable to make the loop breakable _loopvar = true; params ["_grp"]; // loop sleep 5; systemChat "loop start"; while {_loopvar} do { // not near any Locations if (count (nearestLocations [position player, ["NameCity","FlatAreaCity"/*https://community.bistudio.com/wiki/Location*/], 500]) == 0 && random 6 < 1) then { // chance 10% // spawn random teams/squads on a 150m circle in random direction _mot = "Motorized_MTP"; _rnFr = selectRandomWeighted ["Infantry",0.9,"Motorized_MTP",0.1]; _rnSq = if (_rndFr == _Mot) then [ {"OIA_MotInf_Team"} , {selectRandomWeighted ["OIA_InfSquad",0.1,"OIA_InfAssault",0.1,"OI_reconTeam",0.2,"OIA_InfTeam",0.4,"OIA_InfTeam_AT",0.4]} ]; _grp = [player getPos [300,random (60)-30],EAST,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> _rnFr >> _rnSq)] call BIS_fnc_spawnGroup; _grp1 = leader _grp; _grpPos = getpos _grp1; //_plyPos = player getPos [300,random (60)]; systemChat format ["UAV: Enemy Sighted at %1 Degrees",floor(player getDir _grp1)]; [_grp,_grpPos,150] call bis_fnc_taskPatrol; waitUntil {sleep 50;((_grp1 distance player) > 600)}; {deleteVehicle _x} forEach units _grp; sleep 1; {deleteGroup _x} forEach allGroups; }; // player killed = break the loop //if !(alive player) then {_loopvar = false}; // wait 1 second for main loop //sleep 1; sleep 50; };
  21. sabot10.5mm

    [solved] script syntax help

    _Mot = "Motorized_MTP"; _rndFr = selectrandom ["Infantry","Motorized_MTP"]; _rndSq = selectRandom ["OIA_InfSquad","OIA_InfAssault","OI_reconTeam","OIA_InfTeam","OIA_InfTeam_AT"]; if (_rndFr == _Mot) then {_rndSq = "OIA_MotInf_Team"}; _grp = [player getPos [150,random (360)],EAST,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> _rndFr >> _rndSq)] call BIS_fnc_spawnGroup; apparently you cant check to see if a _var is equal to string (_var == "string") has to be (_var ==_var2). only in IF statements? because it throws an error generic error in expression _rndGr|#| = if (_rndFr == "Motorized_MTP") then {_rndSq = "OIA_MotInf_Team"};
  22. sabot10.5mm

    [solved] script syntax help

    tried to private a var but it doesn't stay the same outside the scope. how can I do this? _rndFr = selectRandom ["Motorized_MTP","Infantry"]; _rndSq = selectRandom ["OIA_InfSquad","OIA_InfAssault","OI_reconTeam","OIA_InfTeam","OIA_InfTeam_AT"]; _rndGr = if (_rndFr == '"Motorized_MTP"') then {_rndSq = "OIA_MotInf_Team";}; _grp = [player getPos [150,random (360)],EAST,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> _rndFr >> _rndSq)] call BIS_fnc_spawnGroup;
  23. sabot10.5mm

    [solved] script syntax help

    // first a variable to make the loop breakable tag_myEnemyVar = true; //_grp = _this select 0; // loop systemChat "loop start"; while {tag_myEnemyVar} do { // not near any Locations if (count (nearestLocations [position player, ["Airport","NameCity","NameLocal"], 500]) == 0) then { // chance 10% if (floor random 1 == 0) then { // spawn random teams/squads on a 150m circle in random direction _mot = "Motorized_MTP"; _rndFr = selectrandom ["Infantry","Motorized_MTP"]; _rndSq = if (_rndFr == _Mot) then [ {"OIA_MotInf_Team"} , {selectRandom ["OIA_InfSquad","OIA_InfAssault","OI_reconTeam","OIA_InfTeam","OIA_InfTeam_AT"]} ]; _grp = [player getPos [150,random (360)],EAST,(configfile >> "CfgGroups" >> "East" >> "OPF_F" >> _rndFr >> _rndSq)] call BIS_fnc_spawnGroup; _grp1 = leader _grp; systemChat format ["Enemy at %1",getPos leader _grp]; (units _grp) doMove (getPos player); waitUntil {sleep 10;((player distance _grp1) > 500)}; {deleteVehicle _x} forEach units _grp; {deleteGroup _x} forEach allGroups; }; // wait 5 seconds for next chance sleep 50; }; edited your script a bit. using it to engage the player a bit on the way to objectives
  24. sabot10.5mm

    [solved] script syntax help

    how can i make _grp accessible outside the scope of the IF statement? since i would like to make a function that finds the range between the group and the player. is global variable the only way?
×