Jump to content
Sign in to follow this  
l4z0rr0b0tz

"Player" object in Local scripts, multiplayer

Recommended Posts

Hey all,
I'm working on a lot of scripts for multiplayer right now, and I'm wondering what the best place is to call a function using the "Player" object to avoid locality issues in my scripts.

I have for the time being adapted the strategy of calling all my functions from initPlayerLocal.sqf in such a way:  _nul = [player] execVM "blah.sqf";  and then assigning _p = _this select 0; for all scripts further down the "tree".

I am also using such things as [player,"acts_carFixingwheel"] remoteExec ["l4z0r_fnc_mp_anim",0,false]

 

where l4z0r_fnc_mp_anim = {

_p = _this select 0;
_anim = _this select 1;
_p switchmove _anim
};
 

This is a script to fire an animation on everyone's computers.

 

My question for more experienced MP scripters:  Will this strategy of keeping "player" in initPlayerLocal keep me from having problems with locality and the "player" object?

Thanks in advance

Share this post


Link to post
Share on other sites
1 hour ago, l4z0rr0b0tz said:

[player,"acts_carFixingwheel"] remoteExec ["l4z0r_fnc_mp_anim",0,true]

 

No!

  • Like 1

Share this post


Link to post
Share on other sites

Thanks for the reply!

I don't know much about the JIP queue, what is the problem with using it in this situation?  Would it lag the server out or cause some other problem?

By the way KK I'm a big fan of your scripting tutorials.  Thanks for doing those.

Share this post


Link to post
Share on other sites

Every time you make that call to remoteExec it will add switchMove animation to jip queue, so that when new player joins he can see that animation. There is no need to make it persistent. It will clog the jip queue with calls you don't need, and joining player would most likely be like WTF is going on here with all players around him doing weird animations. I suggest you dont use JIP flag unless you know exactly why you should use it

  • Like 1

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  

×