Destructionless Explosions?
#1
Hi, I'm a bit of a noob here, but I'm attempting to make a rocket jump plugin (Search TF2 rocketjump if you don't know what I mean). I have everything working perfectly, except the terrain being destroyed. Is there a way to create an explosion that still has significant knockback, but doesn't alter terrain? The only way i could think of doing this is spawning a primed TNT, reading the block type of a 3x3x3 cube around the TNT, setting that as water, then afterwards set those blocks back. Unfortunately, I found this to be incredibly unreliable and only works about 30% of the time. I would HIGHLY appreciate any suggestions.
Reply
Thanks given by:
#2
You can use the OnExploding hook to stop explosions. You just have to check if you're stopping the correct explosion.
Reply
Thanks given by: DiamondToaster
#3
The problem is that I want the explosion because they cause a large amount of player knockback. The player is able to throw snowballs and use them as "rockets" to hurt others or to propel himself in the air. I just can't find a way to make an explosion that still hurts the player and sends him flying, but Don't damage the terrain. I tried to use the OnExploding hook to restore that segment of the terrain but it turned out to be unreliable.
Reply
Thanks given by:
#4
Oh I forgot that the knockback would be gone as well. Sorry Wink.

You can use cPlayer:SetSpeed to make a player move somewhere. You could (if you want) use cWorld:BroadcastSoundEffect("random.explode", PosX, PosY, PosZ, 1, 1) to make the particles and explosion noise appear as well.
Reply
Thanks given by: DiamondToaster
#5
No problem. Tongue

That sounds like a pretty good idea. So what I would do is essentially create a speed vector using the Player position and the explosion site?
Reply
Thanks given by:
#6
I'd go about it that way as well - do not actually use explosions, but simulate them by setting the nearby players' speed and perhaps sending the particles. There is currently no way to stop an explosion from destructing terrain, other than removing the explosion altogether.
Reply
Thanks given by: DiamondToaster
#7
Ok, I'll do that and see how it turns out. Thanks for the replys. Smile
Reply
Thanks given by:
#8
No you could do it like this:
Player:SetSpeedY(5) -- 5 might not be a good number to use here. You probably have to play around with it for a bit.
local Pos = Player:GetPosition()
Player:GetWorld:BroadcastSoundEffect("random.explode", Pos.x, Pos.y, Pos.z, 1, 1)
Now the server says: "Jump 5 blocks up and create some particles + sounds", but the physics for players isn't properly handled for players yet. That's why you have to play around with the SetSpeedY parameter Smile
Reply
Thanks given by:
#9
Finally finished it, it turned out pretty good. Big Grin
I even got the particles and sounds to work. I might post it in Plugin Releases.
Reply
Thanks given by:




Users browsing this thread: 6 Guest(s)