i am just want to resend my reply so when devs check the thread they find it
hey thanks for unbanning me but i need help on an other thing does anyone knows how to force terraria to use more ram ? i mean i have 4 GB ram (3.85 free) terraria uses 1.5 and i want it to use at least 2 GB so i don't suffer lag while playing calamity mod is there a way to do it ?
You are not going to like my answer, also don't change anything (accept in the answer) because of it.Alright So.. at first I originally thought this was a mod related issue but someone else in Calamity thread pointed out the WoF bug that v0.10.1.5 was supposed to fix, but it is still happening with me, I have tripled checked the version, all mods up to date, which are; Calamity, BossChecklist, Cheat Sheet, and Yet Another Boss Healthbar. Is there any known issue like this still ongoing? Im having a issue where everytime I kill the Wall of Flesh, the Crimson/Hallow only half generates... and causes a drop in framerat, even dramatically sometimes. First time It killed my framerate and only created the hallow, on other maps it was hallow, hallow, crimson, and hallow, but only did one...
You are not going to like my answer, also don't change anything (accept in the answer) because of it.
I think it means your computer has a bad processor.
You'll want to override the following ModProjectile method:How do you make a projectile place a block, similar to sandgun?
public override bool OnTileCollide(Vector2 oldVelocity)
int tileX = (int)((projectile.position.X + projectile.width / 2) / 16);
int tileY = (int)((projectile.position.Y + projectile.width / 2) / 16);
if (!Main.tile[tileX, tileY].active())
WorldGen.PlaceTile(tileX, tileY, TileID.DirtBlock, forced: true);
Placing worked, but now I am having an issue with this part of it that I added:You'll want to override the following ModProjectile method:
From there you'll basically want to spawn a block at the projectile's position:Code:public override bool OnTileCollide(Vector2 oldVelocity)
Code:int tileX = (int)((projectile.position.X + projectile.width / 2) / 16); int tileY = (int)((projectile.position.Y + projectile.width / 2) / 16); if (!Main.tile[tileX, tileY].active()) WorldGen.PlaceTile(tileX, tileY, TileID.DirtBlock, forced: true);
Again, like almost all my examples, this is an untested, rudamentary implementation. It should give you a good start though.
Those tileX and tileY coordinates are in tile dimensions, not pixel/world dimensions. So you'll want to multiply them by 16 for item spawning.Placing worked, but now I am having an issue with this part of it that I added:
else
{
Item.NewItem(tileX, tileY, 18, 18, ItemID.DirtBlock);
}
return true;
Whenever ModConfig becomes a thing for tModLoader, will it work by returning the configuration value or by overwriting a variable? In other words, can multiplying a ModConfig value by 2 work something like variable = ModConfig("configValName")*2;, or will it instead have to be something like ModConfig("configValName",variable); variable*=2;? Vanilla Terraria's "Preferences" thing seems to work in the latter way, while I definitely prefer the former and see no negatives about it (while I easily see a few negatives about the latter).
float c_hp_mod = 0; //default in case loading fails
try
{
c_hp_mod = ModConfig("config HP modifier");
}
catch (exception e)
{
debug_message = e.message;
c_hp_mod = 0;
}
c_hp_mod *= 2;
Thanks again.Those tileX and tileY coordinates are in tile dimensions, not pixel/world dimensions. So you'll want to multiply them by 16 for item spawning.
Sorry mate but I'll have to decline. Good luck with your mod, thoughThanks again.
(I really should not post this) I have noticed you help constantly (Three times now) and you are the only one who helps. I am offering you to join me making mods because I am that desperate for more modders.
Your example is unnecessarily complex.There actually is an obvious problem to your first method. C# is a strongly typed language, and if you do something like ModConfig("configValName") * 2; there's no garuntee that ModConfig() is returning a correct type. Doing something like
would be better and allows for exception handling on incorrect typing without causing errors to the player and/or failing and crashing the game.Code:float c_hp_mod = 0; //default in case loading fails try { c_hp_mod = ModConfig("config HP modifier"); } catch (exception e) { debug_message = e.message; c_hp_mod = 0; } c_hp_mod *= 2;
edit: forgot the *2 and to actually set the hp modifier incase the config wasn't loaded