tModLoader

tModLoader

Scryie Nov 5, 2021 @ 7:20am
Help with modding
So I wanted to know how to both get Ids of modded items,.
And how to give accessoires the effects of other accessoires.
I tried to look for a guide of some kind but could not find one for ether
< >
Showing 1-14 of 14 comments
White_Tiger Nov 5, 2021 @ 3:39pm 
To get a mod item ID, you put in "ModContent.ItemType<ThePlaceWhereTheItemIs/ItemName>()". If the item you're looking for is in a folder that is being used by the file, or is in the same namespace as the item, I don't think you have to put the mod name before the place where the item is.

To get the effects of vanilla acessories onto modded acessories, you put
"public overide void UpdateAccessory(Player player, bool hideVisual)"
into the item, and put "player.#", replacing # with the effect you want. This can be done with GlobalItem as well, I believe; you just have to put "Item item" before "Player player" and do a check for the item.

To find a player effect, you can go into the .csproj file, open it, and go to a file within there that uses "player". There, hover over it if it's blue, and double click when "Player" (it's shown in a greenish-cyan) shows up. It will open up the Player class, and you can view all of the player effects in Vanilla, among a lot of other things. Some things are named rather obviously (ala "magicQuiver" granting the effects of Magic Quiver) but others might need a bit more detective work (ala "dash" being a integer, so you have to find out what integers correspond to what kind of dash)
poqqers Nov 5, 2021 @ 4:02pm 
using the item editor mod if you grab an item, scroll down to projectile shot, and then it shows the id that the weapon fires
White_Tiger Nov 5, 2021 @ 5:13pm 
That only shows the Projectile ID (if i'm reading thar right? haven't used the mod), which can only be used as just a number for vanilla projectiles, as modded projectiles don't have 'consistent' IDs (as in they change every time new modded projectiles are added).

To get vanilla projectile IDs, you should probably head to https://github.com/tModLoader/tModLoader/wiki/Vanilla-Projectile-IDs

For modded projectiles, put down
ModContent.ProjectileType<ThePlaceWhereTheProjectileIs.ProjectileName>()
with the same rules as the modded item one.
Last edited by White_Tiger; Nov 5, 2021 @ 7:51pm
Scryie Nov 6, 2021 @ 6:33am 
Ok but where do I put each bit code
Last edited by Scryie; Nov 6, 2021 @ 6:33am
White_Tiger Nov 6, 2021 @ 9:25am 
Please, just go through ExampleMod's code.
If you haven't already, read this wiki page from tModloader's github;
https://github.com/tModLoader/tModLoader/wiki/Basic-tModLoader-Modding-Guide
There's also some other pages that can help you if you find them.
Last edited by White_Tiger; Nov 6, 2021 @ 9:26am
Scryie Nov 6, 2021 @ 12:23pm 
So the thing is, I have been looking in example mod, But it does not help for the stuff I want to know on this page, Also I've used many sources and still don't know.

Also when I make accessoires I want to add combined ones out of them,
So it would help alot to know how to use item references.

shttps://forums.terraria.org/index.php?threads/adding-bundle-of-balloons-an-modded-accessory.99761/

https://forums.terraria.org/index.php?threads/is-there-a-mod-that-tells-you-the-item-id-of-other-mods.100309/
White_Tiger Nov 7, 2021 @ 7:00am 
First, sorry if I was a bit rude in my last reply. However, I don't see what you're asking for? You can put several vanilla accessory effects onto a single item and find mod item IDs using the examples you've shown.
Scryie Nov 7, 2021 @ 9:58am 
Would it be ok to show an example accessory with the reference for say, Armour polish

Also omniswing has blacklist that might show item ids, I will try that for ids
Last edited by Scryie; Nov 7, 2021 @ 10:12am
White_Tiger Nov 7, 2021 @ 10:31am 
Can you elaborate on what you mean by "reference"?

Sidenote: Acessories that provide immunities to debuffs just have "player.buffImmune[the buff ID] = true;" in their UpdateAccessory, so there are no bools for acessories like Armor Polish and the Ankh in the Player class.
Scryie Nov 7, 2021 @ 10:50am 
What I mean by reference is the other item, ae the other accessory,
Also maybe make the reference say frostspark boots
White_Tiger Nov 7, 2021 @ 12:13pm 
If you mean "reference" as in "copy" ala item.CloneDefaults, I'm afraid that you'll have to manually add their effects in UpdateAcessory.

On the topic of boots, they're a somewhat special case while trying to replicate them, where they instead modify player stats while having most of their exact boosts unlisted... unless you go into the source code.

While I myself haven't ventured into the source code, I've got a rough estimate of the increases Lightning Boots give.

player.maxRunSpeed += 3.2f;
player.moveSpeed += 0.08f;
player.rocketBoots = 96;
Scryie Nov 8, 2021 @ 1:51am 
Say if I have a custom accessory, And I want it to be combined with some other one,
How would I add both to the combined one
White_Tiger Nov 9, 2021 @ 9:07am 
Then you add both of them to the UpdateAcessory.
Example:

public override void UpdateAccessory(Player player, bool hideVisual)
{
player.longInvince = true;
player.magicQuiver = true;
player.magmaStone = true;
player.manaFlower = true;
player.allDamage += 0.1f;
}
Scryie Nov 9, 2021 @ 9:15am 
Yea this will do
< >
Showing 1-14 of 14 comments
Per page: 1530 50

Date Posted: Nov 5, 2021 @ 7:20am
Posts: 14