AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Making C4 Explode Effects (https://forums.alliedmods.net/showthread.php?t=89839)

xPaw 04-11-2009 05:31

Making C4 Explode Effects
 
How to make own c4 explode effect, with sound sprite and etc...

ConnorMcLeod 04-11-2009 05:44

Re: Making C4 Explode Effects
 
1 Attachment(s)
c4 explosion logged :

xPaw 04-11-2009 06:09

Re: Making C4 Explode Effects
 
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



ConnorMcLeod 04-11-2009 06:24

Re: Making C4 Explode Effects
 
Your code calls 20 times a native :D

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.

Arkshine 04-11-2009 09:12

Re: Making C4 Explode Effects
 
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.

xPaw 04-11-2009 10:44

Re: Making C4 Explode Effects
 
isnt bomb using TE_EXPLOSION too ? i think you was mean this instead of TE_SPRITE

Arkshine 04-11-2009 10:48

Re: Making C4 Explode Effects
 
No. There is no TE_EXPLOSION.

xPaw 04-11-2009 10:50

Re: Making C4 Explode Effects
 
then i need additional sound for it oO

Arkshine 04-11-2009 10:53

Re: Making C4 Explode Effects
 
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 );

xPaw 04-11-2009 11:45

Re: Making C4 Explode Effects
 
Ok gonna try, i will not make TE_WORLDDECAL, since this exploded decal doesnt interest me ;)

Edit: about EngFunc_EmitAmbientSound, where i get 'Entity' if i'm just sending msgs?


All times are GMT -4. The time now is 02:16.

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