Standalone [1.3] tModLoader - A Modding API

so, servers only work on windows? like, if someone is hosting a server on windows, i could not join on a mac?
You should be able to, I guess.

About tModLoader. How do I change item pickup text color? I guess item.rare doesn't affect it.
 
Last edited:
I'm having trouble with the ModTile class, I want a particle to spawn at a specific location rather than on all of the tiles at once. (For example in a 3x3 tile) The PostDraw method will draw particles on all 9 tiles, iterating through them with coordinates i and j. What I have right now is an if statement that will modify the location of the particle's vector2 so that it will stay in the same tile all the time, based on how many cycles it iterated through. Here's a rough example of what I have:
Code:
//in the class scope
int cycle = 1;

//in the postdraw method
Vector2 dustLoc = new Vector2(i,j); //initializes dustLoc
float tilesize = 1f;
if(cycle <= 9) //iterates through the 9 tiles
{
    float xOffset = (((cycle + 2) % 3) * tilesize);
    float yOffset = (((cycle - 1) / 3) * tilesize);
    dustLoc = new Vector2(i + 1.1f - xOffset, j + 0.4f - yOffset);
    cycle++;
    if(cycle == 10)
    {
    cycle = 1;
    }
}

int dust = Dust.NewDust(dustLoc * 16f, 0, 0, mod.DustType("Spark")); //creates the particle
Now this code works perfectly if there is only one of these 3x3 tiles on the world. The moment I put more, they go all over the place. I think the problem is that the cycle integer is actually a static field shared by all of the tiles in the world, but how do I go fixing that?
You could try checking the tile's frame, using the frameX and frameY fields in Tile. They represent the coordinates on the tile's spritesheet that the tile is using.

so, servers only work on windows? like, if someone is hosting a server on windows, i could not join on a mac?
Anyone can join any server that is hosted. It's just that only Windows can host servers. For example, a Mac player can join a Windows server, but a Mac player can't host a server.

You should be able to, I guess.

About tModLoader. How do I change item pickup text color? I guess item.rare doesn't affect it.
Hm, item.rare should affect it. Does that not work for you?

how do i update the tmodloader
By installing it again. "Installing" in this case is just copying files (which the installer jar does for you).
 
It doesn't. My custom item's rarity is '-12' (Rainbow), and it correct displays in inventory. But when I pickup my item, the text is white.
Oh, that rainbow rarity is a weird one. Absolutely nothing in-game uses it. I wouldn't recommend using that rarity. To get the rainbow color, you'll want to either set item.expert to true, or wait for more UI support.
 
Anyone can join any server that is hosted. It's just that only Windows can host servers. For example, a Mac player can join a Windows server, but a Mac player can't host a server.
sweet. you should probably change the main post then, it says 'servers currently only work on windows' which can be misleading :)
 
Oh, that rainbow rarity is a weird one. Absolutely nothing in-game uses it. I wouldn't recommend using that rarity. To get the rainbow color, you'll want to either set item.expert to true, or wait for more UI support.
I totally forgot about item.expert. Thank you.
And I've got another question. How do I do a projectile that falls down like Daedauls Storm Bow's arrows, but single?
 
I totally forgot about item.expert. Thank you.
And I've got another question. How do I do a projectile that falls down like Daedauls Storm Bow's arrows, but single?
This is done in the Shoot method of the weapon that shoots the projectile. Basically, raise the y position up and rotate the speed x and y to aim towards the cursor using geometry.

How do I make pets?
If you clone the AI of a vanilla pet, it is super easy: See ExamplePet (Projectile, Item, Buff, and the bool in the ExamplePlayer)

If you want your own movement behaviors, you'll have to program the AI.
 
I was having trouble with the mod browser for now... I'm not sure what is going on but since I updated 0.8, I cannot download mods from it. When I clicked the Download bottom and it did start to download, but when it finished (actually failed I think), the game cannot read the mod.
Went to the mods folder and thenI found that the mod files are in fact all sized 0 KB. Obviously there should be some bad connections in this case I think.
I tried so many times but the results remain the same - failed.So I would like to know if there is any backup solution for me to download those mods. 'cause some of them are for tutorial and example usage, which have good value for me.
Or if there isn't any backup solution or direct links... let me ask if there is anyone willing to help me download all those mods and send them to me through the internet? If there is... please help me and I'd leave a big thx here anyways!
 
I'm making a gun with a reload mechanic. To indicate amount of ammo left in clip, I want to draw a number of shells under the cursor. Code below compiles and game works, but the sprites do not render. Both position and number of sprites to draw are coded correctly (commented out dust was used to check that), both path and sprite name are correct. This code is from ModItem derivative class. What am I missing here?

Code:
public override void PostDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale)
{
     if(currentAmmo > 0 )
     {
                for(int i=0; i<currentAmmo; i++)
                {
                    float drawX = Main.screenPosition.X + Main.mouseX + 8f*i - 8f*currentAmmo/2;
                    float drawY = Main.screenPosition.Y + Main.mouseY + 20f;
                    spriteBatch.Draw(mod.GetTexture("UI/AmmoShotgun"), new Vector2(drawX,drawY), null, drawColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
                    //Dust.NewDust(new Vector2(drawX,drawY), 10, 10, 6);
                }
       }
}
 
Back
Top Bottom