Barathor
Emperor
- Joined
- May 7, 2011
- Messages
- 1,202
Basically, what is the best approach to modding some functions within AssignStartingPlots (or others)?
If I include a copy of the entire AssignStartingPlots within my mod and edit the code within it, it'll affect all maps generated; which I suppose is nice. But, then any other mod that also includeds AssignStartingPlots will break things.
Also, now I've just learned that any map scripts that replace functions within ASP (like Highlands) will also break the mod if you also included the entire ASP file in your mod. Is that correct, or did I misunderstand it?
The only safe alternative I know of is to create uniquely named map scripts that include the modified ASP functions (and other functions from other scripts). When I can, I try to just change variable values before calling the existing functions within the map script, but sometimes I have to replace the whole function.
So, I would need to select a number of different map types (Continents, Pangaea, etc.) and create unique versions of them. But, then that limits a player's choice of map when playing the mod. Yes, this is only a very minor issue.
So, other than that last method, are there any other options? I'm just curious.
------
Also, here's another question about LUA functions regarding project modularity:
I'll give a specific example so it's clearer.
I'm trying to make my project as modular as it can be so that each user with their unique tastes can play it as they wish. They'd do this by just either deleting, moving, or adding an affix to the name of the folder that contains the undesired code.
So, I have a folder that contains a modification to deserts and sets their base yield at 1 production (with other modifications to things related to deserts for balance). But, I also wanted to do it the right way, and I edited the fertility functions within AssignStartingPlots.
I know this wouldn't be a welcome change for some players, and they would want to disable the code within its folder. But, how do I go about enabling, disabling the fertility functions? Is there a way that I can create a unique LUA file that overrides the fertility functions within ASP?
As in, if a player uses this particular modification, the unique LUA file will override the existing functions within ASP with its modified ones. If a player disables this modification (using the folder method), then the mod will function normally and will just utilize the existing functions within ASP.
If I include a copy of the entire AssignStartingPlots within my mod and edit the code within it, it'll affect all maps generated; which I suppose is nice. But, then any other mod that also includeds AssignStartingPlots will break things.
Also, now I've just learned that any map scripts that replace functions within ASP (like Highlands) will also break the mod if you also included the entire ASP file in your mod. Is that correct, or did I misunderstand it?
The only safe alternative I know of is to create uniquely named map scripts that include the modified ASP functions (and other functions from other scripts). When I can, I try to just change variable values before calling the existing functions within the map script, but sometimes I have to replace the whole function.
So, I would need to select a number of different map types (Continents, Pangaea, etc.) and create unique versions of them. But, then that limits a player's choice of map when playing the mod. Yes, this is only a very minor issue.
So, other than that last method, are there any other options? I'm just curious.
------
Also, here's another question about LUA functions regarding project modularity:
I'll give a specific example so it's clearer.
I'm trying to make my project as modular as it can be so that each user with their unique tastes can play it as they wish. They'd do this by just either deleting, moving, or adding an affix to the name of the folder that contains the undesired code.
So, I have a folder that contains a modification to deserts and sets their base yield at 1 production (with other modifications to things related to deserts for balance). But, I also wanted to do it the right way, and I edited the fertility functions within AssignStartingPlots.
I know this wouldn't be a welcome change for some players, and they would want to disable the code within its folder. But, how do I go about enabling, disabling the fertility functions? Is there a way that I can create a unique LUA file that overrides the fertility functions within ASP?
As in, if a player uses this particular modification, the unique LUA file will override the existing functions within ASP with its modified ones. If a player disables this modification (using the folder method), then the mod will function normally and will just utilize the existing functions within ASP.