Standalone [1.3] tModLoader - A Modding API

I know that this isn't the right place for it.. but someone can help me with HOW to host a modded server? the vanilla dedicated server app (from the terraria official website) does not recognize the right folder (where the tmodloader worlds are), just the folder from my vanilla worlds.

oh I'm going with Hamachi.. (it's just for me and another friend)

what to do? I want to play some mods with ma buddy :/
nope it doesnt. at least mine dont.
It's right there. Maybe you downloaded an old version somehow?
h0vv8AH.png

Hello. I am looking to lower the spawn rate of OH GOD NOT ANOTHER VOLCANO! THATS THE TWENTIETH TIME THIS MINUTE! sorry, as i was saying id like to lower the spawn rate of volcano event, but i dont know how or when or where.

EDIT: If you can also do this for me, care to take the time and tell me how to make a gun shoot more than 1 projectile at a time?

EDIT2: found the event but dont know how to delay it
kageDGN.png

I highlighted the code. Basically, change it to "if(Main.rand.Next(100000) == 0)" or something like that to make it rare. It's not like ExampleMod is a mod people play the game with, so we didn't bother fixing it to be less often. We left it "as an exercise to the modder".

For more than 1 projectile, if you want a burst fire, like paintball gun, change useTime and useAnimation. For a shotgun style, check out the "Snippet: Firing projectile in a random/even spread (shotgun etc.)" section here: http://forums.terraria.org/index.php?threads/official-tmodloader-help-thread.28901/

 
@jopojelly IT'S WORKING. OMG I'M SO HAPPY, BRO thxxxxxx

EDIT: actually its not 100% working. I can play with my friend but there is some mods that arent that fine with multiplayer. I figured out which mod doesnt and just disabled them. the real problem comes when sometimes I pickup some random items or use weapons. my terraria just crash. I don't understand why.

http://imgur.com/p20h9mO

what can I do? its just MY terraria that keep crashing. I'm the one hosting the server too. some random things.. sometimes shooting guns, sometimes picking some items. dunno. it just crashes.
thx//
 
Last edited:
@jopojelly IT'S WORKING. OMG I'M SO HAPPY, BRO thxxxxxx

EDIT: actually its not 100% working. I can play with my friend but there is some mods that arent that fine with multiplayer. I figured out which mod doesnt and just disabled them. the real problem comes when sometimes I pickup some random items or use weapons. my terraria just crash. I don't understand why.

http://imgur.com/p20h9mO

what can I do? its just MY terraria that keep crashing. I'm the one hosting the server too. some random things.. sometimes shooting guns, sometimes picking some items. dunno. it just crashes.
thx//

tModloader doesn't do so good on multiplayer right now. Next update should fix it.
 
Why does it have to be so complex?
What, modding?
I can see why it would be tough getting started (setting up the right programs, getting your C# syntax right, etc) but really, once you get into it a bit more, things will start getting more simple, so that's probably the part you should be aiming for! ;)
 
Well to be honest I'm not sure where to begin. I took a look at the ExampleMod file and I'm not sure what "public override void SetDefaults" is supposed to mean
I know it's probably not going to make much of a difference, but lemme try to explain that line :p

public - means it can be accessed from anywhere, as long as there is a reference to it.
override - means it's overriding an already existing function that was earlier marked as virtual or abstract.
void - actually means exactly what it sounds like: empty. This is marking this function as an empty function, thus telling the program it's not expecting anything to be returned.
SetDefaults - the function name.

Whelp, like I said: probably not going to make much of a difference... ;)
 
I know it's probably not going to make much of a difference, but lemme try to explain that line :p

public - means it can be accessed from anywhere, as long as there is a reference to it.
override - means it's overriding an already existing function that was earlier marked as virtual or abstract.
void - actually means exactly what it sounds like: empty. This is marking this function as an empty function, thus telling the program it's not expecting anything to be returned.
SetDefaults - the function name.

Whelp, like I said: probably not going to make much of a difference... ;)
Well, it was slightly helpful... But I have no idea how I would start. Is there a tutorial on it?
 
It's right there. Maybe you downloaded an old version somehow?
h0vv8AH.png


kageDGN.png

I highlighted the code. Basically, change it to "if(Main.rand.Next(100000) == 0)" or something like that to make it rare. It's not like ExampleMod is a mod people play the game with, so we didn't bother fixing it to be less often. We left it "as an exercise to the modder".

For more than 1 projectile, if you want a burst fire, like paintball gun, change useTime and useAnimation. For a shotgun style, check out the "Snippet: Firing projectile in a random/even spread (shotgun etc.)" section here: http://forums.terraria.org/index.php?threads/official-tmodloader-help-thread.28901/
so, well, i copied the evenspread and it keeps giving me error CS1514: { expected, (7, 35), can i get a bit of help?

using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace ExampleMod.Items.Weapons;
{
public class ExampleGun : ModItem;
{
public override void SetDefaults();
{
item.name = ".55 Magnum";
item.damage = 5500;
item.ranged = true;
item.width = 28;
item.height = 20;
item.toolTip = "This magnum is MORE powerful?!";
item.toolTip2 = "I bet this shreds people with 1 shot.";
item.useTime = 20;
item.useAnimation = 20;
item.useStyle = 5;
item.noMelee = true; //so the item's animation doesn't do damage
item.knockBack = 4;
item.value = 10000;
item.rare = 13;
item.useSound = 11;
item.autoReuse = false;
item.shoot = 18; //idk why but all the guns in the vanilla source have this
item.shootSpeed = 30f;
item.useAmmo = ProjectileID.Bullet;
}
Vector2[] speeds = ModHelper.Projectile.evenArc( 16f, 16f, 45, 5);
for (int i = 0; i < 5; ++i)
{
Terraria.Projectile.NewProjectile(Main.player[0].position.X, Main.player[0].position.Y, speeds.X, speeds.Y, 45, 45, 15f);
}
{
if (Main.rand.Next(0, 4) == 0); // 50% chance not to consume ammo.
return false;
return true;
}

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(null, "ExampleItem", 10);
recipe.AddTile(null, "ExampleWorkbench");
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
 
so, well, i copied the evenspread and it keeps giving me error CS1514: { expected, (7, 35), can i get a bit of help?

using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace ExampleMod.Items.Weapons;
{
public class ExampleGun : ModItem;
{
public override void SetDefaults();
{
item.name = ".55 Magnum";
item.damage = 5500;
item.ranged = true;
item.width = 28;
item.height = 20;
item.toolTip = "This magnum is MORE powerful?!";
item.toolTip2 = "I bet this shreds people with 1 shot.";
item.useTime = 20;
item.useAnimation = 20;
item.useStyle = 5;
item.noMelee = true; //so the item's animation doesn't do damage
item.knockBack = 4;
item.value = 10000;
item.rare = 13;
item.useSound = 11;
item.autoReuse = false;
item.shoot = 18; //idk why but all the guns in the vanilla source have this
item.shootSpeed = 30f;
item.useAmmo = ProjectileID.Bullet;
}
Vector2[] speeds = ModHelper.Projectile.evenArc( 16f, 16f, 45, 5);
for (int i = 0; i < 5; ++i)
{
Terraria.Projectile.NewProjectile(Main.player[0].position.X, Main.player[0].position.Y, speeds.X, speeds.Y, 45, 45, 15f);
}
{
if (Main.rand.Next(0, 4) == 0); // 50% chance not to consume ammo.
return false;
return true;
}

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(null, "ExampleItem", 10);
recipe.AddTile(null, "ExampleWorkbench");
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
I'm no coder, admittedly, so I don't know how to help you. But what?! 5500 damage?! I don't even know what to say to that. How are you supposed to balance that? xD I don't even.
 
so, well, i copied the evenspread and it keeps giving me error CS1514: { expected, (7, 35), can i get a bit of help?

using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace ExampleMod.Items.Weapons;
{
public class ExampleGun : ModItem;
{
public override void SetDefaults();
{
item.name = ".55 Magnum";
item.damage = 5500;
item.ranged = true;
item.width = 28;
item.height = 20;
item.toolTip = "This magnum is MORE powerful?!";
item.toolTip2 = "I bet this shreds people with 1 shot.";
item.useTime = 20;
item.useAnimation = 20;
item.useStyle = 5;
item.noMelee = true; //so the item's animation doesn't do damage
item.knockBack = 4;
item.value = 10000;
item.rare = 13;
item.useSound = 11;
item.autoReuse = false;
item.shoot = 18; //idk why but all the guns in the vanilla source have this
item.shootSpeed = 30f;
item.useAmmo = ProjectileID.Bullet;
}
Vector2[] speeds = ModHelper.Projectile.evenArc( 16f, 16f, 45, 5);
for (int i = 0; i < 5; ++i)
{
Terraria.Projectile.NewProjectile(Main.player[0].position.X, Main.player[0].position.Y, speeds.X, speeds.Y, 45, 45, 15f);
}
{
if (Main.rand.Next(0, 4) == 0); // 50% chance not to consume ammo.
return false;
return true;
}

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(null, "ExampleItem", 10);
recipe.AddTile(null, "ExampleWorkbench");
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
There are multiple things wrong with this code.
Take a look at your code with my comments:
Code:
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

// One of the problems you're encountering is that you're using the semicolon wrong.
// You only want to use the semicolon ( ; ) when closing a line of code, but if you look below, you're closing your namespace while you're trying to open it.
// Same goes for your class and SetDefaults method, so:

namespace ExampleMod.Items.Weapons; // <-- Remove this semicolon
{
    public class ExampleGun : ModItem; // <-- And this one this semicolon
    {
        public override void SetDefaults(); // <-- And this one this semicolon
        {
            item.name = ".55 Magnum";
            item.damage = 5500;
            item.ranged = true;
            item.width = 28;
            item.height = 20;
            item.toolTip = "This magnum is MORE powerful?!";
            item.toolTip2 = "I bet this shreds people with 1 shot.";
            item.useTime = 20;
            item.useAnimation = 20;
            item.useStyle = 5;
            item.noMelee = true; //so the item's animation doesn't do damage
            item.knockBack = 4;
            item.value = 10000;
            item.rare = 13;
            item.useSound = 11;
            item.autoReuse = false;
            item.shoot = 18; //idk why but all the guns in the vanilla source have this
            item.shootSpeed = 30f;
            item.useAmmo = ProjectileID.Bullet;
        }
       
        // The following code... What is it encapsulated in? There's no function call here!
        Vector2[] speeds = ModHelper.Projectile.evenArc( 16f, 16f, 45, 5);
        for (int i = 0; i < 5; ++i)
        {
            Terraria.Projectile.NewProjectile(Main.player[0].position.X, Main.player[0].position.Y, speeds.X, speeds.Y, 45, 45, 15f);
        }
        // Same story here as above, no function is being called, so this code is just floating here...
        {
            if (Main.rand.Next(0, 4) == 0); // 50% chance not to consume ammo.
                return false;
            return true;
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(null, "ExampleItem", 10);
            recipe.AddTile(null, "ExampleWorkbench");
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}
 
I'm no coder, admittedly, so I don't know how to help you. But what?! 5500 damage?! I don't even know what to say to that. How are you supposed to balance that? xD I don't even.
like idk, make it super redicoulasely hard to get? and an upgrade to another ridicoulasely hard to get weapon?
 
There are multiple things wrong with this code.
Take a look at your code with my comments:
Code:
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

// One of the problems you're encountering is that you're using the semicolon wrong.
// You only want to use the semicolon ( ; ) when closing a line of code, but if you look below, you're closing your namespace while you're trying to open it.
// Same goes for your class and SetDefaults method, so:

namespace ExampleMod.Items.Weapons; // <-- Remove this semicolon
{
    public class ExampleGun : ModItem; // <-- And this one this semicolon
    {
        public override void SetDefaults(); // <-- And this one this semicolon
        {
            item.name = ".55 Magnum";
            item.damage = 5500;
            item.ranged = true;
            item.width = 28;
            item.height = 20;
            item.toolTip = "This magnum is MORE powerful?!";
            item.toolTip2 = "I bet this shreds people with 1 shot.";
            item.useTime = 20;
            item.useAnimation = 20;
            item.useStyle = 5;
            item.noMelee = true; //so the item's animation doesn't do damage
            item.knockBack = 4;
            item.value = 10000;
            item.rare = 13;
            item.useSound = 11;
            item.autoReuse = false;
            item.shoot = 18; //idk why but all the guns in the vanilla source have this
            item.shootSpeed = 30f;
            item.useAmmo = ProjectileID.Bullet;
        }
      
        // The following code... What is it encapsulated in? There's no function call here!
        Vector2[] speeds = ModHelper.Projectile.evenArc( 16f, 16f, 45, 5);
        for (int i = 0; i < 5; ++i)
        {
            Terraria.Projectile.NewProjectile(Main.player[0].position.X, Main.player[0].position.Y, speeds.X, speeds.Y, 45, 45, 15f);
        }
        // Same story here as above, no function is being called, so this code is just floating here...
        {
            if (Main.rand.Next(0, 4) == 0); // 50% chance not to consume ammo.
                return false;
            return true;
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(null, "ExampleItem", 10);
            recipe.AddTile(null, "ExampleWorkbench");
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}
so i tried that, and well, now i get error CS1519 invalid token { in class, struct or iterference member decleration
 
Back
Top Bottom