Standalone [1.3] tModLoader - A Modding API

I don't know about your first question, need to look into that... Second, though (these are the default settings for the Blowpipe in the SC):
Code:
this.useStyle = 5;
this.autoReuse = true;
this.useAnimation = 45;
this.useTime = 45;
this.name = "Blowpipe";
this.width = 38;
this.height = 6;
this.shoot = 10;
this.useAmmo = 51;
this.useSound = 63;
this.damage = 9;
this.shootSpeed = 11f;
this.noMelee = true;
this.value = 10000;
this.knockBack = 3.5f;
this.toolTip = "Allows the collection of seeds for ammo";
this.ranged = true;
Where you should replace 'this' with 'projectile' ofc :)
He basically wants to make you get seeds when you kill grass like when you have the blowpipe.
 
He basically wants to make you get seeds when you kill grass like when you have the blowpipe.
Yeah, I know that, it's just that I haven't found out how they do that in the source code yet :p It's not handled in the item itself, nor in the Player.cs or the Main.cs it seems, so that doesn't leave a lot of options ><
 
Again i'm very noobish at this like really new to this stuff (that's why i'm just messing round in the example mod) how do' i make something shoot a non modded projectile like a projectile one that's already in the game such as a razor blade typhoon.

Also how would i go about using pre existing boss and enemy ai
 
Last edited:
Again i'm very noobish at this like really new to this stuff (that's why i'm just messing round in the example mod) how do' i make something shoot a non modded projectile like a projectile one that's already in the game such as a razor blade typhoon.

Also how would i go about using pre existing boss and enemy ai
For the projectile, when you spawn a projectile, you've got the part that says 'mod.ProjectileType("ExampleBullet ")' replace that with the numeric ID of the vanilla projectile you want to spawn.
As for the ai, you can set the aiStyle and aiType inside the SetDefaults function of an npc to the style and type you want.
 
Is there a way I can spawn an already existing dust from the vanilla game? E.g the flame stuff
public static int NewDust(Vector2 Position, int Width, int Height, int Type, float SpeedX = 0f, float SpeedY = 0f, int Alpha = 0, Color newColor = default(Color), float Scale = 1f)

As for what Type to use, not all the dusts are named. If you have decompiled Terraria you could look there in whatever item or projectile you want to emulate and see which type they use. Or, you can count from this image. Each dust is 3 separate images (chosen randomly on spawn), one on top of the other. So, there are 3 rows here, with 100 different dusts in each row. Find the one you want, then count from 0. (0 to 99 in first row, 100 to 199 in second, 200 to 268? in third.)

Dust.png
 
Is there any documentation on the TileObjectData class? I can't find any help for it and I'm really confused as to what does what setting up the Example Tiles. I'm trying to make forms of sundials, but of all things to break it's the rendering of the block, which I can only assume is a result of me missing a crucial TileObjectData statement. Here is the code for the tile:
Code:
using System;
using Microsoft.Xna.Framework;
using System.Timers;
using Terraria;
using Terraria.DataStructures;
using Terraria.Enums;
using Terraria.ModLoader;
using Terraria.ObjectData;

namespace SunDials.Tiles {
public class NightSundial : ModTile
{
  Timer speedTimer = new Timer();

  public override void SetDefaults()
  {
    speedTimer.Interval = 1000 / 30;
    speedTimer.Elapsed += MoveTime;
    speedTimer.AutoReset = true;

    Main.tileNoAttach[Type] = true;
    TileObjectData.newTile.CopyFrom(TileObjectData.Style2xX);
    TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0);
    TileObjectData.addTile(Type);
    mapColor = new Color(64, 64, 0);
    mapName = "Night Sundial";
  }

  public override void RightClick(int i, int j)
  {
    Main.PlaySound(3, -1, -1, 1);
    speedTimer.Start();
  }

  private void MoveTime(Object source, ElapsedEventArgs e)
  {
    Main.time += 100;
    if((Main.time < 200 && !Main.dayTime) || new Random().Next(0, 99999) == 0)
      speedTimer.Stop();
  }
}}
 
public static int NewDust(Vector2 Position, int Width, int Height, int Type, float SpeedX = 0f, float SpeedY = 0f, int Alpha = 0, Color newColor = default(Color), float Scale = 1f)

As for what Type to use, not all the dusts are named. If you have decompiled Terraria you could look there in whatever item or projectile you want to emulate and see which type they use. Or, you can count from this image. Each dust is 3 separate images (chosen randomly on spawn), one on top of the other. So, there are 3 rows here, with 100 different dusts in each row. Find the one you want, then count from 0. (0 to 99 in first row, 100 to 199 in second, 200 to 268? in third.)

View attachment 79379
Oh lovely, time to do some counting.
Thanks for the help!
EDIT: Also you strange ninja guy!
 
Soooo, I feel like an idiot asking this... but how do I get the actual tModLoader? The Mediafire download just has a patcher .bat and that's it, no program to run.
 
Back
Top Bottom