AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Solved [L4D2]Shockwave? (https://forums.alliedmods.net/showthread.php?t=340505)

King_OXO 11-22-2022 14:05

[L4D2]Shockwave?
 
does anyone know how to create a shockwave?

like in this video:


i wanted to put in explosions and impacts of something

I was trying to create with CreateTimer but it turned out a little good


PHP Code:

float vPos[3], Pos[3];

blah blah blah //take the position of the entity

CreateTimer(GetVectorDistance(vPosPos)/5000.0ShockWaveentity); //the distance will be divided with some speed of sound or explosion (time = distance divided by speed <- this is in physics). 5000 is velocity mach 4. 

//Let's assume that the speed is mach 4(5000 km/h) and the distance is 1000 units(from the game, when we take a distance), this will give 0.2 seconds for the effect of the shock wave to affect the entity


Action ShockWave(Handle timerint entity)
{
//what will happen to the entity



Marttt 11-22-2022 14:16

Re: [L4D2]Shockwave?
 
I don't think the engine will handle like that. Physics are expensive.

Maybe you can do something with the explosion (env_explosion) or breaking a propane + Gravity Physics extension.

King_OXO 11-22-2022 14:35

Re: [L4D2]Shockwave?
 
Quote:

Originally Posted by Marttt (Post 2793459)
I don't think the engine will handle like that. Physics are expensive.

Maybe you can do something with the explosion (env_explosion) or breaking a propane + Gravity Physics extension.

the env_explosion does not have a shock wave, I already checked

King_OXO 11-22-2022 15:05

Re: [L4D2]Shockwave?
 
Quote:

Originally Posted by Marttt (Post 2793459)
I don't think the engine will handle like that. Physics are expensive.

Maybe you can do something with the explosion (env_explosion) or breaking a propane + Gravity Physics extension.

that's what i was talking about, look at the entities below the video. They are thrown back by the "shock wave"


Marttt 11-22-2022 16:46

Re: [L4D2]Shockwave?
 
So the video is from your utube channel,

Didn't you already accomplished that, or is some kind of private plugin that you don't have the source code.

King_OXO 11-22-2022 16:57

Re: [L4D2]Shockwave?
 
1 Attachment(s)
Quote:

Originally Posted by Marttt (Post 2793476)
So the video is from your utube channel,

Didn't you already accomplished that, or is some kind of private plugin that you don't have the source code.

I made the source code myself, I just wanted to improve the code I put in the main topic, like, create a real shock wave, i created with CreateTimer just divide the distance from the explosion or impact site by the speed of the shock wave (any value) and we have the time of the shock wave effect with the entity (like in the video when the cars are thrown backwards). The shock wave I'm talking about is the one that increases in width and distance (but has a range limit) and decreases the effect of chaos like in the main topic video

Skyy 12-02-2022 05:03

Re: [L4D2]Shockwave?
 
You can create a "shockwave" effect that can both knock players backwards, as well as give them a little bit (or a lot) of air, using the TeleportEntity method.
You'll need to get the origin point of both the blast point and the player in order to know which angles to push the player at. You can use m_vecOrigin for both players and non-player entities.

It's super easy stuff.


All times are GMT -4. The time now is 23:46.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.