Jump to content
RicHornet

Addaction - Calling a script located outside the mission folder

Recommended Posts

Greetings,

 

I developed a script which can be called thru the action menu (Addaction command, defined for example in the unit's init field). All of this works perfectly when the script (.sqf file) is located inside the mission folder and called from there.

 

But I would like to be able to call the same script/.sqf file if and when this one is located outside the mission folder, for instance located in or called from the "e:\myarma3scripts\" folder/location or from any other location outside the mission folder for that matter. The purpose/objective for this would be to be able to call the script from a mission being developed in the editor before or without being saved and also (and personally, my main objective/purpose) to be able to add via console a unit that can use my script in any mission where the console is enabled.  

However, I tried to look everywhere but I couldn't find an answer to my question hence why I decided to ask here.

 

Thanks in advance for any replies.   

Share this post


Link to post
Share on other sites

I think that you could create your own addon only with that script, in this case you would have the script added everywhere in the game and you could call it whenever you want.


There are several mods that do that, they're just good scripts that people want to use in vanilla missions and with a mod, this script is added to every mission.

Share this post


Link to post
Share on other sites

I haven't done it myself, but supposedly you can reference external files with the loadFile command if filePatching is allowed/enabled. Someone correct me if I'm wrong.

  • Thanks 1

Share this post


Link to post
Share on other sites
21 hours ago, phronk said:

I haven't done it myself, but supposedly you can reference external files with the loadFile command if filePatching is allowed/enabled. Someone correct me if I'm wrong.

 

First of all thanks for the reply (and I also thank Erwin23p's reply).

 

I tried the following:

I put my scripts inside a folder called "p_gps" (without the quotes) and this same folder is located inside a folder called "Armascripts" in disk "E:".

 

So I started the game with the filePatching parameter enabled and in my mission and in the unit's init field I placed the following line:

contents = loadFile "E:\Armascripts\p_gps\gps.sqf";

 

but when I load the missions, I get the following error:

 

Script E:\Armascripts\p_gps\gps.sqf not found

 

Share this post


Link to post
Share on other sites

File patching will only allow for the loading of unpacked data from within the A3 directory. I think this used to be different, but not anymore.

  • Thanks 1

Share this post


Link to post
Share on other sites
On 5/21/2020 at 4:24 PM, target_practice said:

File patching will only allow for the loading of unpacked data from within the A3 directory. I think this used to be different, but not anymore.

 

So this means that if I put the script files inside the ArmA3 folder then it should work?

Share this post


Link to post
Share on other sites

Thanks for the reply target_practice!

 

I will definitely try that.

Share this post


Link to post
Share on other sites

Ok, I can confirm that it worked perfectly!

 

Thanks again for the help, target_practice!

And I also want to thank phronk for his tip about the filePatching parameter which was crucial to solve my problem! 

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

×