Jump to content
blaaz

initPlayerLocal.sqf problem

Recommended Posts

Hello guys,

 

I'm editing a training mission for my team, but I encounter an issue.
 

My initPlayerLocal.sqf seems to work fine when starting the mission in editor, both single & multiplayer.
But when I start the mission on dedicated server it's a no go, part of my code is not working.

	if(!hasInterface) exitWith {};

	hint "test";
	player moveInCargo C130;
	0 fadeRadio 0; //Lower radio volume to 0
	player addRating 100000; //Makes sure ai doesnt turn hostile when teamkilling
	player setVariable ["BIS_noCoreConversations", true]; //Disable scroll wheel conversations
	distanceFromDZ = -1;
	nul = player execVM "getDistanceFromDZ.sqf";

hint "test" works, but after that nothing works.
If I try an execVM on this file, same problem.

If I type manually "player moveInCargo C130;" , it works

I feel like I'm doing a noob mistake but can't find it.

Thanks for your help

Share this post


Link to post
Share on other sites

does C130 variable have any value assigned to it?

 

(you can see if it does by using the 'watch' field in the debug console, just type C130 in there and if it has a variable value, its value will appear in the line below, otherwise, it has none. and that is why it doesn't work)

 

if not then you'll need to assign the vehicle to a specific variable so the game knows what vehicle you mean

 

in the vehicle init box:

C130 = this;

'this' can only be used in the init box, since the game understands what vehicle you are talking about. In scripts it has to have a variable because there's many possible vehicles that could be the right one.  

 

you can also enable the error box by using -ShowScriptErrors startup parameter in the launcher, otherwise if you have logs enabled it just quietly gets reported in the background and it tells you nothing.

Share this post


Link to post
Share on other sites

C130 is variable name of my vehicle in the editor, typing manually player MoveInCargo C130 works (in debug console) but not in the initPlayerLocal.sqf when mission is on dedicated server.

 

EDIT :

 

I edited my init like this :

	if(!hasInterface) exitWith {};

	hint "test";
	hint "test2";
	//enableRadio false; //Disable Arma 3 regular radio
	//enableSentences false; //Disable Arma 3 regular radio chatter
	0 fadeRadio 0; //Lower radio volume to 0
		hint "test3";
	player addRating 100000; //Makes sure ai doesnt turn hostile when teamkilling
		hint "test4";
	player setVariable ["BIS_noCoreConversations", true]; //Disable scroll wheel conversations
		hint "test5";
	distanceFromDZ = -1;
		hint "test6";
	nul = player execVM "getDistanceFromDZ.sqf";
		hint "test7";
	nul = execVM "endMission.sqf";
		hint "test8";

Every hint "testx" works fine.
I try to put players directly in C130 with Eden but I got an issue, sometime player spawn in the vehicle but not in Cargo, just through it, so they die because they hit the aircraft in the air.
It seems to appear the first time I download the mission, it's weird...

Share this post


Link to post
Share on other sites

Probably because initialization order (not guaranteed as said in BI page).

Try the old:

waituntil {player == player};

or

waitUnit {time >0};

or even

waitUntil {local player && {getClientStateNumber > 8}};

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

×