• For issues you find with the Switch and Console releases, please follow this link and give as much detail as possible. This is the speediest way to get info to Pipeworks and get a hotfix in the works.
  • 1.4 will bring many changes to the PC version. We strongly advise making plans to back up your worlds and players prior to updating your game. More details here.
  • Begin your search for Journey's End information here and here. Please report bugs and issues for Journey's End here.
  • For issues you find with the Mobile 1.3 update, please follow this link and give as much detail as possible. This is the speediest way to get info to DR Studios to look at your issue. Also, some troubleshooting hints here.

Standalone [1.3] tModLoader - A Modding API

Replace it with this:
Code:
if(player.HasItem(75))
            {
                for(int i=0; i < player.inventory.GetLength(0); i++)
                {
                    if (player.inventory[i].type == 75)
                        {
                            item.damage += 1 * player.inventory[i].stack;
                        }
                }
            }
the first if statement isn't necessary, but prevents unnecessary code running if the criteria aren't met.

That code makes every item in the first stack (maybe others) of whatever 75 is increase the damage by one. Theoretically, it wouldn't work for multiple stacks and I don't know how to fix that. I need to sleep anyways.
Oh cool thanks! the damage kept actually going up for a bit, but I just had to change a bit and now it works fine. Thanks for the help. (Yeah I haven't coded at all before I started working on this mod so I'm a bit rusty.)
 

Passthejampls

Official Terrarian
Started working on my mod and i have a question: do you know if the syntax for the mod cs file or anything already made will change?
 

blushiemagic

Retinazer
tModLoader
Started working on my mod and i have a question: do you know if the syntax for the mod cs file or anything already made will change?
If you mean the method signatures and the fields, they have changed in the past and while this is WIP it is always possible they will change in the future.
 

Smiffy

Skeletron Prime
You don't actually have to detect when enter is pressed in this case, you can simply check for a change in the chat box.

Code:
if(Main.chatLine[0].text!=lastChatLine)
{
    lastChatLine = Main.chatLine[0].text;
    //do stuff with the command
}
I didn't think of that. The problem with this though is where to run it, since there is no Update hook to put it in. I still need the tool to execute this code.

Edit: Testing stuff

Edit2: Managed to use a ModDust's update hook to detect key presses. The fact that the dust disappears under certain conditions makes this far from perfect (and I still need a tool to summon the ModDust), but it kinda works.
 
Last edited:

DarkKingJoey

Terrarian
I get an error with this code:

player.magicCrit *= 5.0f;

\Documents\my games\Terraria\ModLoader\Mod Sources\TerrariaUnleashed\Items\Armour\SlimeHood.cs(39,33) : error CS0266: Cannot implicitly convert type 'float' to 'int'. An explicit conversion exists (are you missing a cast?)
 

Jofairden

Duke Fishron
tModLoader
I get an error with this code:

player.magicCrit *= 5.0f;

\Documents\my games\Terraria\ModLoader\Mod Sources\TerrariaUnleashed\Items\Armour\SlimeHood.cs(39,33) : error CS0266: Cannot implicitly convert type 'float' to 'int'. An explicit conversion exists (are you missing a cast?)
Code:
Cannot implicitly convert type 'float' to 'int'
If you don't get this, go back to c# tutorials.
 

zadum4ivii

Official Terrarian
Who are "basic" NPCs? Mobs with vanilla AI?
Also is it possible now to make an item that can be fished in a specific biome?
 

blushiemagic

Retinazer
tModLoader
Does this mean, SetDefaults? I see it in the docs but in the current version it doesn't seem to be there. Also multiple global items please? :D

No more copy .dll here, copy .dll there blabla bulsh`t? :D
That means instead of SetGlobalWhatever, there is AddGlobalWhatever, and you can add multiple GlobalWhatevers per mod so you can organize what you do to vanilla items and all items.

For the improved dll system, if it actually works then you should only have to put the dll files in a dllReferences folder.

Who are "basic" NPCs? Mobs with vanilla AI?
Also is it possible now to make an item that can be fished in a specific biome?
Basic NPCs are NPCs with only the SetDefaults hook. So yes, they're mobs with vanilla AI (but without things like banners, drops, etc).
 

Jofairden

Duke Fishron
tModLoader
That means instead of SetGlobalWhatever, there is AddGlobalWhatever, and you can add multiple GlobalWhatevers per mod so you can organize what you do to vanilla items and all items.
Alright I understand, exactly what I need. Also for GlobalItem I suppose?

For the improved dll system, if it actually works then you should only have to put the dll files in a dllReferences folder.
That would be way easier for people using the mod :D Currently I've just set up a little post-build code so that I don't have to keep copying the file:
Code:
copy /Y "$(TargetDir)$(TargetFileName)" "C:\Program Files (x86)\Steam\steamapps\common\Terraria\file.dll"
copy /Y "$(TargetDir)$(TargetFileName)" "C:\Users\Admin\Documents\My Games\Terraria\ModLoader\Mods\file.dll"
copy /Y "$(TargetDir)$(TargetFileName)" "C:\Users\Admin\Documents\My Games\Terraria\ModLoader\Mod Sources\file.dll"
 

blushiemagic

Retinazer
tModLoader
v0.3.1
-Added support for multiple global entities per mod
-Added support for autoloading global entities
-Added support for autoloading multiple EquipTypes per item
-Fixed bug where AddTooltip duplicates tooltips
-Improved dll reference system
-Fixed bug where missing equipment textures crashes the game
-Made WorldGen class public
-Added support for walls
--Added support for wall kill sounds, dust, drops, and kill-related hooks
--Added support for wall map colors and names, and related hooks
--Added ModifyLight and RandomUpdate hooks for walls
--Added AnimateWall, PreDraw, and PostDraw hooks for walls
-Added MouseOver and Slope hooks for tiles
-Added support for very basic projectiles and NPCs (Untested)

First, I will start with some warnings. If your mod uses any global entities (eg GlobalItem, GlobalTile), you will have to change your code in order for it to compile again. Also, to make things more convenient, global entities autoload now... so make sure you don't add the same global entity twice.
In addition, I have not tested custom projectiles or NPCs at all. So keep in mind that they may or may not actually work.

With that out of the way, I want to give a huge thanks to @Chicken Bones for creating a code patcher for tModLoader. Now, anyone who has their own copy of Terraria.exe can decompile it, patch it to tModLoader, then contribute to the Github.

For the next update, I was originally planning to add hooks for projectiles and NPCs. However, I predict that that update will take a very long time. So while I mentally prepare myself for that, I will use this time to take in suggestions and bug reports so far, and use those for the next update. Please, please report any bugs you find (even if they're related to projectiles or NPCs). As for suggestions, at the moment I am only taking in suggestions for the following things:
  • Recipes
  • Items
  • Dust
  • Tiles
  • Walls (lol)


Let me try again
[DOUBLEPOST=1438967445,1438967395][/DOUBLEPOST]I didn't get anything in there
Hm, you might have to unblock some of the files in all of the folders. The computer sometimes blocks every file from the Internet.
 

CJT157

Eye of Cthulhu
I was getting a security notification while running the patch so ill try with the new update
[DOUBLEPOST=1438968684,1438968297][/DOUBLEPOST]no it still didn't go into the folder
 

Jofairden

Duke Fishron
tModLoader
Woot, updating to new version now.
[DOUBLEPOST=1438970300,1438969913][/DOUBLEPOST]So wait, autoload now loads all global hooks as well?
 
Top Bottom