Problem with my new resource mod

ferr.ox96

Chieftain
Joined
Jul 26, 2010
Messages
21
Location
Spain
Hello, I've just made a mod which adds a new resource to the game, following Kyoss' tutorial. However, when I load up the mod in the WorldBuilder, the resource doesn't appear, and I can't choose it from the menus. I've attached the mod. Can anyone help me, please?
 

Attachments

It's VFS.

1> You didn't load the DDS files into VFS. All art assets need to have this done.
2> You didn't load AssignStartingPlots or ResourceIconManager into VFS either. Any Lua or XML that entirely replaces non-GameData XML files needs to have this done.

For these, what you do is in ModBuddy, right-click on these files and select Properties. It'll bring up a small window that has several fields; the final one will say "Import into VFS", defaulting to false. You need to set it to True for any art assets or non-GameData files that are intended to replace existing code.
You leave the VFS False for:
> New Lua event code
> GameData XML (anything using the <Row> and <Update> syntax)
> SQL

Most of the tutorials (Kyoss' resource tutorial, Kael's modder's guide) were written before December, which was when the VFS was overhauled. So they won't mention this.

Edit: The way I could tell you hadn't done this was your .modinfo file. The <Files> section, listing all of the files in the mod, will say "Import=1" for any files that are loaded in VFS.
 
It's VFS.

1> You didn't load the DDS files into VFS. All art assets need to have this done.
2> You didn't load AssignStartingPlots or ResourceIconManager into VFS either. Any Lua or XML that entirely replaces non-GameData XML files needs to have this done.

For these, what you do is in ModBuddy, right-click on these files and select Properties. It'll bring up a small window that has several fields; the final one will say "Import into VFS", defaulting to false. You need to set it to True for any art assets or non-GameData files that are intended to replace existing code.
You leave the VFS False for:
> New Lua event code
> GameData XML (anything using the <Row> and <Update> syntax)
> SQL

Most of the tutorials (Kyoss' resource tutorial, Kael's modder's guide) were written before December, which was when the VFS was overhauled. So they won't mention this.

Edit: The way I could tell you hadn't done this was your .modinfo file. The <Files> section, listing all of the files in the mod, will say "Import=1" for any files that are loaded in VFS.

I just did what you said, but it still doesn't work, it does the same thing as previously.
 
Well, then, replace the version you attached with the most recent one, and I'll take a closer look when I get home.

Also, you said that you tried this in WorldBuilder and it didn't work; did you try running it in a normal game? And did you check FireTuner and the debug logfiles for errors? (No point in asking for help before you do that sort of check yourself.)
 
Well, then, replace the version you attached with the most recent one, and I'll take a closer look when I get home.

Also, you said that you tried this in WorldBuilder and it didn't work; did you try running it in a normal game? And did you check FireTuner and the debug logfiles for errors? (No point in asking for help before you do that sort of check yourself.)

I've tried Deep Blue's Resource Generator instead of the Lua files in Kyoss' tutorial, but it still doesn't work. They didn't appear in Civilopedia nor in the map.

This is what appears in Fire Tuner about resources:
Spoiler :

Map Script: Map Generation - Placing Luxuries
Map Script: Failed to place 2 units of Marble.
Map Script: Map Generation - Placing Strategics
Runtime Error: [string "Assets\Gameplay\Lua\AssignStartingPlots.lua"]:7149: attempt to perform arithmetic on field '?' (a nil value)
stack traceback:
[string "Assets\Gameplay\Lua\AssignStartingPlots.lua"]:7149: in function 'ProcessResourceList'
[string "Assets\Gameplay\Lua\AssignStartingPlots.lua"]:9209: in function 'PlaceStrategicAndBonusResources'
[string "Assets\Gameplay\Lua\AssignStartingPlots.lua"]:9351: in function 'PlaceResourcesAndCityStates'
[string "Assets\Maps\Continents.lua"]:321: in function 'StartPlotSystem'
[string "Assets\Gameplay\Lua\MapGenerator.lua"]:811: in function <[string "Assets\Gameplay\Lua\MapGenerator.lua"]:775>
[C]: ?
 

Attachments

It's STILL not doing the VFS. Just look inside your .modinfo file. It should look like this:

Code:
    <File md5="B06323AD71ED378697B3B19C2E7305F1" import="1">Art/BW_SMAC1024.dds</File>
Note the import="1" part. That's what tells the game to load this file into the virtual file system; without that, it won't load the .dds.

The strange thing is that it should say
import="0" for the files you don't set VFS for, and your file doesn't have that, which makes me wonder: when's the last time you updated the SDK? If you haven't updated it since before December, then you're using an out-of-date version that doesn't have the full functionality.

Second error:
You've got AddNewResource.lua loading as an OnModActivated. That's not how Lua works; you need to declare custom Lua in the Content tab, not the Actions tab. THAT is where InGameUIAddin goes. The only thing that is handled through the OnModActivated action is gamedata XML.

Third error:
SaveUtils.lua isn't a standard function, you need to load it as an InGameUIAddin as well. Any Lua that doesn't existing in the core game's directories needs to be loaded this way.

Fourth error:
ResGenerator.lua and ResGeneratorFunctions.lua. Where did you get these, and what did you change in them? You don't need to add anything like this when you're adding a new resource, and if you got these files from someone else, it's very likely they're completely outdated. If you did them yourself, then where did you get the originals, and what did you change in the files?

Fifth error:
Your error message. It says it failed on line 7149 in AssignStartingPlots, inside ProcessResourceList. The problem is, line 7149 in the unmodded file isn't ProcessResourceList, it's actually near the start of PlaceResourceImpact (it's the line that checks whether a map wraps in the X-direction).

Since there was no AssignStartingPlots in your mod's files, this implies to me one of three things:
1> The ResGeneratorFunctions you added is overriding part of AssignStartingPlots with a bit that had a very different number of lines, and it's screwing up as a result.
2> You modified AssignStartingPlots in the vanilla game's directories, and that broke it.
3> You haven't patched your game in several months, possibly having turned off Steam's auto-update. When you start your game, the version number should be .275; if it's not, then this is the problem.
 
Just on SaveUtils, IIRC that's one that's new, but is used by include()ing it, not by using it as an addin. That's the case in which it's correct to add it to the VFS (although it doesn't replace anything) rather than as an addin. Addins are for 'entry points', while SaveUtils is utility code. SaveUtils works by providing functions and such to another context, rather than forming a context of its own.
 
Just on SaveUtils, IIRC that's one that's new, but is used by include()ing it, not by using it as an addin.

Depends which version you're using, I guess. I have a somewhat older version, and I load it as InGameUIAddin for my own mod (and NOT through VFS), and it works just fine.
 
Back
Top Bottom