Raised This Month: $ Target: $400
 0% 

Making C4 Explode Effects


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 04-11-2009 , 05:31   Making C4 Explode Effects
Reply With Quote #1

How to make own c4 explode effect, with sound sprite and etc...
__________________
xPaw is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-11-2009 , 05:44   Re: Making C4 Explode Effects
Reply With Quote #2

c4 explosion logged :
Attached Files
File Type: log shptools_0411.log (56.8 KB, 293 views)
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Sn!ff3r
Veteran Member
Join Date: Aug 2007
Location: Poland
Old 04-11-2009 , 16:24   Re: Making C4 Explode Effects
Reply With Quote #3

Quote:
Originally Posted by ConnorMcLeod View Post
c4 explosion logged :
Wow. Can you give this plugin name?
__________________
Join US - custom Zombie Server - Custom Addons:



Sn!ff3r is offline
Send a message via Skype™ to Sn!ff3r
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 04-11-2009 , 06:09   Re: Making C4 Explode Effects
Reply With Quote #4

lol, so many messages are sent... the problem is i dont know names of sprites
I did something fast...
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <xs>

new gBoomSprite;

public 
plugin_init( ) {
    
register_plugin"lol""1.0""xPaw" );
    
    
register_clcmd"say /boom""cmdBoom" );
}

public 
plugin_precache( ) {
    
gBoomSprite precache_model"sprites/bexplo.spr" );
}

public 
cmdBoomid ) {
    new 
Float:vOrigin];
    
fm_get_aim_originidvOrigin );
    
    
message_beginMSG_BROADCASTSVC_TEMPENTITY );
    
write_byteTE_EXPLOSION );
    
write_coordfloatroundvOrigin[0] ) );
    
write_coordfloatroundvOrigin[1] ) );
    
write_coordfloatroundvOrigin[2] ) );
    
write_shortgBoomSprite );
    
write_byte30 );
    
write_byte15 );
    
write_byte);
    
message_end( );
}

stock fm_get_aim_origin(indexFloat:origin[3]) {
    new 
Float:start[3], Float:view_ofs[3]
    
pev(indexpev_originstart)
    
pev(indexpev_view_ofsview_ofs)
    
xs_vec_add(startview_ofsstart)

    new 
Float:dest[3]
    
pev(indexpev_v_angledest)
    
engfunc(EngFunc_MakeVectorsdest)
    
global_get(glb_v_forwarddest)
    
xs_vec_mul_scalar(dest9999.0dest)
    
xs_vec_add(startdestdest)

    
engfunc(EngFunc_TraceLinestartdest0index0)
    
get_tr2(0TR_vecEndPosorigin)

    return 
1

__________________
xPaw is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-11-2009 , 06:24   Re: Making C4 Explode Effects
Reply With Quote #5

Your code calls 20 times a native

This one calls 11 natives and does exactly the same (should be 2 times faster) :
PHP Code:
public cmdBoomid ) {
    new 
vOrigin];
    
get_user_originidvOrigin);
   
    
message_beginMSG_BROADCASTSVC_TEMPENTITY );
    
write_byteTE_EXPLOSION );
    
write_coordvOrigin[0] );
    
write_coordvOrigin[1] );
    
write_coordvOrigin[2] );
    
write_shortgBoomSprite );
    
write_byte30 );
    
write_byte15 );
    
write_byte);
    
message_end( );

You could hook FM_PrecacheModel post, and log sprites names, then when an explosion is triggered, and by hooking SVC_TEMPENTITY you can retrieve which sprite is used.
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 04-11-2009 at 06:27.
ConnorMcLeod is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-11-2009 , 09:12   Re: Making C4 Explode Effects
Reply With Quote #6

The provided log doesn't help really because it's not filtered. The log contains the explosion from entities near.

A C4 explosion uses :

- 4 TE_SPRITE ( There are 3 explosions, the first at the bomb origin ( sprites/eexplo.spr + sprites/zerogxplode.spr ), and the 2 others randomly around ( sprites/fexplo.spr ) )
- 1 TE_SMOKE ( Bomb origin ; sprites/steam1.spr ; 0.3 second after the explosion )
- 1 TE_WORLDDECAL ( Bomb end position origin ; decal used "{scorch1" or "{scorch2" you can use EngFunc_DecalEntity )
- Depending a random, severals TE_SPARKS or nothing.

So far I've observed it's like the grenade in HL but with some modifications. If you need it I can provide the code for the sparks it needs more code to show them.
Arkshine is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 04-11-2009 , 10:44   Re: Making C4 Explode Effects
Reply With Quote #7

isnt bomb using TE_EXPLOSION too ? i think you was mean this instead of TE_SPRITE
__________________
xPaw is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-11-2009 , 10:48   Re: Making C4 Explode Effects
Reply With Quote #8

No. There is no TE_EXPLOSION.
Arkshine is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 04-11-2009 , 10:50   Re: Making C4 Explode Effects
Reply With Quote #9

then i need additional sound for it oO
__________________
xPaw is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-11-2009 , 10:53   Re: Making C4 Explode Effects
Reply With Quote #10

weapons/c4_explode1.wav

Edit : It would be exactly : engfunc( EngFunc_EmitAmbientSound, Entity, Origin, "weapons/c4_explode1.wav", VOL_NORM, 0.25, 0, PITCH_NORM );

Last edited by Arkshine; 04-11-2009 at 11:06.
Arkshine 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 02:16.


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