tModLoader Official tModLoader Help Thread

Try "UpdateEquip(Player player)". Found it in the ModItem class reference, scroll down until you see it.


You probably need more! It's likely that the code editor program you're using highlights these brackets in pairs, so you can see which brackets have a pair and which ones do not.
Send your code here if you can't figure it out.
Thanks for the help , i'll send you the code . Terraria paste - Pastebin.com
 
Thanks for the help , i'll send you the code . Terraria paste - Pastebin.com
I'm pretty sure you can't override from inside other overriden methods: public override void Kill code must be on the same level as public override void ProcessTriggers code.
There's also a stray "/" at line 28 after the calculation :)
It seems you've began writing ProcessTriggers, then the Hotkey check, and then didn't finish it and went straight to Kill(). The "{" after (TutorialMod.ExplodeHotKey.JustPressed) is the bracket that needs a pair. After that, you can begin writing your Kill() code.
here's how I'd do it
 
I'm pretty sure you can't override from inside other overriden methods: public override void Kill code must be on the same level as public override void ProcessTriggers code.
There's also a stray "/" at line 28 after the calculation :)
It seems you've began writing ProcessTriggers, then the Hotkey check, and then didn't finish it and went straight to Kill(). The "{" after (TutorialMod.ExplodeHotKey.JustPressed) is the bracket that needs a pair. After that, you can begin writing your Kill() code.
here's how I'd do it
it says that : CS0115 Tutorialplayer(int) no suitable methode to override
 
it says that : CS0115 Tutorialplayer(int) no suitable methode to override
Where does it say that exactly? Is it in regards to the Kill() method? I've checked just now and the Kill() method does not take in a single int parameter like it does in your code (the timeleft one), instead it takes up several and none of them are ints i believe.
Where did you get this method from? It's possible it's supposed to run elsewhere. If you're sure that this is the place, check the PlayerHooks reference page and search for the kill method, and simply copy the parameters from there.
 
Where does it say that exactly? Is it in regards to the Kill() method? I've checked just now and the Kill() method does not take in a single int parameter like it does in your code (the timeleft one), instead it takes up several and none of them are ints i believe.
Where did you get this method from? It's possible it's supposed to run elsewhere. If you're sure that this is the place, check the PlayerHooks reference page and search for the kill method, and simply copy the parameters from there.
the error is at : 18,29. I'm tryna make a bind that explodes you (a killbind so to speak) , since i don't know exaclty what i'm doing i checked the example mod for instructions for binds and it was in the modplayer. And this methode was taken from a custom explosive , i hoped that if i just took the kill code it'll work
 
the error is at : 18,29. I'm tryna make a bind that explodes you (a killbind so to speak) , since i don't know exaclty what i'm doing i checked the example mod for instructions for binds and it was in the modplayer. And this methode was taken from a custom explosive , i hoped that if i just took the kill code it'll work
The bind does go into the modplayer class, but you'll have to do some extra work with the explosive code, just copying it won't work since the explosive and modplayer classes work very differently.
I'm not sure if Kill is the method you'd want to copy, since it's a hook, which means that instead of killing anything, it's a method that runs when something gets killed. So for modplayer, the kill method will activate when the player dies, and all code that is in the kill method will run when that happens. Same with Hurt(), PreHurt() and PostHurt(), these activate when player takes damage.
You'd probably want to spawn an explosive at the player's position when the player presses the hotkey, but I can't help you with that exactly, sorry :p try spawning a projectile with NewProjectile() from the Projectile Class Documentation's "Methods" paragraph
 
thanks for all of your help. I can figure it out now
 
Did you get it to work?
The problem most likely has to do with tmodloader's version, terraria 1.4 requires tmodloader 0.11.7+ version. I've had the exact same problem until I've installed the latest tmodloader version via Steam.
 
The problem most likely has to do with tmodloader's version, terraria 1.4 requires tmodloader 0.11.7+ version. I've had the exact same problem until I've installed the latest tmodloader version via Steam.

Okay! Is that the x64 bit version or the x32 bit version. The reason for the question is that I would be able to run more mods without worrying about it crashing on the x64 bit version than the x32 bit version.
 
Okay! Is that the x64 bit version or the x32 bit version. The reason for the question is that I would be able to run more mods without worrying about it crashing on the x64 bit version than the x32 bit version.
That depends on your computer actually! Some processors are 64-bit while others are 32-bit. You need to go into your computer's settings window to see info on your processor. My bet is on it being 64-bit though, since you say that it crashes less, and more importantly, that it still works fine :p
 
Having issues with spawning a explosive with a bind. NewProjectile doesn't work.
 
That depends on your computer actually! Some processors are 64-bit while others are 32-bit. You need to go into your computer's settings window to see info on your processor. My bet is on it being 64-bit though, since you say that it crashes less, and more importantly, that it still works fine :p
It actually doesn't have to do with the computer. The majority of tModLoader installs are 32-bit. There is an unofficial 64-bit version but it is buggy and outdated. For the time being 32-bit is the more stable one.
 
OwO?

edit: this displays when clicking on mod browser... the tmod is from steam latest version...
 

Attachments

  • uwu.png
    uwu.png
    454.5 KB · Views: 229
Is there a way to change the camera offset while on a custom mount? It would be very useful because my mounts are tall.
 
Having issues with namespaces
Here is the code: Terraria paste - Pastebin.com
The dusts are in TutorialMod/TutorialDusts
and the sword is in TutorialMod/Items
why isn't it working?
 
Having issues with namespaces
Here is the code: Terraria paste - Pastebin.com
The dusts are in TutorialMod/TutorialDusts
and the sword is in TutorialMod/Items
why isn't it working?
Try adding "using static Terraria.ModLoader.ModContent;" to the top of your class code, you can insert it right after "using Terraria.Modloader"
 
Try adding "using static Terraria.ModLoader.ModContent;" to the top of your class code, you can insert it right after "using Terraria.Modloader"
sorry for the late reply but , it shows the same error
 
sorry for the late reply but , it shows the same error
The problem lies with the dust effect then. I made a class inside of Example mod with your code and everything works fine, but since example mod does not have your tutorialdust, i replaced it with ExampleMod's "Sparkle" dust. Since that is the only difference, it stands to reason that that's where the problem is. So while this class has all the required namespaces, your dust class probably does not. Make sure that the dust class uses the tutorialdusts namespace also.
 
Try ProjectileID since ItemID and projectileID both return integers they are kind of compartible.

Edit 1:I looked it up and I didn't find a heart projectile. Maybe I'll find a workaround.

Edit 2:I got an idea how it could work, but I couldn't test it because I need a 1.17.1 compiler but can only download the 1.17 one :mad:.
This basicly creates a projectile wich when it gets destroyed spawns a heart.
That's the code.

Code:
using System;
using System.Collections.Generic;
using System.ComponentModel.Design;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace Mod.Projectiles       //Change it to the corect folder
{
    public class heartproj: ModProjectile
    {
     
public class txtxx : ModProjectile
    {
        public override void SetDefaults()
        {
            //projectile.name = "Custom Flamethrower"; //Name of the projectile, only shows this if you get killed by it
            projectile.width = 12;  //Set the hitbox width
            projectile.height = 12; //Set the hitbox height
            projectile.hostile = true;  //Tells the game whether it is friendly to players/friendly npcs or not
            projectile.ignoreWater = true;  //Tells the game whether or not projectile will be affected by water
            projectile.ranged = true;  //Tells the game whether it is a ranged projectile or not
            projectile.penetrate = 1; //Tells the game how many enemies it can hit before being destroyed, -1 infinity
            projectile.timeLeft = 600;  //The amount of time the projectile is alive for
        }
        public override void Kill(int timeLeft) {
            Item.NewItem(projectile.position,ItemID.Heart,1);
        }
        public override bool OnTileCollide(Vector2 oldVelocity)
        {
            projectile.Kill();
            return false;
        }
    }
    }
}

Just remember to spawn it using:
Code:
item.shoot = mod.ProjectileType("heartproj");

Edit 3:
Now the code is right!

Ok so I finally tried this and it says: Terreria.Modloader.Exceptions.MissingResourceException: Expected resource not found
Projectiles/txtxx

What do I do to fix this
 
Back
Top Bottom