Jump to content
Sign in to follow this  
Biscuit90

BIS_fnc_stalk

Recommended Posts

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;


};};};};

 

Share this post


Link to post
Share on other sites

If you're not really using the function (radius/refresh) then just use something like,

_wp1 = badguys addwaypoint [position player ,0];

right?
This is the opposite of what we did yesterday,
Begin this with yesterday's script,

endBadguys.sqf

enemyEND= []spawn { 
waitUntil { 
sleep 1; 
(vehicle player distance enemyMark1 < 50) 
}; 
hint "You exited Zone 1"; 
enemyMark setpos (getpos objNULL); 
deletegroup badguys; 
};

Together with yesterday's script we made a switch to turn badguys on/off at the location triggered by player's proximity to the marker "enemyMark1". The enemy immediately begin to follow player. You can use this to make as many zones as you like, check out the module I posted yesterday.

Share this post


Link to post
Share on other sites

Sorry. Yesterday's work was incomplete. You asked for this to spawn/despawn in a loop.

Name this: spawner.sqf (or whatever) and start it in the init.sqf

enemyDEST= []spawn { 
	waitUntil 
	{
	sleep 1; 
	(vehicle player distance enemyMark1 < 50) 
}; 
	hint "You entered Zone 1"; 
	enemyMark setpos (getpos enemyMark1);
	execVM "badguys.sqf";
};

and this,
badguys.sqf

enemyEND= []spawn {    

	Emark = createMarker ["Enemy", enemyMark];
	badguys = [getmarkerPOS "Enemy", east, ["I_C_Soldier_Bandit_8_F", "I_G_sharpshooter_F", "I_C_Soldier_Bandit_8_F"]] call BIS_fnc_SpawnGroup;
	_wp1 = badguys addwaypoint [position player ,0];
	_wp1 setwaypointtype "move";
 
waitUntil { 
	sleep 1; 
(vehicle player distance enemyMark1 > 50) 
	}; 
hint "You exited Zone 1"; 
	enemyMark setpos (getpos objNULL);
	{deleteVehicle _x;}forEach units badguys;
	deletegroup badguys; 
	execVM "spawner.sqf";
};

Just substitute your unit preferences and distances.

Have fun!
 

 

  • Like 2

Share this post


Link to post
Share on other sites

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;

 

Share this post


Link to post
Share on other sites

Somewhere in here I said,

Quote

If you're not really using the function (radius/refresh) then just use something like,

But that's not necessarily correct.

This is the best option to have a non-grouped unit follow player. With the simplest syntax,

[groupFollowing, groupToFollow] spawn bis_fnc_stalk;

Have fun!

Share this post


Link to post
Share on other sites

Regards.
I am interested in this code. What would be the final script and how should I use it? Thank you

Share this post


Link to post
Share on other sites

@TURCO_AR,

Try like this,

Say you have a unit named Soldier1 all alone and a hunter group to follow.

[hunterGroup, group soldier1] spawn bis_fnc_stalk;

This is example 2, bis_fnc_stalk

_stalking = [grp1, group player, refresh, radius, { endCondition (code) }, "endDestination"] spawn BIS_fnc_stalk;

Here's how I used it,

Spoiler

toggleFollow= player addAction ["Toggle Follow", {

if (SA_Follow==0) exitWith {

SA_Follow=1; followPLAY = [group SWO_SA, group Player] spawn BIS_fnc_stalk; SWO_SA sidechat "I'm with you";
	};

if (SA_Follow==1) exitWith {SA_Follow=0; terminate followPLAY; SWO_SA sidechat "Holding.";
	};
}];

 

which creates an action menu action to toggle the character following/holding.

Have fun!

  • Like 1

Share this post


Link to post
Share on other sites

Thanks for your answer @wogz187

 

How would this method be used if, for example, I want to spawn a group of Ai's and stalk a team of players that enter a certain area.
It is for a cooperative mission for 40 players on a Dedi server and anyone can enter the area. Therefore I would not specify the name of the group.

Could this method be used or should another be used?

 

 

Share this post


Link to post
Share on other sites

@TURCO_AR,

I'm sure bis_fnc_stalk will still work in your coop mission but I'm not the person to advise-- I've never made a MP mission!

You can define the group within the trigger.
Something like,

triggerGroup= group this; //this is whatever activated the trigger

I don't want to give you too much bad advice. Just keep an eye on this topic.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×