JGames Family 5 Posted April 4, 2020 Hi, I want to pùt a wait until the player has this variable in local player init: player set variable ["FinishedLoading",true,true]; I tried: waitUntil { (player getVariable "FinishedLoading") = true }; and waitUntil { (profileNamespace getVariable "FinishedLoading") = true }; with no sucess... any help? Thx Share this post Link to post Share on other sites
wogz187 1086 Posted April 4, 2020 @JGames Family, It's been a while since I was at this but I believe if you want to use "waitUntil" in an init you need to spawn it. Something like this, [] spawn {waitUntil { (player getVariable "FinishedLoading") = true };}; Have fun! 1 Share this post Link to post Share on other sites
JGames Family 5 Posted April 4, 2020 On 4/4/2020 at 2:52 PM, wogz187 said: @JGames Family, It's been a while since I was at this but I believe if you want to use "waitUntil" in an init you need to spawn it. Something like this, [] spawn {waitUntil { (player getVariable "FinishedLoading") = true };}; Have fun! Did it, no success 1 Share this post Link to post Share on other sites
JGames Family 5 Posted April 4, 2020 Can I put like [] spawn {waitUntil { (player enableSimulation) = true };}; Share this post Link to post Share on other sites
JGames Family 5 Posted April 4, 2020 Doesn't work, what is it wrong... I tried with [] spawn {waitUntil { (player enableSimulation) isEqualTo true };}; also with no success... any help? Share this post Link to post Share on other sites
POLPOX 779 Posted April 4, 2020 Depends on what exactly you wanted to do. I see nothing about things you wanted to do. Every codes in this topic are completely useless though. 1 1 Share this post Link to post Share on other sites
JGames Family 5 Posted April 4, 2020 Ok, so I want to make so that when it finishes loading (When it finishes loading it enables the simulation or put that variable in the player for example) it continues reading the init SQF to execute the rest of the scripts. @POLPOX Share this post Link to post Share on other sites
Harzach 2518 Posted April 4, 2020 Without addressing the validity of the rest of your code, understand that "=" is an assignment operator. you want the comparison operator "==". 1 Share this post Link to post Share on other sites
JGames Family 5 Posted April 4, 2020 On 4/4/2020 at 3:43 PM, Harzach said: Without addressing the validity of the rest of your code, understand that "=" is an assignment operator. you want the comparison operator "==". Tried both with no success Share this post Link to post Share on other sites
POLPOX 779 Posted April 4, 2020 On 4/4/2020 at 3:39 PM, JGames Family said: Ok, so I want to make so that when it finishes loading (When it finishes loading it enables the simulation or put that variable in the player for example) it continues reading the init SQF to execute the rest of the scripts. I use waitUntil {time != 0}; for the purpose. (I know this is a dumb thing though) On 4/4/2020 at 3:43 PM, Harzach said: Without addressing the validity of the rest of your code, understand that "=" is an assignment operator. you want the comparison operator "==". Also, checking boolean (true/false) never requires operators. 2 Share this post Link to post Share on other sites
Harzach 2518 Posted April 4, 2020 On 4/4/2020 at 3:48 PM, POLPOX said: Also, checking boolean (true/false) never requires operators. Indeed, I just like taking it one thing at a time. 🙂 Share this post Link to post Share on other sites
JGames Family 5 Posted April 4, 2020 yeah but time can vary so might be better when its all loaded u know On 4/4/2020 at 3:48 PM, POLPOX said: I use waitUntil {time != 0}; for the purpose. (I know this is a dumb thing though) Also, checking boolean (true/false) never requires operators. Share this post Link to post Share on other sites
wogz187 1086 Posted April 4, 2020 @JGames Family, Again, not exactly on point with sqf but the code would look something like (to paste in an init): loadFIN=[] spawn { waitUntil { (player getVariable ["FinishedLoading", false]) }; }; of course that isn't going to do anything because the script to determine "finishedLoading" would accomplish the same thing. This would be an extra step in that process. However you determine "finishedLoading" would serve the same purpose as the above. Share what comes next and share how "FinishedLoading" is determined. Have fun! 1 Share this post Link to post Share on other sites
POLPOX 779 Posted April 4, 2020 On 4/4/2020 at 3:52 PM, JGames Family said: yeah but time can vary so might be better when its all loaded u know The condition will be fulfilled as soon as you started the mission, so would fit but isn't that what you want? 1 Share this post Link to post Share on other sites
JGames Family 5 Posted April 4, 2020 On 4/4/2020 at 4:01 PM, wogz187 said: @JGames Family, Again, not exactly on point with sqf but the code would look something like (to paste in an init): loadFIN=[] spawn { waitUntil { (player getVariable ["FinishedLoading", false]) }; }; of course that isn't going to do anything because the script to determine "finishedLoading" would accomplish the same thing. This would be an extra step in that process. However you determine "finishedLoading" would serve the same purpose as the above. Share what comes next and share how "FinishedLoading" is determined. Have fun! Its a loading screen, after that loading screen I wad when a player has finished loading I want to continue it reading the script Share this post Link to post Share on other sites
JGames Family 5 Posted April 4, 2020 https://community.bistudio.com/wiki/getVariable It says getVariable only accept private variables or MissionNamespace... What would be to search for variables in the whole mission? Share this post Link to post Share on other sites
wogz187 1086 Posted April 4, 2020 @JGames Family, Quote "Its a loading screen, after that loading screen I wad when a player has finished loading I want to continue it reading the script" So at the end of your custom loading script you switch the player variable "finishedLoading" to true? Is that right? Share this post Link to post Share on other sites
JGames Family 5 Posted April 4, 2020 yeah On 4/4/2020 at 4:36 PM, wogz187 said: @JGames Family, So at the end of your custom loading script you switch the player variable "finishedLoading" to true? Is that right? Share this post Link to post Share on other sites
wogz187 1086 Posted April 4, 2020 @JGames Family, So you, 1) init player variable? player setVariable ["FinishedLoading", false]; 2) set the variable via script? player setVariable ["FinishedLoading", true]; 3) put code in the unit init? What if you change the boolean to numbers? player setVariable ["FinishedLoading", 0]; player setVariable ["FinishedLoading", 1]; loadFIN=[] spawn { waitUntil { (player getVariable ["FinishedLoading", 0]==1) }; }; 1 Share this post Link to post Share on other sites
Larrow 2827 Posted April 4, 2020 //initPlayerLocal.sqf [] spawn { [ "loadPlayerData" ] call BIS_fnc_startLoadingScreen; //simulate some time taken for loading data uiSleep 20; [ "loadPlayerData" ] call BIS_fnc_endLoadingScreen; TAG_loadedData = true; }; waitUntil{ missionNamespace getVariable[ "TAG_loadedData", false ] }; hint "Done!"; //Do rest of code 3 Share this post Link to post Share on other sites