Jump to content
remasters

onPlayerRespawn.sqf and InitPlayerLocal.sqf not firing

Recommended Posts

Hello

 

I've been trying to troubleshoot an issue I've had for a long time implementing these settings  on my mp mission after a player repawns:

player enableFatigue false;

player enableStamina false;

 

I have it on the init.sqf and it works fine untill the player respawns (whcih is expected) so going on advice on this forum I've added a "onPlayerRespawn.sqf" and added

 

if ((!isServer) && (player != player)) then
{
waitUntil {player == player};
};

player enableFatigue false;
player enableStamina false;
player moveInCargo boat_00;

I added " player moveInCargo boat_00;" later to test if the script is firing on respawn, it doesn't apear to be. I added another file "InitPlayerLocal.sqf" with the same line at the end, it doesnt apear to fire either.

 

This source for the mission is here, I run this on a dedicated server.
https://github.com/remasters3/arma3-old/tree/master/hostileaf.malden

 

Can anyone spot what I'm doing wrong?

 

Many thanks,

Share this post


Link to post
Share on other sites

onPlayerRespawn.sqf and initPlayerLocal;sqf are event scripts with useful embedded parameters (see the link).

player is already player at this step but using player can lead to weird behavior (player referring to corpse, especially for instant respawn)

 

So start your scripts with something like:

_plyr = _this select 0; // here _plyr is the local variable you have to refer for the rest of the code.

 

Also, be sure boat_00 is a known variable on player's PC (locality)

For example:

boat_00 = this; in init field of an edited boat >> will work because every player runs the mission.sqm at start.

boat_00 spawned by a script on server (server only to avoid duplication) >> boat_00 is a variable (object) known on server but not on clients.

(you'll see the boat, but cursortarget will not return boat_00 in console).

 

Share this post


Link to post
Share on other sites

Thanks for the reply.

I've just tried this and it had no effect, I did actually try something similar before but used "_plyr = _this select 0; " to set the var instead of  " _plyr == _this select 0; "

out of interest, why did you use "==" instead of just "=" ?

 

I'm wondering If the script not firing has something to do with the contents of my dexcription.ext but can't see anything.

https://github.com/remasters3/arma3-old/blob/master/hostileaf.malden/description.ext

 

Share this post


Link to post
Share on other sites

The moveInCargo command needs both arguments (player and vehicle) to be local. I tried to use it a few weeks ago too but had no success. Also take a look at Note 1 from moveInCargo BIKI page.

Share this post


Link to post
Share on other sites

Thanks 7erra

 

I was just using "moveInCargo" to test If the script is working however I think you may have something regarding the original problem with "enableFatigue"

 

Share this post


Link to post
Share on other sites

Locality (client player) could be the problem.

Not tested:

_plyr = _this select 0;

[_plyr,boat_00] remoteExec ["moveInCargo",2];

 

Share this post


Link to post
Share on other sites

intersetingly this works in the "initPlayerLocal.sqf" but not with "onPlayerRespawn.sqf"

if ((!isServer) && (player != player)) then
{
waitUntil {player == player};
};
_plyr = _this select 0;
_plyr enableFatigue false;
_plyr enableStamina false;
_plyr moveInCargo boat_00;

I actually think "onPlayerRespawn.sqf" isn't working, possibly a bug in the linux version.

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

×