Can't get a lua script to work

racha

Prince
Joined
Jul 27, 2013
Messages
335
Location
Over there --->
I wonder if someone could tell me what I'm doing wrong here? I found a mod that I really like (Moorish Wonders) and added it to a medieval wonders mod.

The original mod uses a lua script to give culture when you create a great person tile improvement or great work of art. I haven't even begun to learn that stuff yet, so, as my mod is just for personal use, I've simply copied the lua file without making any alterations to it at all.

In modbuddy, I've set VFS = False for the lua and SQL files, True for the image files and I've for an InGameUIAddin line in the content tab for the lua file. I've also checked my resulting .modinfo file against the one for the mod I'm copying and everything matches up.

However, the original mod works just fine, whereas mine (even when it's the only mod enabled) generates an error and the wonder gives no culture, though the other benefit (1 gold per luxury worked by the city) works:

Code:
[9876.766] Runtime Error: Assets\DLC\Expansion2\UI\InGame\InGame.lua:1262: attempt to index local 'addinFile' (a nil value)
[9876.766] Runtime Error: Error loading Assets\DLC\Expansion2\UI\InGame\InGame.lua

Presumably, this is something I'm doing wrong, rather than an error in the lua script, but I'm at a loss as to where I'm making a mistake. Any takers?

Both mods are included as attachments.
 

Attachments

  • -99- Medina Azahara (v 1).zip
    2.3 MB · Views: 22
  • Moorish Wonders (v 1).zip
    4.9 MB · Views: 25
The reference to the addin file should be prefixed with "code/" - don't type the filename into the AddIn field, but use the drop-down. When you have no associated .xml file, see the note in post #3 about doing step 6 before step 3 in the 3rd link in my sig
 
After I got this working, I went back to my compilation mod and ran into it not working again. Just to share my mistake in case it helps anyone else, I ended up commenting out all the other wonders and then un-commenting them one at a time, firing up the game, testing (thank bacon for the IGE mod!) and eventually found my mistake.

Somehow, a devious 2 had snuck into the CulturePerGP field for another wonder and that was causing the lua code to not work.
 
Top Bottom