AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Code Snippets/Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=83)
-   -   [HowTo] Detect fired particle creation/type/number/attack/obstacle/vector (https://forums.alliedmods.net/showthread.php?t=49395)

VEN 01-03-2007 00:54

[HowTo] Detect fired particle creation/type/number/attack/obstacle/vector
 
1 Attachment(s)
[Note: i recommend to use this method only for tests/research purpose because this method may produce some false positives when there are a big amount of lags.]

Most of a "shot/bullet/shell/fire/trace/particle/projectile/etc" plugin authors instead of fired particle trace vector is use player's aim vector. FYI: the angle difference between such vectors may reach even more than 30 degrees [!] because of the fired particle spreading/gun recoil. The correct method would be to perform a TraceLine hook, filter out fired particle trace and retrieve it's vector.

You have to note that some guns:
  • are powerful and it's bullet may sequentialy create 2nd and even 3nd trace for 1st and 2nd collision with the world/brush/entity/player obstacle
  • support burst-fire mode, so every attack action is performed a multiple shots with a little shots delay, every shot is spread a single bullet
  • support shotgun spread fire, so every attack action is performed a single shot that is spread a multiple particles
Let's review the script that will show how to:
  • filter out fired particle trace
  • distinguish a fired particle type: bullet or shotgun shot particle
  • calculate the current shotgun shot particle number for the current shot
  • detect whether the fired particle is hit a world/brush or entity/player
  • get the current actual vector of the fired particle

Shaman 07-17-2008 07:58

Re: [HowTo] Detect fired particle creation/type/number/attack/obstacle/vector
 
Great tutorial!


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

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