Jump to content
Sign in to follow this  
nebulazerz

Invisible Players and JIP setPos

Recommended Posts

I am having trouble getting players to spawn in correctly, I have the units boxed all checked so they are pretty much not on the map until a player takes them over but this seems to be causing some issues. Also, I cant get setPos to work with JIP, it always puts players in the place where I have the units placed on spawn if they join after the game has started.

 

Here is the top of my initPlayerLocal.sqf

waitUntil { !isNull player && time > 0 }; //after briefing
 
//Define UI ctrls
#define UIlevel 1000
#define UIprogress 1001
#define UIprogressBar 1002
#define UIcash 1003
#define UIkills 1004
#define UIredScore 1005
#define UIbluScore 1006
#define UIbluBar 1007
#define UIredBar 1008
#define UIendScore 1009
#define UIhealthBar 1010
#define UIhealthIcon 1011
#define UIdisplayFPS 1012

player allowDamage true;
player enableSimulation true;
player enableStamina false;
player hideObject false;
player hideObjectGlobal false;
enableSentences false;


// Set Starting Pos

	
				switch (side player) do {
 
						case west: {
						
						player setPos [2938.69,13107.5,400];
						//playSound "airplanes";
						
						
						};
 
						case east: {
						
						player setPos [2695.89,12334.4,400];
						//playSound "airplanes";
						
						
						};
						default {player setPos [0,0,0];};
 
				};

Share this post


Link to post
Share on other sites

I have fixed the JIP issue for setPos, but players are still invisible from eachother. Any ideas why? Here is the function that fixed my spawning issue, I found it in an older thread.

 

EDIT: fixed the invisible players by never hiding the units in the first place, instead i burried them 100M under the map :D

 

EDIT2: seems this is still not perfect, it more often than not drops any player that JIP from 2000m instead of 400... which i just dont get.

 

EDIT3: added more sleeps and it fixed it, guess it needed to "load"

waitUntil { !isNull player && time > 0 }; //after briefing
 
//Define UI ctrls
#define UIlevel 1000
#define UIprogress 1001
#define UIprogressBar 1002
#define UIcash 1003
#define UIkills 1004
#define UIredScore 1005
#define UIbluScore 1006
#define UIbluBar 1007
#define UIredBar 1008
#define UIendScore 1009
#define UIhealthBar 1010
#define UIhealthIcon 1011
#define UIdisplayFPS 1012


titleCut ["", "BLACK FADED", 999];
sleep 1;



// Set Starting Pos

	
				switch (side player) do {
 
						case west: {
						
						_position = [2938.69,13107.5,400];
						[_position] call neb_fnc_core_setStartingPos;
						
						playSound "airplanes";
						
						
						};
 
						case east: {
						
						_position = [2695.89,12334.4,400];
						[_position] call neb_fnc_core_setStartingPos;
						playSound "airplanes";
						
						
						};
						default {_position = [0,0,0];};
 
				};
	
   titlecut [" ","BLACK IN",5];
neb_fnc_core_setStartingPos = {
						params ["_position"];
						
						player setPos _position;    // _position
						diag_log format["setting player's position to: %1", _position];
						sleep 1;
						_real_player_pos = getPos player;
						diag_log format["position that has been set: %1", _real_player_pos];
						_tries = 0;
						sleep 1;
						
						
						while {abs(abs(_real_player_pos select 0) - abs(_position select 0))  > 10 or abs(abs(_real_player_pos select 1) - abs(_position select 1)) > 10} do {
							diag_log format["player pos is %1 which is not target pos %2. retrying...", _real_player_pos, _position];
							hint format["position wasn't set correctly; trying again... %1", _tries];
							sleep 1;
							_tries = _tries +1;
							player setPos _position;
							sleep 1;
							_real_player_pos = getPos player;
							diag_log format["player pos is %1 which is not target pos %2. retrying...", _real_player_pos, _position];
						};
};

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  

×