In the projectile's image file, draw the frames vertically next to each other, making sure that each frame has the exact same height. Then use the "frameCount" property in the projectile's .json file to let the program know how many frames the image represents. Finally, to change the projectile's frame, do stuff likeHow do I make projectiles have frames?
projectile.frame = 0; //for the first frame
projectile.frame = 1; //for the second frame
//etc.
Yeah, I've been removing and rebuilding it every time. I tried it without the .cs file, and it didn't work that time either. Does it require the .cs file to run, or would it work without it if that was the problem?Whenever you get your mod to successfully build, but it crashes when trying to load, then most likely there's either a crash occurring in a .cs file or you forgot to name an image file after an item file. So there can't be any problem with the .json.
Edit: This isn't the problem, but just to avoid future problems, if your file name is called Rune_bolt, then the .cs class name has to follow the same capitalization. Also, you're making sure to both rebuild and reload your mod after every thing you try, right? I forget to do that sometimes.
In the projectile's image file, draw the frames vertically next to each other, making sure that each frame has the exact same height. Then use the "frameCount" property in the projectile's .json file to let the program know how many frames the image represents. Finally, to change the projectile's frame, do stuff like
Code:projectile.frame = 0; //for the first frame projectile.frame = 1; //for the second frame //etc.
Hm, this is weird. Items, projectiles, and those kinds of things don't require .cs files to run; .cs files just essentially add extra stuff to them. At the moment, the only thing I can think of is maybe a slight typo/capitalization error in the file names, but you've already checked over all of that.Yeah, I've been removing and rebuilding it every time. I tried it without the .cs file, and it didn't work that time either. Does it require the .cs file to run, or would it work without it if that was the problem?
You'll basically put that in the AI method. There is no frame speed, because you need to change projectile.frame manually yourself. You can use projectile.frameCounter to keep track of how long the current frame has been lasting. So a simple animation would go something like this:What hook do I put that in and don't I have to input the frame speed?
projectile.frameCounter++;
if(projectile.frameCounter >= 5) //replace this number with how many ticks one frame should last
{
projectile.frame++;
projectile.frame %= 5; //replace this number with how many frames there are
projectile.frameCounter = 0;
}
What I posted is what is in the mod, there's literally those two items with images, a projectile with an image, the modinfo, and the .cs file which I already removed.Hm, this is weird. Items, projectiles, and those kinds of things don't require .cs files to run; .cs files just essentially add extra stuff to them. At the moment, the only thing I can think of is maybe a slight typo/capitalization error in the file names, but you've already checked over all of that.
Actually, do you have a class that overrides ModBase? I remember some stuff require the existence of a ModBase class to work, but I don't remember exactly what.
In that case, try adding a .cs file named after your mod, and make it a subclass of TAPI.ModBase. Not really sure if this will work, but it's worth a try.What I posted is what is in the mod, there's literally those two items with images, a projectile with an image, the modinfo, and the .cs file which I already removed.
You'd have to do something along these lines:What method do I have to use to spawn a tile? I'm making a projectile that's supposed to spawn a block of thin ice when it hits water.
int x = (int)(projectile.Center.X / 16f);
int y = (int)(projectile.Center.Y/ 16f);
Main.tile[x, y].type = /*insert tile ID here*/;
Main.tile[x, y].active(true);
Main.tile[x, y].liquid = 0;
if (Main.netMode == 2)
{
NetMessage.SendTileSquare(-1, x, y, 1);
}
else
{
WorldGen.SquareTileFrame(x, y, true);
}
That works, thanks. How do I detect which liquid it is? Would it be Main.tile[x,y].liquidType?You'd have to do something along these lines:
Code:int x = (int)(projectile.Center.X / 16f); int y = (int)(projectile.Center.Y/ 16f); Main.tile[x, y].type = /*insert tile ID here*/; Main.tile[x, y].active(true); Main.tile[x, y].liquid = 0; if (Main.netMode == 2) { NetMessage.SendTileSquare(-1, x, y, 1); } else { WorldGen.SquareTileFrame(x, y, true); }
Yup, it looks like Main.tile[x,y].liquidType() should work. And if you don't want to remember the number for each liquid type, you can use Main.tile[x,y].lava(), Main.tile[x,y].honey(), and Main.tile[x,y].water(). Unfortunately, it also looks like all tiles without liquid are actually treated as having water with a volume of 0, so I'm not sure how to detect whether or not there actually is liquid yet.That works, thanks. How do I detect which liquid it is? Would it be Main.tile[x,y].liquidType?
If you mean how to make it display in its full color and brightness regardless of lighting, I usually just use Main.dust[DustID].OverrideLightColor = Color.White. (I haven't bothered to find out whether there's a better way yet.)How do I make dust ignore lighting? I could have sworn it was Main.dust[DustID].ignoreLighting = true;
It's signed - with Ichor, zero defense enemies can go into the negative.1. Is Defense a Signed or Unsigned number? Can I go negative with defense of say, an accessory?
If I'm not mistaken, that would force the player to have both a Mythril and Orichalcum anvil to craft it. By putting just "Mythril Anvil" tAPI automatically lets you use both HM anvils.2. In this situation:
[{
"items": { "Light Shard": 1, "Dark Shard": 1, "Soul of Sight": 20. "Mana Crystal":2 },
"tiles": [ "Mythril Anvil","Orichalcum Anvil" ],
"creates": 1
}]
Will the "Tiles" function work, even though there are more than one tile that can be used to make this item? Thanks.
Not sure if I got it right, so let me clarify (mostly to myself): Can I assign a negative value to an accessory's defense property? Thanks though! Helps a ton.It's signed - with Ichor, zero defense enemies can go into the negative.
If I'm not mistaken, that would force the player to have both a Mythril and Orichalcum anvil to craft it. By putting just "Mythril Anvil" tAPI automatically lets you use both HM anvils.
I believe so, yes. If not, you can use the .cs file to reduce the players defence, because I know that in-game, and entity's defence can be negative.Not sure if I got it right, so let me clarify (mostly to myself): Can I assign a negative value to an accessory's defense property? Thanks though! Helps a ton.
Thanks for the help!I believe so, yes. If not, you can use the .cs file to reduce the players defence, because I know that in-game, and entity's defence can be negative.