Raised This Month: $ Target: $400
 0% 

Bomb Explosion Simulation


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viņa del Mar, Chile
Old 01-15-2011 , 18:56   Re: Bomb Explosion Simulation
Reply With Quote #1

Quote:
Originally Posted by Arkshine View Post
You don't really need Orpheu because you can still rewrite all the functions manually, but it's idiot. You should execute the internal CS function when you can so the code will be more efficient. I don't care about bazooka, he wants the same effect as the C4 explosion. Anyway the effect is simple, it's 4 TE_SPRITE. Will post later.
That will be really nice. I was searching for the C4 Explode effects too
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 01-15-2011 , 19:31   Re: Bomb Explosion Simulation
Reply With Quote #2

With orpheu, something like. Test plugin.

Code:
#include <amxmodx> #include <orpheu> #include <fakemeta> #include <engine> public plugin_init() {     register_clcmd( "say /test", "ClientCommand_Test" ); }   public ClientCommand_Test( const client ) {     // set_pev( client, pev_takedamage, DAMAGE_NO );     new origin[ 3 ];     new Float:origin_f[ 3 ];         get_user_origin( client, origin, 3 );     IVecFVec( origin, origin_f );     new grenade = create_entity( "grenade" );     set_pev( grenade, pev_origin, origin_f );     ExplodeC4( grenade ); } ExplodeC4( const grenade ) {     static OrpheuFunction:handleFuncDetonate2;     if( handleFuncDetonate2 || ( handleFuncDetonate2 = OrpheuGetFunction( "Detonate2", "CGrenade" ) ) )     {         OrpheuCall( handleFuncDetonate2, grenade );     } }

Signature in a file named Detonate2 and put it in orpheu/functions/CGrenade/

Code:
{     "name"       : "Detonate2",     "class"      : "CGrenade",     "library"    : "mod",     "identifiers":     [         {             "os"    : "windows",             "mod"   : "cstrike",             "value" : "?Detonate2@CGrenade@@QAEXXZ"         },         {             "os"    : "linux",             "mod"   : "cstrike",             "value" : "Detonate2__8CGrenade"         }     ] }

I don't remember exactly why I've started a manual version instead of calling directly Detonate2. Maybe to be able to customize ? Or because it triggers the round ends on de_ maps ? :p

Anyway, I don't think I will work on it unless someone begs me :p, so here basically how works the C4 explosion :

Code:
// spriteIndexFExplo -> "sprites/fexplo.spr" // spriteIndexEExplo -> "sprites/eexplo.spr" // spriteIndexZerogxplode -> "sprites/zerogxplode.spr" FX_ScreenShake (     .center    = origin,     .amplitude = 25.0,     .frequency = 150.0,     .duration  = 1.0,     .radius    = 3000.0 ); emit_sound( entity, CHAN_WEAPON, "weapons/c4_explode1.wav", VOL_NORM, 0.25, 0, PITCH_NORM ); for ( new i = 0, spriteIndex, scale, brightness; i < 4; i++ ) {     switch ( i )     {         case 0 :         {             origin[ z ] -= 10.0;             spriteIndex = spriteIndexFExplo;             scale       = -105; // ( 100 - 275.0 ) * 0.6             brightness  = 150;         }         case 1 :         {             spriteIndex = spriteIndexEExplo;             scale       = -105;             brightness  = 150;         }         case 2 :         {             spriteIndex = spriteIndexFExplo;             scale       = -105;             brightness  = 150;         }         case 3 :         {             spriteIndex = spriteIndexZerogxplode;             scale       = -105;             brightness  = 17;         }     }     if ( i )     {         origin[ x ] += random_float( -512.0, 512.0 );         origin[ y ] += random_float( -512.0, 512.0 );         origin[ z ] += random_float( -10.0 , 10.0  );     }     FX_Sprite( origin[ x ], origin[ y ], origin[ z ], spriteIndex, scale, brightness ); } FX_DecalTrace( pTrace, DECAL_SCORCH1 ); switch ( random_num( 0, 2 ) ) {     case 0 : emit_sound( entity, CHAN_VOICE, "weapons/debris1.wav", 0.55, ATTN_NORM, 0, PITCH_NORM );     case 1 : emit_sound( entity, CHAN_VOICE, "weapons/debris2.wav", 0.55, ATTN_NORM, 0, PITCH_NORM );     case 2 : emit_sound( entity, CHAN_VOICE, "weapons/debris3.wav", 0.55, ATTN_NORM, 0, PITCH_NORM ); } pev( entity, pev_origin, origin ); RadiusDamage( origin, entity, entity, 500.0, 0, DMG_BLAST ); set_pev( entity, pev_nextthink, get_gametime() + 0.85 ); if ( engfunc( EngFunc_PointContents, origin ) != CONTENTS_WATER ) {     new rand = random_num( 0, 3 );     for ( new i = 0, spark; i < rand; i++ )     {         spark = create_entity( "spark_shower" );         set_pev( spark, pev_origin, origin );         DispatchSpawn( spark );     } } // The smoke is missing but it's basically the same as a CGrenade::Smoke(), the 2 last paralms : 150, 8 // FX_ScreenShake = UTIL_ScreenShake -> See HLSDK // FX_DecalTrace = UTIL_DecalTrace -> See HLSDK //
Attached Files
File Type: sma Get Plugin or Get Source (test_explodec4.sma - 306 views - 796 Bytes)
File Type: zip signature_detonate2.zip (464 Bytes, 60 views)
__________________

Last edited by Arkshine; 01-16-2011 at 06:28.
Arkshine is offline
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viņa del Mar, Chile
Old 01-15-2011 , 19:55   Re: Bomb Explosion Simulation
Reply With Quote #3

Oooh! That's why no DeathMsg appear when you've been killed with the DMG_BLAST bit. The C4 uses that bit and that's the reason of why no death msg appears, it's special for a C4 bomb
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 01-16-2011 , 05:58   Re: Bomb Explosion Simulation
Reply With Quote #4

Oops, forgot to provide the signature for Detonate2.
__________________
Arkshine is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 01-16-2011 , 06:25   Re: Bomb Explosion Simulation
Reply With Quote #5

Wow nice, just tested, seems that the damage part doesn't work at all. Otherwise, explosion sprites, text msg, round end for the terrorists win part works perfectly.
bibu is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 01-16-2011 , 06:28   Re: Bomb Explosion Simulation
Reply With Quote #6

Damage is not removed. It's on purpose, to test, I've added this line : set_pev( client, pev_takedamage, DAMAGE_NO ); You can remove it.
__________________
Arkshine is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 01-16-2011 , 06:45   Re: Bomb Explosion Simulation
Reply With Quote #7

Oh now I see. But then it does currently hurt me but not the func_breakables actually.
bibu is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:25.


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