Jump to content

setAutoAge of non-table: null?


Pravus

Recommended Posts

I've been working hard on a new weapons mega-mod and I'm currently alpha testing the script I've written.  Activating the mod and starting a game with it shows no errors through the compiler and I've managed to find a few items here and that are correctly spawning from my distribution.lua.

 

I am getting a stack trace from several containers in the game whenever I attempt to check them for loot though (things like storage lockers, wardrobes, etc.)  The client doesn't show their icon (its literally just black) when you click on them in game and their inventories appear blank.  Here's the stack trace it keeps printing to me:

 

attempted index: setAutoAge of non-table: null--------------------------------------

--------

STACK TRACE

-------------------------------------------------------

function:rollItem -- file: ItemPicker.lua line # 168

function:fillContainerType -- file:ItemPicker.lua line # 117

function:fillContainer -- file: ItemPicker.lua line # 106

function:doClick -- file: ISObjectClickHandler.lua line # 106

function:onObjectLeftMouseButtonUp -- file: ISObjectClickHandler.lua line # 163

 

I attempted to follow the trace back to the lines in listed lua files but, even after reading through the designated sections of each file, I can't make heads or tails of it.

 

Anyone have any experience with issues like this?  Advice greatly appreciated!

Link to comment
Share on other sites

Not currently.  I had a few mods I play with from time to time sitting in my Zomboid/mods folder but they were all deactivated once I began testing.  I'm currently deleting PZ and re-installing the client fresh just to make sure I didn't accidentally leave something from an old mod somewhere that I just haven't noticed.  I'll see if using a brand-new installed client makes a difference and report back.

 

edit: Unfortunately, reinstalling the client fresh did not help.  I'm still getting the same errors whenever I attempt to open certain containers.

Link to comment
Share on other sites

think theres a error in your distribution file, or possibly items.txt

 

line 168 of item picker:

		local item = container:AddItem(itemname);                if not containerDist.noAutoAge then			item:setAutoAge();                end

where itemname seems to be a stringname from distribution file, if container:AddItem fails 'item' will be null as per your error.

Link to comment
Share on other sites

Ah, good thinking, turbotutone.  I went back through my scripting with a fine-toothed comb and found a few mistypes (I wrote the whole mod in the last 36 hrs and it currently adds about 37 new weapons plus recipes, etc.  I'm gonna blame those mistakes on fatigue, lol).

 

Now, I've run into a new problem.  No error messages or stack traces this time but, as soon as I activate the mod to test it, the Project Zomboid client says "Reloading lua" and simply freezes.  Closing the client and re-opening it doesn't help.  If I don't physically remove its ID from the file "loaded.txt" in Zomboid/mods the client starts to load then freezes everytime you start PZ.

 

I may have bitten off more than I can chew trying to script something so ambitious...

Link to comment
Share on other sites

It may help if you attach the faulty files ;)

 

Alright, I think I've tweaked and tried just about everything I can think of to test changing now anyway so I don't mind attaching what I've got so far.  Please keep in mind that I'm still learning lua as I go mostly by studying other mods and trial and error so my scripting may be sloppy.

 

A quick description of what I'm trying to make with my mod is I wanted to replace the default pistol, shotgun, and their ammo drops with a wide range of firearms (and their corresponding ammunition) that native Kentucky residents would actually likely own.  I'm a rural Kentucky resident myself so I know what type of firearms a lot of my family, friends, and neighbors typically own and I thought this might be a fun bit of realism to inject into PZ.  I also added two different types of pocket knife to spawn on some of the zombies since in the real state of Kentucky almost every adult male I know carries some sort of blade either for general use as a handy tool or protection.

 

Anyway here is my mod in its current state: http://www.mediafire.com/download/5ypdnuezb2fzsw9/RKFmodAlpha.rar

 

Feel free to download and play around with what I've cobbled together so far.  Let me know if you have any questions or suggestions to improve the script!

Link to comment
Share on other sites

currently not in a position to test that rar, but uhm does your:

C:\Users\<username>\Zomboid\console.txt

show anything that may help in resolving the problem?

 

Surprisingly no.  I've got a triple-monitor set up so I watch the console run in real time when I'm testing on a separate monitor.  Every time I activate the mod from the mod loader or try to load the game with the mod already "loaded" the console prints normally up to where I should normally be seeing the Main Menu Screen.  Then everything just hangs and the client stops responding until I alt + F4.

 

If I activate the mod in the mod menu then go back to the Main Menu, it shows the Main Menu Screen but the client freezes and the words "Reloading lua" can be seen in the upper right of the screen.  If I kill the process then and attempt to open Project Zomboid again after that, the console prints normal code up until the "beta warning" screen should execute.  At that point it just freezes and the client never shows anything but a black screen.

 

Here are copies of both read outs just to be sure I'm not overlooking something obvious

 

This is the console when I load the mod in the mod loader: http://www.mediafire.com/view/xd4pzy2s09u15x6/console1.txt

 

This is the console when I load the client with the mod already "loaded": http://www.mediafire.com/view/4dxqz5l6l61n9r4/console2.txt

Link to comment
Share on other sites

did a quick glance over your files, and this is just a quick guess as i dont have time atm to look more thorough, however noticed theres a while loop in your distribution file...

might wanna check if that one doesnt get caught in infinite loop.

 

also, and again this is just a quick glance, but looks like your attempting to remove items twice from the same table?

Link to comment
Share on other sites

Aha!  Made a breakthrough!

 

After exhaustive bug finding via removing scripts and assets one at a time and seeing if the mod would load then replacing them and repeating the process, I have discovered that the file that is causing the hang up is RKFrepair.txt.

 

The mod will always load in the mod loader near instantaneously as long as that file is not present.

 

I've already begun playing with it to see if I can find out why that file is causing so much trouble.  Preliminary testing seems to indicate that it has something to do with the amount of "fixing" recipes it contains (I removed all but one and it loaded fine, replace those entries and it hangs again).  I'll keep working and report back once I've figured out what's going on.

 

Edit: I found it!  It was an embarrassing rookie mistake... :blush: I forgot to close one of the sets of { } for one of the repair recipes.  Thanks for the help everyone.  Hopefully I can finish testing now and release this in the near future!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...