Can you check if the user has a mod installed via script?

Post » Sat May 28, 2011 6:57 am

Okay, so I recently had an idea for a mod that I'm not really going to explain in detail right now, but pretty much what I want to know is if it would be possible to run a script whenever is launched that will check to see if a specific esp is active, and if it is then place certain NPC's or objects into the game world. In this case, for example my NewMod.esp would check to see if ArmorModX.esp is running. If this esp is active, it will then place an NPC from NewMod.esp into a cell added by NewMod.esp. If this is not plausible, could I instead run a search for a specific resource? Such as if textures/ArmorX/GreenCuirass exists, then NewMod.esp will add the NPC? I have very little experience with the Oblivion scripting language (though I've spent a decent amount of time with C++ and Java), and as such wanted to know (a) if this could be done, and (B) how, in theory, it would. Thank you for your time!

CC
User avatar
Christine Pane
 
Posts: 3306
Joined: Mon Apr 23, 2007 2:14 am

Post » Sat May 28, 2011 1:41 am

http://obse.silverlock.org/obse_command_doc.html#IsModLoaded

IsModLoaded is easy.

Adding the armor may be more difficult. You might have to use "runscriptline" since directly referring to anything from the other mod wouldn't compile.
User avatar
Poetic Vice
 
Posts: 3440
Joined: Wed Oct 31, 2007 8:19 pm

Post » Sat May 28, 2011 8:38 am

http://obse.silverlock.org/obse_command_doc.html#IsModLoaded

IsModLoaded is easy.

Adding the armor may be more difficult. You might have to use "runscriptline" since directly referring to anything from the other mod wouldn't compile.


Nice, thank you!

Anyway, I wasn't planning to directly add the armor from the mod(s), but rather I would create a new armor ID using the meshes from that mod (whether or not it is loaded), and have an NPC wearing said armor, but of course if the mod isn't loaded he'll have the invisible missing mesh glitch and stuff, so I would run the script before loading the NPC and if the mod wasn't active I would place a different NPC wearing Vanilla armor.

Anyhoo, thanks for your time; now that I know this is doable I will have to spend some time brushing up on Oblivion scripting and seeing if I can make something awesome ;)

CC
User avatar
Stephani Silva
 
Posts: 3372
Joined: Wed Jan 17, 2007 10:11 pm

Post » Fri May 27, 2011 10:06 pm

Side question (which I am just asking here because I've already explained what I'm doing); were I to use the meshes from another mod this way, would I need to ask permission from the author, or just give him credit as I'm not actually redistributing any of his/her work?
User avatar
James Wilson
 
Posts: 3457
Joined: Mon Nov 12, 2007 12:51 pm

Post » Fri May 27, 2011 10:44 pm

You're not redistributing his/her work, but you are using it.

Depending on the restrictions the modder placed on their work, you should at least provide credit, and probably ask permission as well. Some creators like to keep their work unique.
User avatar
Lucy
 
Posts: 3362
Joined: Sun Sep 10, 2006 4:55 am

Post » Fri May 27, 2011 9:31 pm

You're not redistributing his/her work, but you are using it.

Depending on the restrictions the modder placed on their work, you should at least provide credit, and probably ask permission as well. Some creators like to keep their work unique.


Ok, cool, thanks for the clarification!
User avatar
Kelvin
 
Posts: 3405
Joined: Sat Nov 17, 2007 10:22 am

Post » Sat May 28, 2011 6:25 am

If you do have permission, it's much easier all round to redistribute the copied mesh, and also more effiicient. You'll need to test if the other mod has been uninstalled between loads of the game and swap that NPC accordingly, and it's easy to end up with a lot of pointless scripts running all the time just to keep thing working when the load order changes.

There is a GetFormFromMod function in OBSE that gives you access to an item in another mod, once you know it's loaded. I use it to provide Open Cities compatibility where the player has to interact with an item that could either be the original, or its counterpart in an Open city. I do all the adjustments to item refs in a single script that uses GetGameLoaded to run at startup once per load of the game, so it's not an overhead during play. In all other cases where I want to use an item from another mod, I get permission to include a copy in my own mod, and do it that way because it's simpler.
User avatar
Erich Lendermon
 
Posts: 3322
Joined: Sat Nov 03, 2007 4:20 pm

Post » Fri May 27, 2011 7:45 pm

If you do have permission, it's much easier all round to redistribute the copied mesh, and also more effiicient. You'll need to test if the other mod has been uninstalled between loads of the game and swap that NPC accordingly, and it's easy to end up with a lot of pointless scripts running all the time just to keep thing working when the load order changes.

There is a GetFormFromMod function in OBSE that gives you access to an item in another mod, once you know it's loaded. I use it to provide Open Cities compatibility where the player has to interact with an item that could either be the original, or its counterpart in an Open city. I do all the adjustments to item refs in a single script that uses GetGameLoaded to run at startup once per load of the game, so it's not an overhead during play. In all other cases where I want to use an item from another mod, I get permission to include a copy in my own mod, and do it that way because it's simpler.


Ah, that "GetFormFromMod" thing may save me much time (assuming I go ahead and make what I'm thinking of). Including the resources would not work for the mod I am trying to accomplish here, but we'll see; hopefully I'll have the time to build up a test version for myself to decide if it warrants a WiP thread :/
User avatar
Patrick Gordon
 
Posts: 3366
Joined: Thu May 31, 2007 5:38 am


Return to IV - Oblivion