tModLoader Sin Costan's Collection of Fun Projectiles: Once Again

I don't know if I will be back to modding Terraria, but I have updated it for the latest tModLoader on the mod browser, I don't know if I will be updating the git or the zip file anytime soon.


Not really, the closest I've gotten to a lightning like projectile was a pretty crappy laser like projectile that just changed velocities at random to simulate "electricity".

thats actually pretty much what im looking for. Got any ideas on how to do it?
 
thats actually pretty much what im looking for. Got any ideas on how to do it?
Well, you should start off with your laser projectile with whatever dust type you want (you can find out how to make a laser using dust from within the files in the zip). Afterwards you would then add towards that AI adjusting the velocity of the projectile like "projectile.velocity" sort of like this:

Code:
projectile.velocity.X += 4;
// projectile.velocity.X is the variable to adjust the projectile's ability to go left or right, it's counterpart being y
// += is a fancier way of doing projectile.velocity.X = projectile.velocity.X + 4;

You would use if/else statements to make it do more than just go in one direction, probably use a timer to do this. Let's just say it does a random number between 3 and 7, something like this (note: I haven't done this for a while so it probably won't work).

Code:
int timer = 0;
int ranVelocity = Main.rand.Next(-6, 6);
//Somehow seperate the call of these and this next stuff

if(timer < 0) //just create a new random number to decrement if it reaches 0
{
    timer = Main.rand.Next(3, 7); //random number generator for timer
    if(ranVelocity > 0)
       ranVelocity = Main.rand.Next(-6, 0);
   else
       ranVelocity = Main.rand.Next(0, 6);
}
timer--; //decrements the timer

That's pretty much the crappy version of lightning like projectile I could manage...
 
Well, you should start off with your laser projectile with whatever dust type you want (you can find out how to make a laser using dust from within the files in the zip). Afterwards you would then add towards that AI adjusting the velocity of the projectile like "projectile.velocity" sort of like this:

Code:
projectile.velocity.X += 4;
// projectile.velocity.X is the variable to adjust the projectile's ability to go left or right, it's counterpart being y
// += is a fancier way of doing projectile.velocity.X = projectile.velocity.X + 4;

You would use if/else statements to make it do more than just go in one direction, probably use a timer to do this. Let's just say it does a random number between 3 and 7, something like this (note: I haven't done this for a while so it probably won't work).

Code:
int timer = 0;
int ranVelocity = Main.rand.Next(-6, 6);
//Somehow seperate the call of these and this next stuff

if(timer < 0) //just create a new random number to decrement if it reaches 0
{
    timer = Main.rand.Next(3, 7); //random number generator for timer
    if(ranVelocity > 0)
       ranVelocity = Main.rand.Next(-6, 0);
   else
       ranVelocity = Main.rand.Next(0, 6);
}
timer--; //decrements the timer

That's pretty much the crappy version of lightning like projectile I could manage...
Thanks a ton for that, Il try to get that working now
 
Hey can someone help me i try make a accessory that spawn a projectile when worn
Well it isn't too dificult depending on how you go about it, you can use my example of the Shadow Blood Veil accessory on my github.

https://github.com/Harrison-Jue/COFP

The files you want to look at are ShadowBloodVeil.cs in the items folder, ShadowBloodVeil.cs and it's other counterpart in the the projectiles folder, and MPlayer.cs in the main folder.
 
Thanks for help. I got one more question i used your tut how to shoot at a npc how to detect if there is collision of not with tiles
 
But if you still don't get what I am saying, this is what I mean:
I want my weapon to spawn the projectile wherever my cursor is. But how do I do that?
 
But if you still don't get what I am saying, this is what I mean:
I want my weapon to spawn the projectile wherever my cursor is. But how do I do that?
Oh, you can see that in my Rainbow Devastation Vortex projectile. Here is what the AI for the projectile looks like...

Code:
Vector2 vector14;
vector14.X = (float)Main.mouseX + Main.screenPosition.X;
if (p.gravDir == 1f)
{
   vector14.Y = (float)Main.mouseY + Main.screenPosition.Y - (float)p.height;
}
else
{
   vector14.Y = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY;
}
projectile.position = new Vector2(vector14.X - projectile.width/2, vector14.Y + projectile.height/2);

This should set the projectile's position to the cursor's position. So you can either use this code and set it up so the projectile spawns directly at the cursor or just have it spawn and then have the AI automatically move it to the cursor after 1 tick.
 
Oh, you can see that in my Rainbow Devastation Vortex projectile. Here is what the AI for the projectile looks like...

Code:
Vector2 vector14;
vector14.X = (float)Main.mouseX + Main.screenPosition.X;
if (p.gravDir == 1f)
{
   vector14.Y = (float)Main.mouseY + Main.screenPosition.Y - (float)p.height;
}
else
{
   vector14.Y = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY;
}
projectile.position = new Vector2(vector14.X - projectile.width/2, vector14.Y + projectile.height/2);

This should set the projectile's position to the cursor's position. So you can either use this code and set it up so the projectile spawns directly at the cursor or just have it spawn and then have the AI automatically move it to the cursor after 1 tick.
Question, if I want the projectile go cursor after 120 ticks or more?
 
Okay so i wanted your boss so i went to your github and copied the code but made my own sprite (I will edit it soon though like the names) but when I build and reloaded it
it said this:
c:\Users\Rowald\Documents\My Games\Terraria\ModLoader\Mod Sources\YourModName\NPCs\Boss\Berramyr.cs(209,5) : error CS0103: The name 'MMod' does not exist in the current context

c:\Users\Rowald\Documents\My Games\Terraria\ModLoader\Mod Sources\YourModName\NPCs\Boss\Berramyr.cs(218,7) : error CS1501: No overload for method 'Hurt' takes 2 arguments

c:\Users\Rowald\Documents\My Games\Terraria\ModLoader\Mod Sources\YourModName\NPCs\Boss\Fokmyl.cs(25,8) : error CS1061: 'Terraria.NPC' does not contain a definition for 'soundHit' and no extension method 'soundHit' accepting a first argument of type 'Terraria.NPC' could be found (are you missing a using directive or an assembly reference?)

c:\Users\Rowald\Documents\My Games\Terraria\ModLoader\Mod Sources\YourModName\NPCs\Boss\Fokmyl.cs(26,8) : error CS1061: 'Terraria.NPC' does not contain a definition for 'soundKilled' and no extension method 'soundKilled' accepting a first argument of type 'Terraria.NPC' could be found (are you missing a using directive or an assembly reference?)

c:\Users\Rowald\Documents\My Games\Terraria\ModLoader\Mod Sources\YourModName\NPCs\Boss\Fokmyl.cs(81,5) : error CS0103: The name 'MNPC' does not exist in the current context

c:\Users\Rowald\Documents\My Games\Terraria\ModLoader\Mod Sources\YourModName\NPCs\Boss\Lyndmyl.cs(25,8) : error CS1061: 'Terraria.NPC' does not contain a definition for 'soundHit' and no extension method 'soundHit' accepting a first argument of type 'Terraria.NPC' could be found (are you missing a using directive or an assembly reference?)

c:\Users\Rowald\Documents\My Games\Terraria\ModLoader\Mod Sources\YourModName\NPCs\Boss\Lyndmyl.cs(26,8) : error CS1061: 'Terraria.NPC' does not contain a definition for 'soundKilled' and no extension method 'soundKilled' accepting a first argument of type 'Terraria.NPC' could be found (are you missing a using directive or an assembly reference?)

c:\Users\Rowald\Documents\My Games\Terraria\ModLoader\Mod Sources\YourModName\NPCs\Boss\Lyndmyl.cs(127,5) : error CS0103: The name 'MNPC' does not exist in the current context

c:\Users\Rowald\Documents\My Games\Terraria\ModLoader\Mod Sources\YourModName\NPCs\Boss\Niremyl.cs(25,8) : error CS1061: 'Terraria.NPC' does not contain a definition for 'soundHit' and no extension method 'soundHit' accepting a first argument of type 'Terraria.NPC' could be found (are you missing a using directive or an assembly reference?)

c:\Users\Rowald\Documents\My Games\Terraria\ModLoader\Mod Sources\YourModName\NPCs\Boss\Niremyl.cs(26,8) : error CS1061: 'Terraria.NPC' does not contain a definition for 'soundKilled' and no extension method 'soundKilled' accepting a first argument of type 'Terraria.NPC' could be found (are you missing a using directive or an assembly reference?)

c:\Users\Rowald\Documents\My Games\Terraria\ModLoader\Mod Sources\YourModName\NPCs\Boss\Niremyl.cs(77,5) : error CS0103: The name 'MNPC' does not exist in the current context

c:\Users\Rowald\Documents\My Games\Terraria\ModLoader\Mod Sources\YourModName\NPCs\Boss\Veiynamyl.cs(25,8) : error CS1061: 'Terraria.NPC' does not contain a definition for 'soundHit' and no extension method 'soundHit' accepting a first argument of type 'Terraria.NPC' could be found (are you missing a using directive or an assembly reference?)

c:\Users\Rowald\Documents\My Games\Terraria\ModLoader\Mod Sources\YourModName\NPCs\Boss\Veiynamyl.cs(26,8) : error CS1061: 'Terraria.NPC' does not contain a definition for 'soundKilled' and no extension method 'soundKilled' accepting a first argument of type 'Terraria.NPC' could be found (are you missing a using directive or an assembly reference?)

c:\Users\Rowald\Documents\My Games\Terraria\ModLoader\Mod Sources\YourModName\NPCs\Boss\Veiynamyl.cs(61,6) : error CS0103: The name 'MNPC' does not exist in the current context

c:\Users\Rowald\Documents\My Games\Terraria\ModLoader\Mod Sources\YourModName\NPCs\Boss\Veiynamyl.cs(89,5) : error CS0103: The name 'MNPC' does not exist in the current context

i just literally copied the code but of coursed changed the directories but thats it. I edited nothing but the directory
 
Okay so i wanted your boss so i went to your github and copied the code but made my own sprite (I will edit it soon though like the names) but when I build and reloaded it
it said this:
c:\Users\Rowald\Documents\My Games\Terraria\ModLoader\Mod Sources\YourModName\NPCs\Boss\Berramyr.cs(209,5) : error CS0103: The name 'MMod' does not exist in the current context

c:\Users\Rowald\Documents\My Games\Terraria\ModLoader\Mod Sources\YourModName\NPCs\Boss\Berramyr.cs(218,7) : error CS1501: No overload for method 'Hurt' takes 2 arguments

c:\Users\Rowald\Documents\My Games\Terraria\ModLoader\Mod Sources\YourModName\NPCs\Boss\Fokmyl.cs(25,8) : error CS1061: 'Terraria.NPC' does not contain a definition for 'soundHit' and no extension method 'soundHit' accepting a first argument of type 'Terraria.NPC' could be found (are you missing a using directive or an assembly reference?)

c:\Users\Rowald\Documents\My Games\Terraria\ModLoader\Mod Sources\YourModName\NPCs\Boss\Fokmyl.cs(26,8) : error CS1061: 'Terraria.NPC' does not contain a definition for 'soundKilled' and no extension method 'soundKilled' accepting a first argument of type 'Terraria.NPC' could be found (are you missing a using directive or an assembly reference?)

c:\Users\Rowald\Documents\My Games\Terraria\ModLoader\Mod Sources\YourModName\NPCs\Boss\Fokmyl.cs(81,5) : error CS0103: The name 'MNPC' does not exist in the current context

c:\Users\Rowald\Documents\My Games\Terraria\ModLoader\Mod Sources\YourModName\NPCs\Boss\Lyndmyl.cs(25,8) : error CS1061: 'Terraria.NPC' does not contain a definition for 'soundHit' and no extension method 'soundHit' accepting a first argument of type 'Terraria.NPC' could be found (are you missing a using directive or an assembly reference?)

c:\Users\Rowald\Documents\My Games\Terraria\ModLoader\Mod Sources\YourModName\NPCs\Boss\Lyndmyl.cs(26,8) : error CS1061: 'Terraria.NPC' does not contain a definition for 'soundKilled' and no extension method 'soundKilled' accepting a first argument of type 'Terraria.NPC' could be found (are you missing a using directive or an assembly reference?)

c:\Users\Rowald\Documents\My Games\Terraria\ModLoader\Mod Sources\YourModName\NPCs\Boss\Lyndmyl.cs(127,5) : error CS0103: The name 'MNPC' does not exist in the current context

c:\Users\Rowald\Documents\My Games\Terraria\ModLoader\Mod Sources\YourModName\NPCs\Boss\Niremyl.cs(25,8) : error CS1061: 'Terraria.NPC' does not contain a definition for 'soundHit' and no extension method 'soundHit' accepting a first argument of type 'Terraria.NPC' could be found (are you missing a using directive or an assembly reference?)

c:\Users\Rowald\Documents\My Games\Terraria\ModLoader\Mod Sources\YourModName\NPCs\Boss\Niremyl.cs(26,8) : error CS1061: 'Terraria.NPC' does not contain a definition for 'soundKilled' and no extension method 'soundKilled' accepting a first argument of type 'Terraria.NPC' could be found (are you missing a using directive or an assembly reference?)

c:\Users\Rowald\Documents\My Games\Terraria\ModLoader\Mod Sources\YourModName\NPCs\Boss\Niremyl.cs(77,5) : error CS0103: The name 'MNPC' does not exist in the current context

c:\Users\Rowald\Documents\My Games\Terraria\ModLoader\Mod Sources\YourModName\NPCs\Boss\Veiynamyl.cs(25,8) : error CS1061: 'Terraria.NPC' does not contain a definition for 'soundHit' and no extension method 'soundHit' accepting a first argument of type 'Terraria.NPC' could be found (are you missing a using directive or an assembly reference?)

c:\Users\Rowald\Documents\My Games\Terraria\ModLoader\Mod Sources\YourModName\NPCs\Boss\Veiynamyl.cs(26,8) : error CS1061: 'Terraria.NPC' does not contain a definition for 'soundKilled' and no extension method 'soundKilled' accepting a first argument of type 'Terraria.NPC' could be found (are you missing a using directive or an assembly reference?)

c:\Users\Rowald\Documents\My Games\Terraria\ModLoader\Mod Sources\YourModName\NPCs\Boss\Veiynamyl.cs(61,6) : error CS0103: The name 'MNPC' does not exist in the current context

c:\Users\Rowald\Documents\My Games\Terraria\ModLoader\Mod Sources\YourModName\NPCs\Boss\Veiynamyl.cs(89,5) : error CS0103: The name 'MNPC' does not exist in the current context

i just literally copied the code but of coursed changed the directories but thats it. I edited nothing but the directory
Huh, I thought I updated the code in Github already, apparently I forgot to sync changes, should be synced now.
 
Back
Top Bottom