Jump to content

Simple Mod somehow disables loading Main Menu


LacidOnex

Recommended Posts

I wrote my first zomboid mod and have had tremendous issue with it. I can't find anything useful in the logs, but when my mod is loaded it causes lua to restart as normal. Unfortunately, the main menu image loads but no buttons do and the game will remain frozen until you unsubscribe the mod in steam and do a fresh install (also removing any files from C:/Users/User/Zomboid). If anyone could review my code I'd appreciate it.

NapalmLoader.lua

NapalmSpawn.lua

items.txt

Link to comment
Share on other sites


Napalm = {};

function Napalm.loadTexture()
    getTexture("Item_Styrofoam.png");
    print("Styrofoam sprite loaded");
end

Events.OnGameBoot.Add(Napalm.loadTexture);

 

That is obsolete, remove it. PZ doesn't need any lua code for loading mod item textures now. All it needs is for the script to define Icon = "TextureName" That's likely the problem here.

Note - "TextureName" will refer to a file in modname/media/textures folder called Item_TextureName.png

Edit: Note, a lot of tutorials available are now obsolete, best bet really is to download a working mod and learn from how that works, if you need help, PM me and I will gladly answer any questions.

Edited by Svarog
Link to comment
Share on other sites

I should mention im trying to compile a package for Steam, I cannot for the life of me get the base component styrofoam to spawn in the wild. I've copied the hammer spawn data in my update (basically). I reworked it down to this

Workshop/NapalmABomb/Contents/Item_Styrofoam.png

Workshop/NapalmABomb/Contents/media/lua/NapalmABomb

require "Items/SuburbsDistributions";

Napalm = {};

table.insert(SuburbsDistributions["all"]["bin"].items, "NapalmABomb.Styrofoam");
table.insert(SuburbsDistributions["all"]["bin"].items, 4.3);
table.insert(SuburbsDistributions["all"]["counter"].items, "NapalmABomb.Styrofoam");
table.insert(SuburbsDistributions["all"]["counter"].items, 4.3);
table.insert(SuburbsDistributions["all"]["metal_shelves"].items, "NapalmABomb.Styrofoam");
table.insert(SuburbsDistributions["all"]["metal_shelves"].items, 4.3);
table.insert(SuburbsDistributions["all"]["crate"].items, "NapalmABomb.Styrofoam");
table.insert(SuburbsDistributions["all"]["crate"].items, 4.3);
table.insert(SuburbsDistributions["conveniencestore"]["shelves"].items, "NapalmABomb.Styrofoam");
table.insert(SuburbsDistributions["conveniencestore"]["shelves"].items, 4.3);
table.insert(SuburbsDistributions["grocery"]["counter"].items, "NapalmABomb.Styrofoam");
table.insert(SuburbsDistributions["grocery"]["counter"].items, 4.3);
table.insert(SuburbsDistributions["grocery"]["shelves"].items, "NapalmABomb.Styrofoam");
table.insert(SuburbsDistributions["grocery"]["shelves"].items, 4.3);
table.insert(SuburbsDistributions["grocery"]["crate"].items, "NapalmABomb.Styrofoam");
table.insert(SuburbsDistributions["grocery"]["crate"].items, 4.3);
table.insert(SuburbsDistributions["spiffoskitchen"]["counter"].items, "NapalmABomb.Styrofoam");
table.insert(SuburbsDistributions["spiffoskitchen"]["counter"].items, 4.3);
table.insert(SuburbsDistributions["kitchen_crepe"]["counter"].items, "NapalmABomb.Styrofoam");
table.insert(SuburbsDistributions["kitchen_crepe"]["counter"].items, 4.3);
table.insert(SuburbsDistributions["plazastore1"]["counter"].items, "NapalmABomb.Styrofoam");
table.insert(SuburbsDistributions["plazastore1"]["counter"].items, 4.3);
table.insert(SuburbsDistributions["grocers"]["grocerstand"].items, "NapalmABomb.Styrofoam");
table.insert(SuburbsDistributions["grocers"]["grocerstand"].items, 4.3);
table.insert(SuburbsDistributions["grocers"]["smallcrate"].items, "NapalmABomb.Styrofoam");
table.insert(SuburbsDistributions["grocers"]["smallcrate"].items, 4.3);
table.insert(SuburbsDistributions["fossoil"]["counter"].items, "NapalmABomb.Styrofoam");
table.insert(SuburbsDistributions["fossoil"]["counter"].items, 4.3);
table.insert(SuburbsDistributions["fossoil"]["shelves"].items, "NapalmABomb.Styrofoam");
table.insert(SuburbsDistributions["fossoil"]["shelves"].items, 4.3);
table.insert(SuburbsDistributions["fossoil"]["crate"].items, "NapalmABomb.Styrofoam");
table.insert(SuburbsDistributions["fossoil"]["crate"].items, 4.3);
table.insert(SuburbsDistributions["fossoil"]["crate"].items, "NapalmABomb.Styrofoam");
table.insert(SuburbsDistributions["fossoil"]["crate"].items, 4.3);
table.insert(SuburbsDistributions["grocery"]["shelvesmag"].items, "NapalmABomb.Styrofoam");
table.insert(SuburbsDistributions["grocery"]["shelvesmag"].items, 4.3);
table.insert(SuburbsDistributions["fossoil"]["shelvesmag"].items, "NapalmABomb.Styrofoam");
table.insert(SuburbsDistributions["fossoil"]["shelvesmag"].items, 4.3);
table.insert(SuburbsDistributions["garage_storage"]["all"].items, "NapalmABomb.Styrofoam");
table.insert(SuburbsDistributions["garage_storage"]["all"].items, 4.3);
table.insert(SuburbsDistributions["motelbedroom"]["wardrobe"].items, "NapalmABomb.Styrofoam");
table.insert(SuburbsDistributions["motelbedroom"]["wardrobe"].items, 4.3);
table.insert(SuburbsDistributions["policestorage"]["metal_shelves"].items, "NapalmABomb.Styrofoam");
table.insert(SuburbsDistributions["policestorage"]["metal_shelves"].items, 6);
table.insert(SuburbsDistributions["policestorage"]["metal_shelves"].items, "NapalmABomb.Styrofoam");
table.insert(SuburbsDistributions["policestorage"]["metal_shelves"].items, 6);
table.insert(SuburbsDistributions["all"]["inventorymale"].items, "NapalmABomb.Styrofoam");
table.insert(SuburbsDistributions["all"]["inventorymale"].items, 4.3);
table.insert(SuburbsDistributions["all"]["inventoryfemale"].items, "NapalmABomb.Styrofoam");
table.insert(SuburbsDistributions["all"]["inventoryfemale"].items, 4.3);

Events.OnGameBoot.Add(Napalm.loadTexture);

Workshop\Napalm-a-Bomb\Contents\mods\scripts\NapalmABomb

module ItsHammerTimeMod
{
	imports
	{
	Base
	}

    item napalmabomb
	{
		MaxRange	=	8,
		Type	=	Weapon,
		MinimumSwingTime	=	1.5,
		SwingAnim	=	Bat,
		UseSelf	=	TRUE,
		DisplayName	=	Napalm-a-Bomb,
		SwingTime	=	1.5,
		SwingAmountBeforeImpact	=	0.1,
		PhysicsObject	=	Molotov,
		MinDamage	=	0,
		Weight	=	1.5,
		MaxDamage	=	0,
		OtherHandRequire	=	Lighter,
		MaxHitCount	=	0,
		Icon	=	BottleWithGas,
		ExplosionPower  =   90,
		ExplosionRange  =   7,
		FirePower  =   150,
       	FireRange  =   4,
		ExplosionSound  =   smallExplosion,
		PlacedSprite = constructedobjects_01_32,
		Tooltip = Tooltip_Trap,
	}

	item styrofoam
	{
		Weight	=	.01,
		Type	=	Normal,
		DisplayName	=	Styrofoam,
		Icon	=	Styrofoam,
	}
	
	recipe Make napalmabomb
	{
	   PetrolCan=4,
	   RippedSheets,
	   styrofoam,
	   WaterBottleEmpty,

	   Result:napalmabomb,
	   Time:60.0,
	   Category:Engineer,
	}

}

 

Link to comment
Share on other sites

I've been reviewing the logs, usually via the console window, but my mod has no stack trace. Despite having several mods activated, only 4 STACK TRACE entries are made, two for OGRM and two "trap-test". When mods are loaded, it states that my mod (listed by its ID number not its name, but whatever) has been loaded. No further mention is made by either ID number or its lua/txt files in the logs, indicating that neither file is loaded properly.

 

So if the mod is "loaded" initially Zomboid recognizes the folder as files to utilize, does my mod require any additional scripting to call itself into action? Why would the directory load and yet the client ignores all files within?

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...