Standalone [1.3] tModLoader - A Modding API

i just dont understand how the codeing is done so just saying add this and that without a code showing i got no idea what u mean

like " you can just spawn dust in the update function of the buff " means nothing to me as i dont know the code for it

also anyone got the full simple code for zombie
The example mod contains a LOT of re-usable code, which you can apply with a bit of tinkering. I, myself, am not going to provide code with every answer because of this. There's also a low (to no) learning curve when you keep asking for code without exploring a bit for yourself. There's even some peeps (although I don't know if they reside on this forum) that might get mad at you for asking code instead of an explanation.
I also assume someone knows at least a bit of programming when asking a question (which was the case with that answer), unless stated, which doesn't require code as much as an explanation on the 'how to' subject.

So my advice: Read up on modding and programming. Take the example mod and try to comprehend everything it contains, as these are the fundamentals for programming with tModLoader. I'm not trying to make you stop asking questions, not in the least, as I try to ask as much as possible when I don't understand something. Just try to change the attitude of the question, as you might get more easy-going answers.
 
The example mod contains a LOT of re-usable code, which you can apply with a bit of tinkering. I, myself, am not going to provide code with every answer because of this. There's also a low (to no) learning curve when you keep asking for code without exploring a bit for yourself. There's even some peeps (although I don't know if they reside on this forum) that might get mad at you for asking code instead of an explanation.
I also assume someone knows at least a bit of programming when asking a question (which was the case with that answer), unless stated, which doesn't require code as much as an explanation on the 'how to' subject.

So my advice: Read up on modding and programming. Take the example mod and try to comprehend everything it contains, as these are the fundamentals for programming with tModLoader. I'm not trying to make you stop asking questions, not in the least, as I try to ask as much as possible when I don't understand something. Just try to change the attitude of the question, as you might get more easy-going answers.

if i was able to understand tmodloader i wont be asking anything

and the example mod does not have a normal zombie in it has 2 mobs and 1 boss
a hover and a fish

and there is no videos of how to use tmodloader anywhere

the Documentation does not tell me anything as well as i dont know the codeing for what it tells
 
if i was able to understand tmodloader i wont be asking anything

and the example mod does not have a normal zombie in it has 2 mobs and 1 boss
a hover and a fish

and there is no videos of how to use tmodloader anywhere

the Documentation does not tell me anything as well as i dont know the codeing for what it tells
The documentation does tell you stuff
It gives a fair explanation of what each hook does. You just have to have some programming experience to understand it all
 
and thats what i dont have no idea what a hook is
Alright, I'll try to make these explanations as simple as possible:

A hook is a method you can override that lets you allow your code to run inside the vanilla code.

A method is a group of code that can easily be run from other places.

Overriding means to change the code in a method. For example, most ModItem methods are empty, so you override them to change the code to what you want.
 
if i was able to understand tmodloader i wont be asking anything

and the example mod does not have a normal zombie in it has 2 mobs and 1 boss
a hover and a fish

and there is no videos of how to use tmodloader anywhere

the Documentation does not tell me anything as well as i dont know the codeing for what it tells
Like I said, asking questions is good, I do it all the time. Do not refrain from asking questions where you think you need them.

It's true that the example mod doesn't contain a zombie, but it does contain the example for an NPC.
For a zombie type, you need to know what aiStyle it uses. It uses the fighter style, so in your SetDefaults function you can set 'npc.aiStyle' to 3.
Then you need to look up the aiType of a zombie. You can look up the zombie on the Terraria wiki and check its ID. This is the value you want to set for 'aiType' in your SetDefaults method. Your NPC should then act as a zombie (with the rest of the variables in SetDefaults et of course, like width/height, etc).
 
the Sarcophagus mob that is in the example mod has smoke around it anyway to turn the amount of smoke down
In the CustomBehaviour method of the sacrophagus you have the following lines:
Code:
for (int k = 0; k < 2; k++)
            {
                int dust = Dust.NewDust(npc.position - new Vector2(8f, 8f), npc.width + 16, npc.height + 16, mod.DustType("Smoke"), 0f, 0f, 0, Color.Black);
                Main.dust[dust].velocity += npc.velocity * 0.25f;
            }
You can make the smoke less by changing the '2' in the for loop (to, for example, 1).
 
i am trying to add 2 mobs to the same banner can one do that

i got em to drop same banner so it counts 2 both but getting the effect for both mobs does not work when trying
 
There's an example for that in the Example Mod.
tTSRMVV.png

That is the texture being used.
You will (especially) want to take a look at the 'NearbyEffects' inside the ModTile called 'MonsterBanner'.
And note the 'item.placeStyle' in the SetDefaults of the different banner ModItems. This will make the eventual banner tile do different things.
 
There's an example for that in the Example Mod.
tTSRMVV.png

That is the texture being used.
You will (especially) want to take a look at the 'NearbyEffects' inside the ModTile called 'MonsterBanner'.
And note the 'item.placeStyle' in the SetDefaults of the different banner ModItems. This will make the eventual banner tile do different things.


i tryed many things

public override void NearbyEffects(int i, int j, bool closer)
{
if (closer)
{
Player player = Main.player[Main.myPlayer];
int style = Main.tile[i, j].frameX / 18;
string type;
switch (style)
{
case 0:
type = "Sarcophagus";
break;
case 1:
type = "Octopus";
break;
default:
return;
}
player.NPCBannerBuff[mod.NPCType(type)] = true;
player.hasBanner = true;
}
}


{
case 0:
type = "Sarcophagus";
type = "testingnpc";
break;
case 1:
type = "Octopus";
break;
default:
return;
}


{
case 0:
type = "Sarcophagus","testingnpc";
break;
case 1:
type = "Octopus";
break;
default:
return;
}

{
case 0:
type = "Sarcophagus" && "testingnpc";
break;
case 1:
type = "Octopus";
break;
default:
return;
}

{
case 0:
type = "Sarcophagus" || "testingnpc";
break;
case 1:
type = "Octopus";
break;
default:
return;
}

{
case 0:
type = "Sarcophagus"
break;
case 0:
type = "testingnpc"
break;
case 1:
type = "Octopus";
break;
default:
return;
}

they all failed of what i tryed and ran out of ideas so i came here
 
i tryed many things

public override void NearbyEffects(int i, int j, bool closer)
{
if (closer)
{
Player player = Main.player[Main.myPlayer];
int style = Main.tile[i, j].frameX / 18;
string type;
switch (style)
{
case 0:
type = "Sarcophagus";
break;
case 1:
type = "Octopus";
break;
default:
return;
}
player.NPCBannerBuff[mod.NPCType(type)] = true;
player.hasBanner = true;
}
}


{
case 0:
type = "Sarcophagus";
type = "testingnpc";
break;
case 1:
type = "Octopus";
break;
default:
return;
}


{
case 0:
type = "Sarcophagus","testingnpc";
break;
case 1:
type = "Octopus";
break;
default:
return;
}

{
case 0:
type = "Sarcophagus" && "testingnpc";
break;
case 1:
type = "Octopus";
break;
default:
return;
}

{
case 0:
type = "Sarcophagus" || "testingnpc";
break;
case 1:
type = "Octopus";
break;
default:
return;
}

{
case 0:
type = "Sarcophagus"
break;
case 0:
type = "testingnpc"
break;
case 1:
type = "Octopus";
break;
default:
return;
}

they all failed of what i tryed and ran out of ideas so i came here
Ah, so it's that function you're having difficulties with. Allright, no probs. Can you tell me the file names of the NPCs you want this banner to work for?
 
i am trying to add 2 mobs to the same banner can one do that

i got em to drop same banner so it counts 2 both but getting the effect for both mobs does not work when trying
If you managed to make them drop the same banner, then it should work without you having to do anything extra. Can you show the code for the NPC?
 
its basicly the Sarcophagus mob clone with another name thats more like it
If you want two NPCs to share the same banner, one of the NPCs has to have different code from all the other NPCs. First, remove this line from your NPC:
Code:
bannerItem = mod.ItemType("SarcophagusBanner");
Then change this line:
Code:
banner = npc.type;
to this line:
Code:
banner = mod.NPCType("Sarcophagus");
 
If you want two NPCs to share the same banner, one of the NPCs has to have different code from all the other NPCs. First, remove this line from your NPC:
Code:
bannerItem = mod.ItemType("SarcophagusBanner");
Then change this line:
Code:
banner = npc.type;
to this line:
Code:
banner = mod.NPCType("Sarcophagus");

that worked

so just so i know if i want to add a new banner i just make that picture file bigger and use case:2 right
[DOUBLEPOST=1448281555,1448281159][/DOUBLEPOST]i found another thing i cant seem to get right

bandicam 2015-11-23 13-22-59-232.jpg


i got both red and blue Sarcophagus blue being the one that was there to start with

anyway to make the banner only say Sarcophagus
while both mobs are named red and blue
 
Just FYI, implementing unobtainable items (I saw the luminite drills on your github) is against the forum rules (citation needed), so I'll have to delete your mod if you post it to the Mod Browser. (And a forum moderator will delete it if you post a thread for it.)
  • Do not give access to restricted content. This includes, but is not limited to, disabling, modifying, or bypassing the restrictions of the Terraria Collector's Edition or the restrictions placed on developer exclusive items.
NOT ALLOWED: Posting links to or the discussion of specific methods (guides, code, etc) to obtain these items is not allowed. This content will be removed and warnings issued. This includes links to modded versions of Terraria for PC that make these items available.
Do not package Terraria's fonts, images, sounds, or other content files for the purpose of redistribution. However, Terraria content files may be included in an enhancement if they are needed for the proper operation or use of the enhancement and not primarily functioning as a form of redistribution.
As far as I understand it, you aren't allowed to distribute restricted content from Terraria. Well, I'm not really giving access to unobtainable items, I'm making a copy of them... So you can't just craft the Vortex Drill from my mod and then sell it to Vanilla players. I have no idea if that counts as illegal distribution or not.:confused: Should I ask a moderator about this?

As for the textures, I'll redo the Luminite drill textures from scratch (if implementing them is allowed in the first place. If not, I'll remove both the drills and the hamsaws completely).
I didn't want to create yet another separate ID system for glow masks, so what you'll have to do is override the PostDraw hooks and manually draw your glow masks there.
OK, that makes sense. I'm not that familiar with rendering in Terraria/C# but I'll come up with something.
 
Last edited:
Back
Top Bottom