twistking 204 Posted May 4, 2020 Hello, is there a simple way to have commands in init.sqf or objects init only register for players, that are not JIP? Soemthing like: if (isJIP) exit with {} ??? or maybe (if my_globalvariable == true) exit with {} and then have the variable set just after mission has started? Would a JIP client even see the variable before init? If so, how would i define such a global variable? Spoiler Background: Like many others i struggle with bis_fnc_ambientAnim not working well in MP. Remote executing works, but is not reliable enough (some weird behaviour every now and then). So instead of remoteExecuting it, i want to try having it in init for everyone without remoteExec. It should not fire for JIP players though, because the units doing the animations get their animatiosn termianted after a short time and a rejoining JIP player would probably force the unit back into the animation. Thanks Share this post Link to post Share on other sites
jshock 513 Posted May 4, 2020 Create an initPlayerLocal.sqf and do this: params [“_player”,”_didJIP”]; if !(_didJIP) then { //do what you want for non-JIPs }; https://community.bistudio.com/wiki/Event_Scripts 2 1 Share this post Link to post Share on other sites
twistking 204 Posted May 4, 2020 Thanks, @jshock. that looks very elegant! Two questions, just to make sure, i understand correctly how it works: 1. Would the following code, do the same? (That's just the way i'm usually doing those type of aborts on my very, very simple scripts) params [“_player”,”_didJIP”]; if (_didJIP) exitwith {}; hint "you probably can't read this because you're still stuck in init phase but at least you are not JIP"; 2. Why do i need the first line? I assume that while initPlayerLocal.sqf comes with these two parameters per default, they have yet to be named? So i could name them differently, if i then stick with the name i've given? Also if a script came with only one parameter, could i simply use _this instead of defining it with params ["something"]? Share this post Link to post Share on other sites
Harzach 2516 Posted May 4, 2020 params takes a script's input arguments and turns them into private variables. The first line is the equivalent of: private _player = _this select 0; private _didJIP = _this select 1; You could change those variables, but keeping them as is helps maintain a certain degree of integrity. 1 1 Share this post Link to post Share on other sites
jshock 513 Posted May 4, 2020 1. Assuming you don’t need to call any other scripts for JIPs you could do it your way without issue. 2. The first line from above is the same as: private _player = _this select 0; private _didJIP = _this select 1; //which is also the same as private _player = _this#0; private _didJIP = _this#1; The reason you need to use params or access _this is because those are the parameters being provided to the script when it is executed. The name of the variables are up to you, but these are self explanatory in nature as to not confuse each other as they are named now. The special variable “_this” is the array of parameters passed into a script, and as you can see in the all three examples there are a number of ways to access that information. The “params” command is cleaner, more elegant, and allows for easy input verification (i.e. data type, etc). But it’s completely up to you and what you’re comfortable with. 2 1 Share this post Link to post Share on other sites
whiztler 137 Posted May 4, 2020 There is an engine command to check if a client jipped: didJIP 1 Share this post Link to post Share on other sites