tModLoader Any monster spawn rate and spawn cap mod?

Ok i keep getting errors upon loadup

code looks like this:

using Terraria;
using Terraria.ModLoader;

namespace SpawnBoostMod
{
class SpawnBoostMod : Mod
{
public SpawnBoostMod()
{
Properties = new ModProperties()
{
Autoload = true,
};
}
}

class SpawnRateMultiplierGlobalNPC : GlobalNPC
{
float multiplier = 5f;
public override void EditSpawnRate(Player player, ref int spawnRate, ref int maxSpawns)
{
if(player.enemySpawns)
{
spawnRate = 6;
maxSpawns = 50;
}
}
}
}

And the error looks like this:
change multiplier to static then.
 
change multiplier to static then.

umm i don't even know what static looks like or what it even means... i'm totally lost here

You know what, unless i see a video of this in action i have no chance of getting this to work.

Edit: nvm i give up.
I'll never get this to work.....
 
Last edited:
Hello. I have the same problem. Idk what is static, but I tried everything, but it won't work. Can you help me pls because at my map the spawns are pretty low. Example: When it was blood moon, the enemies barely spawned.
index.php
 
Hello!

I know that this thread has been dead for a while... but...

I can't find a mod that does nothing but changes the spawn rates. I thought the above code would work, but I'm getting the same error. Here is the code:

using Terraria;
using Terraria.ModLoader;
namespace SpawnBoostMod
{
class SpawnBoostMod : Mod
{
public SpawnBoostMod()
{
Properties = new ModProperties()
{
Autoload = true,
};
}
}
class SpawnRateMultiplierGlobalNPC : GlobalNPC
{
float multiplier = 5f;
public override void EditSpawnRate(Player player, ref int spawnRate, ref int maxSpawns)
{
spawnRate = (int)(spawnRate / multiplier);
maxSpawns = (int)(maxSpawns * multiplier);
}
}
}


The following is the loading error:

SpawnBoostMod.SpawnRateMultiplierGlobalNPC has instance fields but does not set InstancePerEntity to true. Either use static fields, or per instance globals
at Terraria.ModLoader.NPCLoader.VerifyGlobalNPC(GlobalNPC npc)
at Terraria.ModLoader.Mod.AddGlobalNPC(String name, GlobalNPC globalNPC)
at Terraria.ModLoader.Mod.AutoloadGlobalNPC(Type type)
at Terraria.ModLoader.Mod.Autoload()
at Terraria.ModLoader.ModLoader.do_Load(Object threadContext)

Any assistance would be grateful. Also, if you know of a mod that only changes the rates, please post a reply.
 
Hello!

I know that this thread has been dead for a while... but...

I can't find a mod that does nothing but changes the spawn rates. I thought the above code would work, but I'm getting the same error. Here is the code:

using Terraria;
using Terraria.ModLoader;
namespace SpawnBoostMod
{
class SpawnBoostMod : Mod
{
public SpawnBoostMod()
{
Properties = new ModProperties()
{
Autoload = true,
};
}
}
class SpawnRateMultiplierGlobalNPC : GlobalNPC
{
float multiplier = 5f;
public override void EditSpawnRate(Player player, ref int spawnRate, ref int maxSpawns)
{
spawnRate = (int)(spawnRate / multiplier);
maxSpawns = (int)(maxSpawns * multiplier);
}
}
}


The following is the loading error:

SpawnBoostMod.SpawnRateMultiplierGlobalNPC has instance fields but does not set InstancePerEntity to true. Either use static fields, or per instance globals
at Terraria.ModLoader.NPCLoader.VerifyGlobalNPC(GlobalNPC npc)
at Terraria.ModLoader.Mod.AddGlobalNPC(String name, GlobalNPC globalNPC)
at Terraria.ModLoader.Mod.AutoloadGlobalNPC(Type type)
at Terraria.ModLoader.Mod.Autoload()
at Terraria.ModLoader.ModLoader.do_Load(Object threadContext)

Any assistance would be grateful. Also, if you know of a mod that only changes the rates, please post a reply.
change "float multiplier = 5f;" to "static float multiplier = 5f;"
 
Hello!

I know that this thread has been dead for a while... but...

I can't find a mod that does nothing but changes the spawn rates. I thought the above code would work, but I'm getting the same error. Here is the code:

using Terraria;
using Terraria.ModLoader;
namespace SpawnBoostMod
{
class SpawnBoostMod : Mod
{
public SpawnBoostMod()
{
Properties = new ModProperties()
{
Autoload = true,
};
}
}
class SpawnRateMultiplierGlobalNPC : GlobalNPC
{
float multiplier = 5f;
public override void EditSpawnRate(Player player, ref int spawnRate, ref int maxSpawns)
{
spawnRate = (int)(spawnRate / multiplier);
maxSpawns = (int)(maxSpawns * multiplier);
}
}
}


The following is the loading error:

SpawnBoostMod.SpawnRateMultiplierGlobalNPC has instance fields but does not set InstancePerEntity to true. Either use static fields, or per instance globals
at Terraria.ModLoader.NPCLoader.VerifyGlobalNPC(GlobalNPC npc)
at Terraria.ModLoader.Mod.AddGlobalNPC(String name, GlobalNPC globalNPC)
at Terraria.ModLoader.Mod.AutoloadGlobalNPC(Type type)
at Terraria.ModLoader.Mod.Autoload()
at Terraria.ModLoader.ModLoader.do_Load(Object threadContext)

Any assistance would be grateful. Also, if you know of a mod that only changes the rates, please post a reply.
Now it says expected ")"
 
Well, you can make a folder called "SpawnBoostMod" and make a file called "SpawnBoostMod.cs" in that folder with the following code, then build it using the Mod Sources menu in tmodloader, and it's all ready to go.

Code:
using Terraria;
using Terraria.ModLoader;

namespace SpawnBoostMod
{
    class SpawnBoostMod : Mod
    {
        public SpawnBoostMod()
        {
            Properties = new ModProperties()
            {
                Autoload = true,
            };
        }
    }

    class SpawnRateMultiplierGlobalNPC : GlobalNPC
    {
        float multiplier = 5f;
        public override void EditSpawnRate(Player player, ref int spawnRate, ref int maxSpawns)
        {
            spawnRate = (int)(spawnRate / multiplier);
            maxSpawns = (int)(maxSpawns * multiplier);
        }
    }
}

Where exactly would I place the "SpawnBoostMod" folder?

And yes, I do realize i'm talking to a desert here.
 
Where exactly would I place the "SpawnBoostMod" folder?

And yes, I do realize i'm talking to a desert here.

I believe that you make the folder into a .tmod file (compile), then stuff it in the mods folder (Documents\My Games\Terraria\ModLoader\Mods) or thereabouts. Could be entirely wrong, but it's worth a try.
 
change "float multiplier = 5f;" to "static float multiplier = 5f;"
Sorry for the late response by alot but i created a mod for it thanks to your code i believe its called "30x Spawn Rate" or something like that idk anyway thanks for the code so i could make this im willing to take thee mod down if you ask for it
 
Last edited:
Hello!

I know that this thread has been dead for a while... but...

I can't find a mod that does nothing but changes the spawn rates. I thought the above code would work, but I'm getting the same error. Here is the code:

using Terraria;
using Terraria.ModLoader;
namespace SpawnBoostMod
{
class SpawnBoostMod : Mod
{
public SpawnBoostMod()
{
Properties = new ModProperties()
{
Autoload = true,
};
}
}
class SpawnRateMultiplierGlobalNPC : GlobalNPC
{
float multiplier = 5f;
public override void EditSpawnRate(Player player, ref int spawnRate, ref int maxSpawns)
{
spawnRate = (int)(spawnRate / multiplier);
maxSpawns = (int)(maxSpawns * multiplier);
}
}
}


The following is the loading error:

SpawnBoostMod.SpawnRateMultiplierGlobalNPC has instance fields but does not set InstancePerEntity to true. Either use static fields, or per instance globals
at Terraria.ModLoader.NPCLoader.VerifyGlobalNPC(GlobalNPC npc)
at Terraria.ModLoader.Mod.AddGlobalNPC(String name, GlobalNPC globalNPC)
at Terraria.ModLoader.Mod.AutoloadGlobalNPC(Type type)
at Terraria.ModLoader.Mod.Autoload()
at Terraria.ModLoader.ModLoader.do_Load(Object threadContext)

Any assistance would be grateful. Also, if you know of a mod that only changes the rates, please post a reply.
Try Changing The Float Multiplier to static float multiplyer
 
Back
Top Bottom