Jump to content

Are scripts in archives (ba2) ignored sometimes?


Lonewanderer

Recommended Posts

Hello,

this is a beginners question: I know, that the UFO4P has all its changed scripts in the ba2-archive, and obviously the game uses the archive and the scripts.

Now - I have just one script (a new script, does not override anything). It is the CompanionCommand script from the Companion Commands mod. The mod uses a console command (cgf, call global function) to call the new functions, it allows to change distance, aggression and more. It uses console hotkeys so that you can use the keyboard to call it. This mechanism works fine.

But the mod author supplied his script CompanionCommand.pex and installs it to data/scripts. If I enable loose files, it works nice.

But I wanted to have an archive.

First try: Create an empty plugin named 'CompanionCommand.esp' with FO4Edit. Used the archive2-tool to create an archive named 'CompanionCommand - Main.ba2' which contained this script, it is stored under scripts/CompanionCommand.pex.

Did not work: The script does not exist. The mod is loaded (and LOOT says it will load an archive), but the new global script does not exist, and if I use the console to call it, it says so. The console hotkeys work fine, because I also added a hotkey to switch on and of the menu overlayer in the game (tm). I do not need to open the console, I can just use the key.

Second try: Open CreationKit, use the supplied source of the CompanionCommand-script, compile it, create an archive named 'CompanionCommand - Main.ba2' from the CreationKit and save it all to an empty mod named 'CompanionCommand.esp'. The result is the same, one mod, which only contains a header and a ba2 archive which contains the compiled script.

This also does not work! Why? Am I doing something wrong? Or is this a bug, that a single script, or scripts with an empty plugin are not used? LOOT recognizes the mod, sorts it at the end after UFO4P, and says it loads an archive. But it does not, obviously, recognize the single script in the archive.

If I enable loose files, and have the script sitting in data/scripts all works nicely. I can use a configured hotkey to give commands, to change the distance and several other things.

But why does it not work with archives?

(Btw I am using just this one mod and UFO4P)

The script is not my work, I just tried to put it to an archive.

I added my 'mod', the esp and the archive in a ZIP, if somebody wants to try it out. The two files are the result from the second try, i.e. done with CreationKit. The mod alone will not work with hotkeys, but with the console one should be able to call the script, for example one can type cgf CompanionCommand.ToggleDistance.

Thank you.

CompanionCommandMod-with-Archive.zip

Link to comment
Share on other sites

For that think all you have to do is to set up a quest and run it through the Story Manager.

Edit: Have you set up a custom ini for the CK with the setting? Take it the loose files been enabled for the game as per IP's guide.

Link to comment
Share on other sites

7 hours ago, lmstearn said:

For that think all you have to do is to set up a quest and run it through the Story Manager.

Edit: Have you set up a custom ini for the CK with the setting? Take it the loose files been enabled for the game as per IP's guide.

Hm - I just want to add a global function. This is what the mod does. There is no need for a quest. The original mod provides just the script (and instructions how to enable console hotkeys, but this works nicely). The original mod puts the script to data/scripts as a loose file. Since it is often said its better to archive files, I tried to do it.

The INI for CK should be okay. When I put the source of the script to its folder /data/scripts/user/ the CK found it and I was able to compile it in the CK.

In the game loose files are enabled at this time, since it does not work with a single script in an archive - the game seems to ignore it. It accepts the script as a loose file. The script itself is a set of new global functions, nothing is overridden or changed. As long as nothing calls these functions, they will be inactive and sitting there and take up a bit of memory. The console hotkeys are supposed to call several of these new functions. All this is not my work - and it works fine. Only the method to add this with an archive does not work for some reason.

I probably could add the script to UFO4P's archive and test, if it is accepted then. It does not override anything, it is entirely new. But this would be impractical, since with every update of UFO4P I would need to repeat it.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...