Jump to content

Biscuit90

Member
  • Content Count

    8
  • Joined

  • Last visited

  • Medals

Everything posted by Biscuit90

  1. Hi everyone, is it possible to use this BIS_fnc_stalk to only engage the player that is near a specific marker? I'm not sure if this code below is working as intended with using _stalking = [_grp1,group player,nil,nil,{player distance getMarkerpos "test"< 100},"test"] spawn BIS_fnc_stalk; That will engage every player not only near the marker? not sure if i typed the code correct. [] spawn { while {true} do { sleep 5; Call { if ({(_x distance2d getMarkerpos "test"< 100)} count allPlayers > 0) exitWith { _grp01 = [getMarkerpos "test", east, ["I_L_Looter_SMG_F","I_L_Looter_SG_F","I_L_Looter_Pistol_F","I_L_Looter_Rifle_F","I_L_Hunter_F","I_L_Criminal_SMG_F","I_L_Criminal_SG_F"],[],[],[1,1],[1,1]] call BIS_fnc_spawnGroup; {_x setSkill ["AimingAccuracy",0.1]} forEach (units _grp01); _grp01 enableDynamicSimulation true; _grp01 allowFleeing 0; _grp01 deleteGroupWhenEmpty true; _grp01 setSpeedMode "LIMITED"; _grp01 setBehaviour "SAFE"; _grp01 setCombatMode "Red"; _stalking = [_grp1,group player,nil,nil,{player distance getMarkerpos "test"< 100},"test"] spawn BIS_fnc_stalk; waitUntil {sleep 5; ({(_x distance2d getMarkerpos "test") < 200} count allPlayers < 1)}; {deleteVehicle _x;}forEach units _grp01; deleteGroup _grp01; {deleteVehicle _x;} count allDead; };};};};
  2. Biscuit90

    Spawn/despawn in a loop

    Thanks @Dedmen
  3. Hi everyone, What is the best way to spawn/despawn ai's if a player is near or far away from a specific marker? I have two different codes but not sure if it's a good way to execute for what i need in my mission. i'm using multiple markers on my mission to spawn and despawn ai's if players is near but i can't figure out how to make it into one script using something like Markers=["1","2","3","4","5","6","7","8","9","10"]; then spawn/despawn if player is near or driving away. [] spawn { while {true} do { sleep 5; Call { if ({(_x distance2d getMarkerpos "test"< 10)} count allPlayers > 0) exitWith { _grp01 = [getMarkerpos "test", east, ["I_L_Looter_SMG_F","I_L_Looter_SG_F","I_L_Looter_Pistol_F","I_L_Looter_Rifle_F","I_L_Hunter_F","I_L_Criminal_SMG_F","I_L_Criminal_SG_F"],[],[],[1,1],[1,1]] call BIS_fnc_spawnGroup; {_x setSkill ["AimingAccuracy",0.1]} forEach (units _grp01); _grp01 enableDynamicSimulation true; _grp01 allowFleeing 0; _grp01 deleteGroupWhenEmpty true; _grp01 setSpeedMode "LIMITED"; _grp01 setBehaviour "SAFE"; _grp01 setCombatMode "Red"; [_grp01, getMarkerpos "test"] call bis_fnc_taskDefend; waitUntil {sleep 5; ({(_x distance2d getMarkerpos "test") < 20} count allPlayers < 1)}; {deleteVehicle _x;}forEach units _grp01; deleteGroup _grp01; {deleteVehicle _x;} count allDead; };}; }; }; Second code [] spawn { waitUntil {sleep 5; ({(_x distance2d getMarkerpos "test1") < 10} count allPlayers > 0)}; _grp01 = [getMarkerpos "test1", east, ["I_L_Looter_SMG_F","I_L_Looter_SG_F","I_L_Looter_Pistol_F","I_L_Looter_Rifle_F","I_L_Hunter_F","I_L_Criminal_SMG_F","I_L_Criminal_SG_F"],[],[],[1,1],[1,1]] call BIS_fnc_spawnGroup; {_x setSkill ["AimingAccuracy",0.1]} forEach (units _grp01); _grp01 enableDynamicSimulation true; _grp01 allowFleeing 0; _grp01 deleteGroupWhenEmpty true; _grp01 setSpeedMode "LIMITED"; _grp01 setBehaviour "SAFE"; _grp01 setCombatMode "Red"; [_grp01, getMarkerpos "test"] call bis_fnc_taskDefend; waitUntil {sleep 5; ({(_x distance2d getMarkerpos "test1") < 30} count allPlayers < 1)}; {deleteVehicle _x;}forEach units _grp01; deleteGroup _grp01; private _bridge = [] spawn Biscuit_fnc_bridge; };
  4. Biscuit90

    Spawn/despawn in a loop

    One more question, if i spawn a function from initserver with _marker = ["test","test2"]; { [_x] spawn Biscuit_fnc_Looters } foreach _marker; Should i use [] spawn { _grp01 = [getMarkerpos _marker, east, ["I_L_Looter_SMG_F","I_L_Looter_SG_F","I_L_Looter_Pistol_F","I_L_Looter_Rifle_F","I_L_Hunter_F","I_L_Criminal_SMG_F","I_L_Criminal_SG_F"],[],[],[1,1],[1,1]] call BIS_fnc_spawnGroup; }; Or only _grp01 = [getMarkerpos _marker, east, ["I_L_Looter_SMG_F","I_L_Looter_SG_F","I_L_Looter_Pistol_F","I_L_Looter_Rifle_F","I_L_Hunter_F","I_L_Criminal_SMG_F","I_L_Criminal_SG_F"],[],[],[1,1],[1,1]] call BIS_fnc_spawnGroup;
  5. Biscuit90

    BIS_fnc_stalk

    I was thinking more of using something like this, but it would probarly chase everyone and not just the specific player that is near. _looters = [_grp01,group (allPlayers select 0)] spawn BIS_fnc_stalk;
  6. Biscuit90

    Spawn/despawn in a loop

    Thanks @Smart Games I made it into this _marker = ["test","test2"]; { [_x] spawn Biscuit_fnc_bridgeloop } foreach _marker; Then _marker = _this; while {true} do { sleep 5; Call { if ({(_x distance2d getMarkerpos _marker < 10)} count allPlayers > 0) exitWith { _grp01 = [getMarkerpos _marker, east, ["I_L_Looter_SMG_F","I_L_Looter_SG_F","I_L_Looter_Pistol_F","I_L_Looter_Rifle_F","I_L_Hunter_F","I_L_Criminal_SMG_F","I_L_Criminal_SG_F"],[],[],[1,1],[1,1]] call BIS_fnc_spawnGroup; {_x setSkill ["AimingAccuracy",0.01]} forEach (units _grp01); _grp01 enableDynamicSimulation true; _grp01 allowFleeing 0; _grp01 deleteGroupWhenEmpty true; _grp01 setSpeedMode "LIMITED"; _grp01 setBehaviour "SAFE"; _grp01 setCombatMode "Red"; [_grp01, getmarkerpos _marker] call bis_fnc_taskDefend; waitUntil {sleep 5; ({(_x distance2d getMarkerpos _marker) < 30} count allPlayers < 1)}; {deleteVehicle _x;}forEach units _grp01; deleteGroup _grp01; {deleteVehicle _x;} count allDead; };};}; Works good. Not sure about this one Test1 = { _marker = _this; while {true} do { sleep 5; Call { if ({(_x distance2d getMarkerpos _marker < 10)} count allPlayers > 0) exitWith { _grp01 = [getMarkerpos _marker, east, ["I_L_Looter_SMG_F","I_L_Looter_SG_F","I_L_Looter_Pistol_F","I_L_Looter_Rifle_F","I_L_Hunter_F","I_L_Criminal_SMG_F","I_L_Criminal_SG_F"],[],[],[1,1],[1,1]] call BIS_fnc_spawnGroup; {_x setSkill ["AimingAccuracy",0.01]} forEach (units _grp01); _grp01 enableDynamicSimulation true; _grp01 allowFleeing 0; _grp01 deleteGroupWhenEmpty true; _grp01 setSpeedMode "LIMITED"; _grp01 setBehaviour "SAFE"; _grp01 setCombatMode "Red"; [_grp01, getmarkerpos _marker] call bis_fnc_taskDefend; waitUntil {sleep 5; ({(_x distance2d getMarkerpos _marker) < 30} count allPlayers < 1)}; {deleteVehicle _x;}forEach units _grp01; deleteGroup _grp01; {deleteVehicle _x;} count allDead; };};};}; _marker = ["test","test2"]; {[_x] spawn Test1} foreach _marker; But works too, everything in one file.
  7. Biscuit90

    Spawn/despawn in a loop

    Not sure if it's a good way to do it but i made it into a switch, so when a player is near one of the marker it spawns ai's and when the player is far away it despawns the ai's. [] spawn { while {true} do { sleep 5; Call { if ({(_x distance2d getMarkerpos "test"< 300)} count allPlayers > 0) exitWith { _grp01 = [getMarkerpos "test", east, ["I_L_Looter_SMG_F","I_L_Looter_SG_F","I_L_Looter_Pistol_F","I_L_Looter_Rifle_F","I_L_Hunter_F","I_L_Criminal_SMG_F","I_L_Criminal_SG_F"],[],[],[1,1],[1,1]] call BIS_fnc_spawnGroup; {_x setSkill ["AimingAccuracy",0.01]} forEach (units _grp01); _grp01 enableDynamicSimulation true; _grp01 allowFleeing 0; _grp01 deleteGroupWhenEmpty true; _grp01 setSpeedMode "LIMITED"; _grp01 setBehaviour "AWARE"; _grp01 setCombatMode "Red"; [_grp01, getMarkerpos "test"] call bis_fnc_taskDefend; waitUntil {sleep 5; ({(_x distance2d getMarkerpos "test") < 300} count allPlayers < 1)}; {deleteVehicle _x;}forEach units _grp01; deleteGroup _grp01; {deleteVehicle _x;} count allDead; }; if ({(_x distance2d getMarkerpos "test2"< 300)} count allPlayers > 0) exitWith { _grp01 = [getMarkerpos "test2", east, ["I_L_Looter_SMG_F","I_L_Looter_SG_F","I_L_Looter_Pistol_F","I_L_Looter_Rifle_F","I_L_Hunter_F","I_L_Criminal_SMG_F","I_L_Criminal_SG_F"],[],[],[1,1],[1,1]] call BIS_fnc_spawnGroup; {_x setSkill ["AimingAccuracy",0.1]} forEach (units _grp01); _grp01 enableDynamicSimulation true; _grp01 allowFleeing 0; _grp01 deleteGroupWhenEmpty true; _grp01 setSpeedMode "LIMITED"; _grp01 setBehaviour "AWARE"; _grp01 setCombatMode "Red"; [_grp01, getMarkerpos "test2"] call bis_fnc_taskDefend; waitUntil {sleep 5; ({(_x distance2d getMarkerpos "test2") < 300} count allPlayers < 1)}; {deleteVehicle _x;}forEach units _grp01; deleteGroup _grp01; {deleteVehicle _x;} count allDead; };};};};
  8. Biscuit90

    Spawn/despawn in a loop

    Thanks @wogz187
×