Standalone [1.3] tModLoader - A Modding API

I am trying to figure out how to make a bouncing projectile. I figured some of it out thanks to the example mod, but how do I get the projectile to bounce only once, and does not penetrate enemies?
 
Yes. The forum rules prevent me from distributing mod executables that remove the Steam checks, so the only way I can distribute a GOG version would be through a diff patch. However, creating a diff patch requires that I have the vanilla GOG version myself, which requires me to buy it.

oh man, well I guess that's that. Thanks for letting me know
 
how do I make a debuff??
Same as a buff, except "Main.debuff[this.type] = true"
I am trying to figure out how to make a bouncing projectile. I figured some of it out thanks to the example mod, but how do I get the projectile to bounce only once, and does not penetrate enemies?
Try something like: Setdefaults set ai[0] to 1, ontilecollide bounce if ai[0]>0 and set ai[0] to 0, else explode. Leave penetrate to 1.
How can I get a projectile to stick to a block, like how a sticky bomb or glowstick would work.
OnTileCOllide velocity *= 0.
 
Code:
if (projectile.ai[0] <= 1)
{
   if (projectile.velocity.X != oldVelocity.X)
            {
                projectile.velocity.X = -oldVelocity.X;
            }
            if (projectile.velocity.Y != oldVelocity.Y)
            {
                projectile.velocity.Y = -oldVelocity.Y;
            }

            Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 10);
            projectile.ai[0] = 0;
}

else
{
    projectile.Kill();
}
return false;
}
}
}

Having Problems. Only bounces if I aim it directly at the ground
 
Having Problems. Only bounces if I aim it directly at the ground
Is ai[0] being used for other things? Is it being set in a shoot method? Did you write all the AI code, or is this based off something else? You might have to use a different approach if all the ai floats are already used by the ai. You could also just have the onhitnpc method kill the projectile and forget about ai[0].

Which version of tModLoader is compatible with Terraria 1.3.0.5?
None specifically, but from the changelogs, I don't think any new items were added since then. Just try it with the latest. Anyway....why don't you just upgrade? Bug fixes are good.
 
Which version of tModLoader is compatible with Terraria 1.3.0.5?
Looking through the version history, it looks like v0.1.1 is compatible with Terraria 1.3.0.5. I... really, really, really would not recommend using that version though. The only things that exist in that version are custom recipes and ModItem.SetDefaults. Like jopojelly said above, I'd recommend just using the latest versions for everything.
 
c:\Users\dinidini\Documents\My Games\Terraria\ModLoader\Mod Sources\ExampleMod v0.6\Mod Sources\DependentMod\Items\DependentModItem.cs (6,7): error CS0246: The type or namespace name 'BadUtils' was not found (lacking a 'using' Directive or assemblyreference?)

any idea as i been looking all over no videos on how to make a mod no info on what the dll file are for or where to put it all i did was move the ExampleMod v0.6 from the
Zip file over to mod sources and it gave me that error

if the ExampleMod does not work whats the point for it as i can download mods from the ingame menu but cant edit em as they are in tmod files no idea how to open them
so i get no info on how to make a mod from start
 
c:\Users\dinidini\Documents\My Games\Terraria\ModLoader\Mod Sources\ExampleMod v0.6\Mod Sources\DependentMod\Items\DependentModItem.cs (6,7): error CS0246: The type or namespace name 'BadUtils' was not found (lacking a 'using' Directive or assemblyreference?)

any idea as i been looking all over no videos on how to make a mod no info on what the dll file are for or where to put it all i did was move the ExampleMod v0.6 from the
Zip file over to mod sources and it gave me that error

if the ExampleMod does not work whats the point for it as i can download mods from the ingame menu but cant edit em as they are in tmod files no idea how to open them
so i get no info on how to make a mod from start
The point is that it works, you just did things wrong.
You're supposed to copy everything in the donwload's Mod Sources folder into your own Mod Sources folder, and everything in the download's dllReferences folder into your own dllReferences folder. Your own folders should be found inside the ModLoader folder, which is inside the Terraria folder.
 
The point is that it works, you just did things wrong.
You're supposed to copy everything in the donwload's Mod Sources folder into your own Mod Sources folder, and everything in the download's dllReferences folder into your own dllReferences folder. Your own folders should be found inside the ModLoader folder, which is inside the Terraria folder.

this is why its nice to get some video help on it or some text help to where these files are put
 
I'm gonna start simple with my mod so I'll make a throwing / slashing knife instead.
what references in VS should I add? (theres no terraria tmodloader)
EDIT:
is this part of code ok?
Code:
        public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit)
        {
            target.defense -= 8;
        }
I just wanted to -8 defense from total defense. (not accumulative)
EDIT: I build and reloaded the mod. I cant seem to craft it even with the necessary materials (Dirt Block) and tiles (Work Bench)
 
Last edited:
i been trying to read the drop file where it drops the exampleitem from all mobs but is there a way to change it to only drop at like a 10% chance and not 100% all the time
 
i been trying to read the drop file where it drops the exampleitem from all mobs but is there a way to change it to only drop at like a 10% chance and not 100% all the time
Yeah, you just have to do a check first. Something that looks a bit like this:
Code:
if(Main.rand.Next(0, 10) == 0)
{
    Item.NewItem(bladiebla); // The rest of your drop function.
}
This 'if' statement will take a random value ranging from 0 to 9 (I know it says 10, but that number is not taken into account) and checks it against 0. So this will have a 1 out of 10 change to return true, thus allowing the code inside the if statement to execute.
 
I am very annoyed by something that keeps happening to me. An error that says the system is out of memory as an exception happens every time I reload+build my mod for a second time while the program is open.
 
Yeah, you just have to do a check first. Something that looks a bit like this:
Code:
if(Main.rand.Next(0, 10) == 0)
{
    Item.NewItem(bladiebla); // The rest of your drop function.
}
This 'if' statement will take a random value ranging from 0 to 9 (I know it says 10, but that number is not taken into account) and checks it against 0. So this will have a 1 out of 10 change to return true, thus allowing the code inside the if statement to execute.

i found that code in one of the sample mobs but how do i add that with the code that was there to start with as without it the items drop from animals and bosses to
 
Back
Top Bottom