Loading from a SIDE in another mod folder
Posted: Wed Jun 17, 2009 9:06 pm
OK, example..... when I built my jedis for -SMD- Dream Teams I made a world that loaded up the shipped naboo map. So i didnt have a world, just some lua script. One by one I added my jedis creating a big jedis brawl. As I ran out of slots, I removed some jedis and just kept on adding more. When I was done I had a Naboo full of jedis, and was quite happy with how things went. Now it was time to make more maps and decide which jedis would play which worlds blah blah blah... how was I going to do it ?
Most people would create a SIDE for the game rather than have a SIDE stuck in some mod world, but this is highly unecessary and to me it would just complicate the install and uninstall. I think it may also run more risks of incompatibilty.
I swear I looked for this, even using google and so if its an old topic I apologize, but at least this one people will find.
As some of you may know the string "..\\" is a relative file reference that goes back one directory. If you have had to program relative paths that are not subdirectories but are parent directories, then you have probably come across this. As it happens, to go from one mod directory to another, we need to back up three directories. We can do this using "..\\..\\..\\".
Well in my example my jedi naboo mod folder is called Z2N and I want to load stuff from there into another mod. I use the line :
ReadDataFile("dc:..\\..\\..\\Z2N\\data\\_LVL_PC\\SIDE\\smd.lvl",
"smd_hero_gungan3", "smd_hero_chewbacca", "smd_hero_drako",
"smd_hero_anakin")
to load up four of the 32 jedis stored in the SIDE folder for Z2N. As you know if the SIDE was in my current mods folder I would use the line dc:SIDE\\smd.lvl
As it happens the game is coded to see the dc: (downloadable content) and jump to the XXX\\data\\_LVL_PC folder....and thats why dc:SIDE\\ works because its a relative path to the current directory.
Once I realized this I kept adding custom classes where i needed them, with some organization, and simply loading them into other maps using a relative path. It was great because it kept my installs as a simple zip, while still enabling me to make expansions that built upon my previous work.
Most people would create a SIDE for the game rather than have a SIDE stuck in some mod world, but this is highly unecessary and to me it would just complicate the install and uninstall. I think it may also run more risks of incompatibilty.
I swear I looked for this, even using google and so if its an old topic I apologize, but at least this one people will find.
As some of you may know the string "..\\" is a relative file reference that goes back one directory. If you have had to program relative paths that are not subdirectories but are parent directories, then you have probably come across this. As it happens, to go from one mod directory to another, we need to back up three directories. We can do this using "..\\..\\..\\".
Well in my example my jedi naboo mod folder is called Z2N and I want to load stuff from there into another mod. I use the line :
ReadDataFile("dc:..\\..\\..\\Z2N\\data\\_LVL_PC\\SIDE\\smd.lvl",
"smd_hero_gungan3", "smd_hero_chewbacca", "smd_hero_drako",
"smd_hero_anakin")
to load up four of the 32 jedis stored in the SIDE folder for Z2N. As you know if the SIDE was in my current mods folder I would use the line dc:SIDE\\smd.lvl
As it happens the game is coded to see the dc: (downloadable content) and jump to the XXX\\data\\_LVL_PC folder....and thats why dc:SIDE\\ works because its a relative path to the current directory.
Once I realized this I kept adding custom classes where i needed them, with some organization, and simply loading them into other maps using a relative path. It was great because it kept my installs as a simple zip, while still enabling me to make expansions that built upon my previous work.