iV - Ghost 50 Posted June 23, 2018 I'm using a file in every of my missions for checking and setting the players rank. Is it possible to use only 1 file in my route directory for all my missions? initPlayerLocel.sqf execVM "scripts\misc\RankSystem.sqf"; RankSystem.sqf /* * * Filename: RankSystem.sqf * Author: [iV] Ghost * Description: Manage ranks by steam ID * */ RankCORPORAL = [ ... ]; RankSERGEANT = [ ... ]; RankLIEUTENANT = [ ... ]; RankCAPTAIN = [ ... ]; RankMAJOR = [ ... ]; RankCOLONEL = [ ... ]; // GET PLAYER UID private _playerUID = getPlayerUID player; // CHECK ARRAY AND SET RANK switch (true) do { case (_playerUID in RankCORPORAL) : { player setRank "CORPORAL"; }; case (_playerUID in RankSERGEANT) : { player setRank "SERGEANT"; }; case (_playerUID in RankLIEUTENANT) : { player setRank "LIEUTENANT"; }; case (_playerUID in RankCAPTAIN) : { player setRank "CAPTAIN"; }; case (_playerUID in RankMAJOR) : { player setRank "MAJOR"; }; case (_playerUID in RankCOLONEL) : { player setRank "COLONEL"; }; default { player setRank "PRIVATE"; }; }; Share this post Link to post Share on other sites
pierremgi 4909 Posted June 23, 2018 Perhaps, this could help: https://community.bistudio.com/wiki/Script_Path https://forums.bohemia.net/forums/topic/175141-loading-settings-from-external-files/ Share this post Link to post Share on other sites
iV - Ghost 50 Posted June 23, 2018 I think my path start in the directory of the missions.sqf. If I wanna use a folder outside my mission I have to go 2 steps back. Maybe something like this: initPlayerLocal.sqf execVM "..\..\userconfig\RankSystem.sqf"; But never seen in Arma3 till now. I was hoping someone would gain experience there as well. Share this post Link to post Share on other sites
Dedmen 2721 Posted June 25, 2018 On 23.6.2018 at 10:20 PM, pierremgi said: https://community.bistudio.com/wiki/Script_Path Not valid for Arma 3 On 23.6.2018 at 10:37 PM, iV - Ghost said: execVM "..\..\userconfig\RankSystem.sqf"; To get to the userconfig just start your path with \. \ is the root directory and if it doesn't find the file in a pbo and -filePatching (https://community.bistudio.com/wiki/Arma_3_Startup_Parameters) is enabled it will look in Arma directory. Meaning execVM "\userconfig\RankSystem.sqf" will execute the SteamApps/Common/Arma 3/userconfig/RankSystem.sqf file. Keep in mind that this file has to be present on every players computer. 2 Share this post Link to post Share on other sites
iV - Ghost 50 Posted June 25, 2018 Quote Keep in mind that this file has to be present on every players computer. Also I can't put this file (in my case) in the root directory of the server? I don't really understand. Why it works with the cba_settings.sqf? Share this post Link to post Share on other sites
Naiss 28 Posted June 26, 2018 if you make it into function you can just publicVariable it and it can be server sided like this "ArmA 3\serversided\script.sqf"; //Script.sqf Function_Name = { //Script here }; publicVariable "Function_Name"; then you make a initServer.sqf in the mission file and add this: [] execVM "\serversided\script.sqf"; And add this into initPlayerLocal.sqf: [] execVM Function_Name; Share this post Link to post Share on other sites
Dedmen 2721 Posted June 26, 2018 On 25.6.2018 at 3:57 PM, iV - Ghost said: I don't really understand. Why it works with the cba_settings.sqf? It doesn't. cba_settings.sqf is only loaded serverside. So it only has to work serverside, which it does. You can also use your script serverside only. But you cannot use a script on the client that the client doesn't have. On 25.6.2018 at 3:57 PM, iV - Ghost said: Also I can't put this file (in my case) in the root directory of the server? You could do that if you really wanted. Share this post Link to post Share on other sites
pierremgi 4909 Posted June 26, 2018 7 hours ago, lifemanlive said: if you make it into function you can just publicVariable it and it can be server sided like this "ArmA 3\serversided\script.sqf"; //Script.sqf Function_Name = { //Script here }; publicVariable "Function_Name"; then you make a initServer.sqf in the mission file and add this: [] execVM "\serversided\script.sqf"; And add this into initPlayerLocal.sqf: [] execVM Function_Name; That's a waste of network capacity. Why publicVariable a function and call it from initPlayerLocal when you can paste it inside, or call a local file??? Share this post Link to post Share on other sites
Belbo 462 Posted June 26, 2018 Ridiculous. I use the same 611 files in every mission. Utilise the means you got, to create an easier workflow. If you're so keen on externalising your mission scripts (which is, as I mentioned before, completely unnecessary), create an addon with a cfgFunctions. But you won't do your players any favours either way. Just put the scripts in your mission-folder. 1 Share this post Link to post Share on other sites
iV - Ghost 50 Posted June 26, 2018 Thx at all for trying to help me. I wanna use only 1 file for all my missions (5 for now. But become more). So if I have to change the ranks from our community I have to work only at this one file and not more. This saves a lot of time. Share this post Link to post Share on other sites
pierremgi 4909 Posted June 26, 2018 35 minutes ago, iV - Ghost said: Thx at all for trying to help me. I wanna use only 1 file for all my missions (5 for now. But become more). So if I have to change the ranks from our community I have to work only at this one file and not more. This saves a lot of time. If it's just a rank question, you can save all data in profileNameSpace. Share this post Link to post Share on other sites
iV - Ghost 50 Posted June 26, 2018 OK. This looks interesting. Could be a way. But is it possible for the player to manipulate the file? Share this post Link to post Share on other sites
pierremgi 4909 Posted June 26, 2018 6 minutes ago, iV - Ghost said: OK. This looks interesting. Could be a way. But is it possible for the player to manipulate the file? Sure, if they know how to do. If you need a server save for your player, like wasteland, it's more complex. You can cope with some event handler for connection /disconnection but you should ask that in the right section. Share this post Link to post Share on other sites
Naiss 28 Posted June 27, 2018 13 hours ago, pierremgi said: That's a waste of network capacity. Why publicVariable a function and call it from initPlayerLocal when you can paste it inside, or call a local file??? From what I understood he wanted the code server sided and one function will not hurt at all. Share this post Link to post Share on other sites
HazJ 1289 Posted June 27, 2018 1 hour ago, lifemanlive said: From what I understood he wanted the code server sided and one function will not hurt at all. Agree. 14 hours ago, iV - Ghost said: OK. This looks interesting. Could be a way. But is it possible for the player to manipulate the file? You can save to server profile but then it is server specific. Share this post Link to post Share on other sites