Jump to content

Loading textures or liveries via LUA conditionally (for custom cockpit)


Recommended Posts

Posted (edited)

Good morning friends.

I hope you guys can point me in the right direction.

I am trying to add a Custom Cockpit option for a Mod.  I am reverse-engineering the process from current aircraft that have this functionality, and everything works (even dynamic loading of /Liveries/Cockpit_XXModName folders) up to the point of the actual LOADING of the textures (which "more or less" work already).

I am using the `mount_vfs_texture_path` in order to load the folder containing the selected custom cockpit.  The first question is:

  • I'm not sure which is the correct script to do this "conditional" assignment.  I am using the Cockpit scripts that I have found run every mission start, as opposed to the entry.lua of the mod which appears to run only on DCS load.

Now, after putting the code into the Cockpit scripts, what happens is the following:

  • Upon opening DCS, the default cockpit is selected, the default textures are loaded, it works as expected
  • Upon changing the custom cockpit and entering a mission, the `mount_vfs_texture_path` function is correctly called and loads the new texture path on top of texture "stack" (to give it a name), and things STILL work as expected, I get the new textures inside the cockpit... howerver,
  • When I revert to a "previous" option that already has it's place in the "stack", I am assuming that the "mount" detects that a particular path is already mounted and therefore the stack "order" is unmodified and I get the previous (wrong) texture upon entering the plane

 

If I close DCS and open it back, the stack is now correct and I see the last selected version.

So, as you can see... things "mostly" work, but it would be really nice if I could have this behavior without having to close DCS if I want to revert to a previously selected cockpit.

I was hoping to reverse-engineer the different modules that benefit from the custom cockpit functionality and the CPLocalList data in the options, but I have failed to see how this Option or Data is actually triggering the loading, mounting, copying, assigning or whatever method is use for it.

Things that could work but I have no idea where to look for functions, commands or utilities to achieve my goal:

  • not "mount" the texture folder, but do a temporary assign or use another function that does not "stack" things together
  • not mount a texture path but treat it as livery, but not sure how to assign a specific livery (as opposed to texture pack) and also be able to use the actual liveries for the mod
  • un-mount all custom texture paths before mounting the "current one", but I cannot find a way to un-mount paths
  • use a single location where the current textures are stored and replace the actual files copying from other locations, but this really seems like the wrong approach
  • anything else that I could be missing and that you gurus here may point me towards

 

Also, I hate to ask this question that seems like I could better research reading documentation or language references or available APIs and functions from DCS exposed to the Mods, but I am finding remarkably little info about it.  Most is centered around mission editor, but very little in the way of this aspect of modding.  If I am looking in the wrong place and there are some references I could look into, I would really appreciate a pointer in the right direction.

Thanks a lot for any insight, pointers, further questions to better outline my problem or general ideas that might work.

Best regards,
Rafa.

 

Edited by RafaPolit

I'm Dragon in the Multiplayer servers.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...