tModLoader [TUTORIAL] Shockwave effect for tModLoader

I copied your code after many attempts without success, but it still didn't work.
I build it like this
Filters.Scene["Effect"] = new Filter(new ScreenShaderData(new Ref<Effect>(GetEffect("Effects/Effect")), "passName"), EffectPriority.High);
Use it like this
player.ManageSpecialBiomeVisuals("Effect", true, player.Center);
Because I want player to make shockwave.
ManageSpecialBiomeVisuals will not actually do anything; at best, it will simply activate the filter, but without updating it, you won't see anything. You can use ModPlayer.UpdateBiomeVisuals, but you should update the filter like I do in my examples.
 
Hello, thanks for the tutorial!

Quick question, why is the visual not appearing for me? The mod loaded properly but in game nothing happens.

I'm on single player. I made it so an npc will spawn a projectile when it dies. In the projectile, I placed your code in override void AI. I also tried making a weapon shoot the projectile but it still doesn't show up.
 
Is the party bomb from a specific mod or just a example? Thanks! this effect is what I've been trying to figure out for forever.
 
This was a huge help! It worked perfectly... except that it doesn't do anything and no shockwave appears. I do see that others have this same problem so I don't see that I could have messed up the coding in some way.
 
People may be having issues from "PI" in the original code, as this doesn't work as PI so it needs to be replaced with "3.14159265f"
 
People may be having issues from "PI" in the original code, as this doesn't work as PI so it needs to be replaced with "3.14159265f"
Actually I wasn't using that one. The second one isn't working at all. I noticed in the Example Mod effects folder, there was a .fx file along with each effect
 
Is there a link where I could download the un-compiled FX file for this (not just the code snippet on the start)? I'm currently figuring out screen shaders and think this shader would be a good code reference for that
 
Last edited:
If I understood correctly, after the explosion of the main bomb, a new transparent projectile is created, from which a wave is already emanating or ...
No, the bomb actually stays 'alive' for three seconds after it explodes, and is responsible for propagating the wave.
 
No, the bomb actually stays 'alive' for three seconds after it explodes, and is responsible for propagating the wave.
That is, there is a bomb explosion, it inflicted, say, damage and still remains "alive" until the end of the wave propagation and does not cause damage upon contact?
 
Hey, it's aweguy from a couple of days ago in discord. Welp i have the same problem as most people here. Everything has no errors except it doesn't work. I even logged the code to see if it's running and it does. Still didn't work. Here's the update code along with the load code in my mod class. I am using it on a projectile that doesn't really explode. It happens some frames after it appears but doesn't die there as you will see in the code. Thanks in advance. My problem is that it just doesn't appear. hastebin
My kill code is just the same as in your example. Nothing different there.

PS: I managed to make it work by using cheaty ways. Also i found a small mistake in your code that may confuse people if they are looking at the whole projectile code.

public override void Kill(int timeLeft)
{
if (Main.netMode != NetmodeID.Server && Filters.Scene["Shockwave'].IsActive()) //Here there is a wrong symbol. You may have missed it. It should be "Shockwave"
{
Filters.Scene["Shockwave"].Deactivate();
}
}
 
Last edited:
Hey, it's aweguy from a couple of days ago in discord. Welp i have the same problem as most people here. Everything has no errors except it doesn't work. I even logged the code to see if it's running and it does. Still didn't work. Here's the update code along with the load code in my mod class. I am using it on a projectile that doesn't really explode. It happens some frames after it appears but doesn't die there as you will see in the code. Thanks in advance. My problem is that it just doesn't appear. hastebin
My kill code is just the same as in your example. Nothing different there.

PS: I managed to make it work by using cheaty ways. Also i found a small mistake in your code that may confuse people if they are looking at the whole projectile code.

public override void Kill(int timeLeft)
{
if (Main.netMode != NetmodeID.Server && Filters.Scene["Shockwave'].IsActive()) //Here there is a wrong symbol. You may have missed it. It should be "Shockwave"
{
Filters.Scene["Shockwave"].Deactivate();
}
}
Oh, whoops! Should've spotted that. :D

Out of curiosity, what did you have to do to make it work?
 
Oops, i should've checked the posts earlier. Anyway, i made a projectile that spawns at the center of the projectile i initially wanted it to work the moment i wanted. Idk why it wasn't working in the first place, but now it's perfect but it's very cheaty. Will have to deal with the problems this comes with later i guess :D
Now i have a new little frustration, i cannot seem to be able to make it follow an object (npc or projectile) because i am not sure how to update the target position. That's for another thing. Thanks for the reply.

Edit1: i am still messing with the code, will defo send it to you once i am fully frustrated

Edit2: I got fully frustrated. I tried everything i could think of. Cannot get it to follow my npc or get the correct radius (although this is more like a trial and error. Here's my code as of now. Thank you in advance :D hastebin (this is not my whole npc's code, it's just the shader code. The Shader killing method is in CheckDead since i wanna end it when the npc dies and it works as i want it to work.)
 
Last edited:
Oops, i should've checked the posts earlier. Anyway, i made a projectile that spawns at the center of the projectile i initially wanted it to work the moment i wanted. Idk why it wasn't working in the first place, but now it's perfect but it's very cheaty. Will have to deal with the problems this comes with later i guess :D
Now i have a new little frustration, i cannot seem to be able to make it follow an object (npc or projectile) because i am not sure how to update the target position. That's for another thing. Thanks for the reply.

Edit1: i am still messing with the code, will defo send it to you once i am fully frustrated

Edit2: I got fully frustrated. I tried everything i could think of. Cannot get it to follow my npc or get the correct radius (although this is more like a trial and error. Here's my code as of now. Thank you in advance :D hastebin (this is not my whole npc's code, it's just the shader code. The Shader killing method is in CheckDead since i wanna end it when the npc dies and it works as i want it to work.)
You should call UseTargetPosition(npc.Center) in your update call, that should do the trick. ;)

As for the size, yeah, that's probably trial and error. I would try starting with a progress value of 0.1 and slowly increasing it.
 
Aaaah, that was what UseTargetPosition was for. Didn't use it because i thought i would break stuff. Thanks a lot kazzy. Really appreiciate it :D

Edit1: Thanks a lot, it works perfectly. Now time to dive deep into trial and error. Hopefully it won't take hours for this to happen :D

Edit2: Found the correct range through trial and error. Thanks a lot for the help. Cheers <3
 
Last edited:
I've tried this in tried this in tModLoader 1.4 alpha, and it doesn't seem to work.
GetEffect() gives me an error that it does not exist.
Is there anyway I can fix it?
 
Back
Top Bottom