Standalone [1.3] tModLoader - A Modding API

So how to fix it? and btw: is there any thread explaining all projectile.* types?
To fix it just remove those lines hardcoding the velocity of your projectile.
If you want a shuriken like AI, just use the following:
Code:
public override void AI()
{
    projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.03f * (float)projectile.direction;   
   
    projectile.ai[0] += 1f;
    if (projectile.ai[0] >= 20f)
    {
        projectile.velocity.Y = projectile.velocity.Y + 0.4f;
        projectile.velocity.X = projectile.velocity.X * 0.97f;
    }
}
If you want to change anything regarding the velocity in there: the code should speak for itself.
As for your second question: no, not that I know of. Just take the trial and error route to get your answers.
 
  • Like
Reactions: Hek
To fix it just remove those lines hardcoding the velocity of your projectile.
If you want a shuriken like AI, just use the following:
Code:
public override void AI()
{
    projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.03f * (float)projectile.direction;  
  
    projectile.ai[0] += 1f;
    if (projectile.ai[0] >= 20f)
    {
        projectile.velocity.Y = projectile.velocity.Y + 0.4f;
        projectile.velocity.X = projectile.velocity.X * 0.97f;
    }
}
If you want to change anything regarding the velocity in there: the code should speak for itself.
As for your second question: no, not that I know of. Just take the trial and error route to get your answers.
Did you just copy this from anywhere ? Or did you do this just right now? Because I would never have the idea of using Math.Abs and "(float)projectile.direction"
 
Did you just copy this from anywhere ? Or did you do this just right now? Because I would never have the idea of using Math.Abs and "(float)projectile.direction"
Math.Abs gets the absolute value of the given value/variable, meaning the value will always be positive, so that in this case the velocity only determines the speed at which the projectile rotates and direction determines the direction it's rotating towards.
 
  • Like
Reactions: Hek
Math.Abs gets the absolute value of the given value/variable, meaning the value will always be positive, so that in this case the velocity only determines the speed at which the projectile rotates and direction determines the direction it's rotating towards.
And how to adjust/fix this, so it flies further ? As already mentioned, when it comes to projectiles, im still lacking understanding.
OTLYcrQ.webm

picture can not load (here)
 
And how to adjust/fix this, so it flies further ? As already mentioned, when it comes to projectiles, im still lacking understanding.
OTLYcrQ.webm
The image is not working for me, but if you want the projectile to fly longer before it drops, you'll want to change the value that is checked here
if (projectile.ai[0] >= 20f)
Changing 20 to a higher value will result in more time before the drop.
 
  • Like
Reactions: Hek
The image is not working for me, but if you want the projectile to fly longer before it drops, you'll want to change the value that is checked here
if (projectile.ai[0] >= 20f)
Changing 20 to a higher value will result in more time before the drop.
Okay thanks, last question, how to change the flying speed before the shuriken drops right from the beginning?
 
Yepp thanks. Im working right now at stopping the rotation at the max point, and starting it again while dropping like the original shuriken
If it's allright, that should already be happening using the AI I gave you earlier?
 
Could you show me your code?
oh ok nvm. I just changed the 0.4 to 0.15
projectile.velocity.Y = projectile.velocity.Y + 0.15f;

Easier than what I would code ^^
[doublepost=1461608823,1461608690][/doublepost]
Could you show me your code?
Is it possible to let the projectile hit 3 times? The projetile are 3 shurikens, but when hitting enemies they are getting only damage by one source, e.g. one shuriken not 3
 
oh ok nvm. I just changed the 0.4 to 0.15
projectile.velocity.Y = projectile.velocity.Y + 0.15f;

Easier than what I would code ^^
[doublepost=1461608823,1461608690][/doublepost]
Is it possible to let the projectile hit 3 times? The projetile are 3 shurikens, but when hitting enemies they are getting only damage by one source, e.g. one shuriken not 3
Your best bet is to have the projectile fire slower after one another.
 
Hey guys, I have a bug to report in the server. Everytime I try to spawn a boss so me and my friends can fight it, the summon gets used up but the boss doesn't spawn. I don't know if this is a bug with Thorium or the tmodloader, but if there's a fix could you let me know?

Thanks
 
to the best of my knowledge, spawning something, without going through its proper channels, doesn't work. a workaround (assuming you have the source) is to make the npc's canspawn to return 10 when the item is used. something like

public override float CanSpawn(NPCSpawnInfo s)
{
Player p = s.player;
if(p.inventory[p.selectedItem].type == mod.ItemType("SummonItem")) return 10;

probably not the best solution, but i just came up with it off the top of my head lol

OH RIGHT now i remember what i came for.

does anyone know how to make a properly functioning right-click item? using
AltFunctionUse(Player player) gets me weird results

edit: nevermind i figured it out. to use it properly i needed to add if(player.altFunctionUse != 2) to what i didnt want to get activated in UseItem. otherwise it activated it
 
Last edited:
Yeah... As its been asked a million times on the thread, would the issue with multiplayer boss spawning be the problem of the item used to summon it, or the ai of the boss itself wigging out with multiple players on screen? and to add onto that question, do the tModLoader guys know exactly what were doing wrong that makes our modded enemies disappear when hit? Is it our fault?
 
Back
Top Bottom