Standalone [1.3] tModLoader - A Modding API

H'ok... The Solarius item wasn't working because item.useAnimation was 1. I don't know how small it can be, but vanilla uses 25 there. Also, in the projectile, you've got 'projectile.type = ProjectileID.Arkhalis;' which will make the item a cosmetic clone of Arkhalis. If you want to use your own sprite, you'll need 'aiType = ProjectileID.Arkhalis;' instead.

Now, if you want to delay the projectile from homing in on enemies, then create an int to use as a timer, then place your homing code inside an if statement that checks if your int is above a specific value, and if it isn't, increase the timer. To adjust how quickly your projectile accelerates, change the 1.5f in the line 'projectile.velocity += acceleration * 1.5f;'

To make the projectile return to the player when it hits something, set 'projectile.ai[0]' to 1. The hooks onHitNPC, onHitPVP and onTileCollide are where you'll want to do this.

I tried to use onTileCollide, but it failed :(
code
Code:
public override bool OnTileCollide(Vector2 oldVelocty)
        {
            projectile.ai[0] = 1;
        }

error
not all code paths return a value.
and the line numbers are pointing to OnTileCollide
 
I tried to use onTileCollide, but it failed :(
code
Code:
public override bool OnTileCollide(Vector2 oldVelocty)
        {
            projectile.ai[0] = 1;
        }

error
not all code paths return a value.
and the line numbers are pointing to OnTileCollide
In public override bool ontilecollide, you have "bool" or void, or other. this is the value than you need return.

Void: you do not need return a value.
Bool: You need return true or false.
Etc
 
In public override bool ontilecollide, you have "bool" or void, or other. this is the value than you need return.

Void: you do not need return a value.
Bool: You need return true or false.
Etc

I changed it to void
error
return type must be 'bool' to match overridden member
 
You cannot change a override method. (Because this is a method already write in the modloader/ vanilla code than you "override" for replace code )
When i have say, you need return a value, YOU RETURN A VALUE, not you change the method.

Put return false or true, just that. (True if you want a tilecollide or false you wannot. (your projectile.ontilecollide or npc.ontilecollide have not effect when you apply this method ^^)
 
Code:
projectile.aiType = ProjectileID.Arkhalis;

this used to work in setdefaults and now it doesn't, but I didn't change it
error
Terraria.Projectile does not contain a definition for aiType and no extention method aiType accepting a first argument of type Terraria.Projectile could be found
 
This is just aiType, not projectile.aiType, already ^^.
 
Opening the mod browser is causing my game to freeze. Any ideas why?
 
Opening the mod browser is causing my game to freeze. Any ideas why?

For me as well.
After about a minute it brings it up, but until then it's locked.

And updating mods seems to be taking forever.
 
Um, I can't find the publish button for my mod anywhere on tmod. It's nowhere to be found. Just vanished. I asked for help once and nobody replied.
 
Um, I can't find the publish button for my mod anywhere on tmod. It's nowhere to be found. Just vanished. I asked for help once and nobody replied.
You are probably looking on the wrong menu or you haven't built it yet.
 
Are you on steam or cracked
but i dont have any experience in modding and that was my first try:confused: myabe you could take a look at my codes and see whats wrong
 
im back with another question:

how i display multiple different dusts with different colors on one single projectile??
(i want all the 4 different moon colors: orange, purple, blue and green)

Code:
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace SacredTools.Projectiles
{

    public class MoonBeam : ModProjectile
    {
        public override void SetDefaults()
        {
            projectile.name = "Moon Beam";  //projectile name
            projectile.width = 20;       //projectile width
            projectile.height = 28;  //projectile height
            projectile.friendly = true;      //make that the projectile will not damage you
            projectile.melee = true;         //
            projectile.tileCollide = true;   //make that the projectile will be destroed if it hits the terrain
            projectile.penetrate = 5;      //how many npc will penetrate
            projectile.timeLeft = 200;   //how many time this projectile has before disepire
            projectile.light = 0.75f;    // projectile light
            projectile.extraUpdates = 1;
            projectile.ignoreWater = true;  
        }
        public override void AI()           //this make that the projectile will face the corect way
        {                                                           // |
            projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; 
            projectile.velocity.Y += projectile.ai[0];
           
           
            if (projectile.localAI[0] == 0f)
            {
                Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20);
                projectile.localAI[0] = 1f;
            }
            int num666 = 8;
            int num667 = Dust.NewDust(new Vector2(projectile.position.X + (float)num666 + 6, projectile.position.Y + (float)num666), projectile.width - num666 * 2, projectile.height - num666 * 2, 66, 0f, 0f, 0, new Color(36, 158, 184), 1.5f);  //projectile dust color
            Main.dust[num667].velocity *= 0.5f;
            Main.dust[num667].velocity += projectile.velocity * 0.5f;
            Main.dust[num667].noGravity = true;
            Main.dust[num667].noLight = false;
            Main.dust[num667].scale = 2.4f;
        }
        public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
        {
            target.AddBuff(mod.BuffType("MoonCurse"), 500);
        }
       
       
       
       
       
    }
}
[doublepost=1468240491,1468240474][/doublepost]how do i*
 
im back with another question:

how i display multiple different dusts with different colors on one single projectile??
(i want all the 4 different moon colors: orange, purple, blue and green)

Code:
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace SacredTools.Projectiles
{

    public class MoonBeam : ModProjectile
    {
        public override void SetDefaults()
        {
            projectile.name = "Moon Beam";  //projectile name
            projectile.width = 20;       //projectile width
            projectile.height = 28;  //projectile height
            projectile.friendly = true;      //make that the projectile will not damage you
            projectile.melee = true;         //
            projectile.tileCollide = true;   //make that the projectile will be destroed if it hits the terrain
            projectile.penetrate = 5;      //how many npc will penetrate
            projectile.timeLeft = 200;   //how many time this projectile has before disepire
            projectile.light = 0.75f;    // projectile light
            projectile.extraUpdates = 1;
            projectile.ignoreWater = true; 
        }
        public override void AI()           //this make that the projectile will face the corect way
        {                                                           // |
            projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f;
            projectile.velocity.Y += projectile.ai[0];
          
          
            if (projectile.localAI[0] == 0f)
            {
                Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 20);
                projectile.localAI[0] = 1f;
            }
            int num666 = 8;
            int num667 = Dust.NewDust(new Vector2(projectile.position.X + (float)num666 + 6, projectile.position.Y + (float)num666), projectile.width - num666 * 2, projectile.height - num666 * 2, 66, 0f, 0f, 0, new Color(36, 158, 184), 1.5f);  //projectile dust color
            Main.dust[num667].velocity *= 0.5f;
            Main.dust[num667].velocity += projectile.velocity * 0.5f;
            Main.dust[num667].noGravity = true;
            Main.dust[num667].noLight = false;
            Main.dust[num667].scale = 2.4f;
        }
        public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
        {
            target.AddBuff(mod.BuffType("MoonCurse"), 500);
        }
      
      
      
      
      
    }
}
[doublepost=1468240491,1468240474][/doublepost]how do i*

int num667 = Dust.NewDust(..., 66, ..., new Color(36, 158, 184),...); //projectile dust color

If you talk only with New Color(), you need just that:
Code:
Color color = new Color(0,0,0)
Int rand = Main.rand.Next(4);
switch (rand)
                {
                    case 0:
                    color = new Color(..,..,..)
                    break;
                    case 1:
                    color = new Color(..,..,..)
                    break;
                    case 2:
                    color = new Color(..,..,..)
                    break;
                    case 3:
                    color = new Color(..,..,..)
                    break;
int num667 = Dust.NewDust(..., 66, ..., color,...); 
}
 
could you please insert that into my code? i have no idea wat to replace ._.
 
and also:

Code:
public override void Update(NPC npc, ref int buffIndex)
        {
            //Example:
            if (Main.rand.Next(2) == 0)
            {
                int idx= Dust.NewDust(npc.position, npc.width, npc.height, mod.DustType("MoonDust"));
                Main.dust[idx].noGravity = true;
            }
            npc.HealEffect(-8, false);
            npc.statLife -= 8;
            if (npc.statLife < 0)
            {
                npc.statLife = 0;
            }
        }

i want the debuff to work on NPCs too, wat do i have to change??
 
and how do i make dust on items
 
I'm a computer noob. Where do I copy my vanilla characters and worlds to?
 
Terraria>ModLoader>Players/Worlds

here you go ^-^
 
Back
Top Bottom