Jump to content
1para{god-father}

waituntil player distance on Dedi

Recommended Posts

I am running this on a dedi server so Ipresume this will not work ? can i use player ?

I need it to work if anyone who is in game goes withing 5m of Vip

waituntil {player distance _vip1 < 5};

do the rest...

Thanks

Edited by psvialli

Share this post


Link to post
Share on other sites
;2001672']Player should work. How exactly do you plan to use it?

Oppps sorry I mean Dedi server this one will be on !

Well from an addaction on a civi i get a task which will fire this script:-

_grpdummy = createGroup EAST; 
_vip1 = _grpdummy createUnit ["RU_Functionary1", getMarkerPos "vipcapture", [], 10, ""];
removeAllWeapons _vip1;
_vip1 setCaptive true; 
_vip1 setBehaviour "CARELESS";

//move to position 
//_vip1 setPos ((position _vip1 nearestObject 115676) buildingPos 14);

_vip1 switchMove "AmovPercMstpSsurWnonDnon";

waituntil {player distance _vip1 < 5};


///do other stuff once any player is near him........................

Edited by psvialli
Oppps sorry I mean Dedi server this one will be on !

Share this post


Link to post
Share on other sites

Instead of using player try:

_caller = _this select 1;  // Person who used the addAction

Then

waitUntil {_caller distance _vip1 < 5};

Share this post


Link to post
Share on other sites

I guess if the player that used it used it and immediately logged off it might break? If that's a concern you might want to rethink using addAction to spawn a vip that's at a distance?

Share this post


Link to post
Share on other sites

Wait.. then where is the addAction? If its on the civie, obviously the caller will be there.

Share this post


Link to post
Share on other sites

this line will check if any player is within the distance, deosnt matter what client they are.

waitUntil {({isPlayer _x AND (_x distance _vip1) < 5} count playableUnits) != 0};

but the need for this code, very much depends on what this is:

///do other stuff once any player is near him........................

Share this post


Link to post
Share on other sites

Well there will be about 25players on this mission and the caller might be on patrol outside or dead and at Base another player might go in to get the VIP , hence I need any player.

So should this work on a dedi ?

waituntil {player distance _vip1 < 5};

The addaction just gives a random mission.

Share this post


Link to post
Share on other sites

What unit is the addAction on? The civilian, as in you have to be within 3m of the civilian to have the action, or is it elsewhere?

Share this post


Link to post
Share on other sites

No, player does not exist on a Dedicated Server machine, although, it works when is used on an actual player/client machine.

I think you are trying to complicate this? Why don't you just add the action to the Guy instead of the players? So only if they are near the Guy and looking at him the action will appear?

_neo_

Share this post


Link to post
Share on other sites

Ok so Player will not work then if not how can i get any player to work on a dedi ?

My civ has the addaction, that generate a random mission Not the VIP

MyCivAction1=this addAction ["get mission!", "intel.sqf"];

this calls intel.sqf which pick a random mission 1-10.sqf

and in one of those mission i spawn in a VIP and if any player goes up to him , this is where i need the Waituntil

1.sqf

_grpdummy = createGroup EAST; 
_vip1 = _grpdummy createUnit ["RU_Functionary1", getMarkerPos "vipcapture", [], 10, ""];
removeAllWeapons _vip1;
_vip1 setCaptive true; 
_vip1 setBehaviour "CARELESS";

//move to position 
//_vip1 setPos ((position _vip1 nearestObject 115676) buildingPos 14);

_vip1 switchMove "AmovPercMstpSsurWnonDnon";

waituntil {player distance _vip1 < 5}; ????  What Can i USE ???


///do other stuff once any player is near him........................

Edited by psvialli

Share this post


Link to post
Share on other sites

Player works on a dedicated environment, when used local on a player's machine, just like that action, that piece of code will just run where the player who clicked the action is local.

So:

waitUntil { player distance _vip1 < 5 }

Will work great, but this is only running in the player machine, the one who clicked the action.

You'll need something better then that, like then spawn a instance on the server and do the check there like:

waitUntil { { isPlayer _x && _x distance _vip1 < 5 } count playableunits > 0 };
//Continue here

The above will return true when one or more players are near the _vip1.

Check this post, I kind of saying the same thing there.

_neo_

Edited by neokika

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

×