Raised This Month: $12 Target: $400
 3% 

Reproducing Source engine realistic fire effects on model


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 10-23-2019 , 19:28   Reproducing Source engine realistic fire effects on model
Reply With Quote #1

Have the following code for testing. Idea is to generate random origin within a player's AbsBox and then trace towards the player origin horizontally until a hitbox is detected then send a sprite message there.

The problem is you I can't find a proper message to use with a transparent(additive) sprite and that would also have velocity parameters.
Currently tried TE_SMOKE and TE_PROJECTILE but both of them use IndexAlpha sprites which have only greyscale color support.
Also tried TE_EXPLOSION but 8 units per second vertical velocity is just too low to look anywhere close to realistic.

Video demonstration with TE_SMOKE messages:


PHP Code:
#include <amxmodx>
#include <engine>
#include <fakemeta>

//#include <cs_ham_bots_api>

#include <amxmisc>
#include <D7Debug>



new const g_szSprites[][] =
{
/*
    "sprites/aexplo.spr",
    "sprites/bexplo.spr",
    "sprites/richo2.spr",
    "sprites/xfire.spr",
//    "sprites/xfire2.spr",
    "sprites/xfireball3.spr",
//    "sprites/xflare2.spr"*/
    
"sprites/black_smoke1.spr",
    
"sprites/black_smoke2.spr",
    
"sprites/black_smoke3.spr",
    
"sprites/black_smoke4.spr"
    
//"sprites/3dmflaora.spr"
    //"sprites/D7FireHighFadeInOutAdditive1.spr"
    //"sprites/D7FireHighFadeInOutIndexAlpha1.spr"
}

new 
g_iIDSpriteDotg_iIDsSprites[sizeof g_szSprites], g_iCountSpritesFrames[sizeof g_szSprites];

new 
g_iMaxPlayersg_bBurn[33];

public 
plugin_precache()
{
    for (new 
iIDiID sizeof g_szSpritesiID++)
    {
        
g_iIDsSprites[iID] = precache_model(g_szSprites[iID]);
        
g_iCountSpritesFrames[iID] = engfunc(EngFunc_ModelFramesg_iIDsSprites[iID]);
    }
    
    
g_iIDSpriteDot precache_model("sprites/dot.spr");
}

public 
plugin_init()
{
    
register_plugin("D7 Test sprite trace to model""0.1.2""D7")
    
    
register_clcmd("say""fwClCmdSayPre")
    
    
g_iMaxPlayers get_maxplayers();
}

public 
fwClCmdSayPre(const iID)
{
    static 
szArg[192], szArg1[15], szArg2[31];
    
read_args(szArgcharsmax(szArg))
    
    
trim(szArg)
    
remove_quotes(szArg)
    
    
szArg1 "";
    
szArg2 "";
    
    
parse(szArgszArg1charsmax(szArg1), szArg2charsmax(szArg2))
    
    if (!
equali(szArg1"/fm"))
        return;
    
    new 
iID2;
    
    if (
szArg2[0])
    {
        if (
equali(szArg2"*"))
            
iID2 = -1;
        else
            
iID2 cmd_target(iID2szArg2CMDTARGET_ALLOW_SELF);
    }
    
    if (
iID2 >= 0)
    {
        if (!
iID2)
            
iID2 iID;
        
        if (!
g_bBurn[iID2])
        {
            
g_bBurn[iID2] = 1;
        }
        else
        {
            
g_bBurn[iID2] = 0;
        }
    }
    else
    {
        for (
iID2 1iID2 <= g_iMaxPlayersiID2++)
        {
            if (!
g_bBurn[iID2])
            {
                
g_bBurn[iID2] = 1;
            }
            else
            {
                
g_bBurn[iID2] = 0;
            }
        }
    }
}

public 
client_PreThink(iID)
{
    
//static const Float:fVecSizeHullStandMins[3] = { -16.0, -16.0, -36.0 };
    //static const Float:fVecSizeHullStandMaxs[3] = { 16.0, 16.0, 36.0 };
    //static const Float:fVecViewOffsetStand[3] = { 0.0, 0.0, 17.0 };
    //static const Float:fVecSizeHullDuckMins[3] = { -16.0, -16.0, -18.0 };
    //static const Float:fVecSizeHullDuckMaxs[3] = { 16.0, 16.0, 32.0 };
    //static const Float:fVecViewOffsetDuck[3] = { 0.0, 0.0, 12.0 };
    
    
if (!is_user_alive(iID) || !g_bBurn[iID])
        return;
    
    new 
Float:fTimeGame get_gametime();
    
    static 
Float:fTimeLastBurn[33];
    
    if (
fTimeGame fTimeLastBurn[iID] < random_float(0.030.05))
        return;
    
    
fTimeLastBurn[iID] = fTimeGame;
    
    new 
Float:fVecOrigin[3], Float:fVecTemp[3], Float:fVecOriginSprite[3];
    
    
pev(iIDpev_originfVecOrigin)
    
    new 
bDucking = (pev(iIDpev_flags) & FL_DUCKING);
    new 
iIDTrace// = create_tr2();
    
    
LabelTraceStart:
    
    
fVecTemp fVecOrigin;
    
    if (!
bDucking)
    {
        
fVecTemp[0] += random_float(-16.016.0);//(random_num(0, 1) ? -16.0 : 16.0)
        
fVecTemp[1] += random_float(-16.016.0);//(random_num(0, 1) ? -16.0 : 16.0)
        
fVecTemp[2] += random_float(-36.018.0);
    }
    else
    {
        
fVecTemp[0] += random_float(-16.016.0);//(random_num(0, 1) ? -16.0 : 16.0)
        
fVecTemp[1] += random_float(-16.016.0);//(random_num(0, 1) ? -16.0 : 16.0)
        
fVecTemp[2] += random_float(-18.020.0);
    }
    
    
fVecOriginSprite fVecOrigin;
    
fVecOriginSprite[2] = fVecTemp[2];
    
    
iIDTrace trace_line(g_iMaxPlayers 1fVecTempfVecOriginSpritefVecOriginSprite);
    
    if (
pev_valid(iIDTrace))
    {
        new 
szClassName[32];
        
pev(iIDTracepev_classnameszClassNamecharsmax(szClassName))
        
set_hudmessage(25512800.05, -1.000.01.50.00.54);
        
ftD7Log("f"iID"[client_PreThink] HitID: %d. Owner: %d. ClassName: ^"%s^"."iIDTracepev(iIDTracepev_owner), szClassName)
    }
    else
    {
        
set_hudmessage(25512800.05, -1.000.01.50.00.54);
        
ftD7Log("f"iID"[client_PreThink] HitID: %d."iIDTrace)
        
//goto LabelTraceStart;
    
}
    
//engfunc(EngFunc_TraceLine, fVecTemp, fVecOriginSprite, DONT_IGNORE_MONSTERS, g_iMaxPlayers + 1, iIDTrace)// | IGNORE_MISSILE | IGNORE_GLASS
    
    //get_tr2(iIDTrace, TR_vecEndPos, fVecOriginSprite)
    
    
if (get_distance_f(fVecTempfVecOriginSprite) >= 72)
    {
        
ftD7Log(__"[client_PreThink] iID: %d. Trace distance is bigger than 72(missed the player)."iID)
        goto 
LabelTraceStart;
    }
    
    if (
fVecTemp[0] == fVecOriginSprite[0] && fVecTemp[1] == fVecOriginSprite[1] && fVecTemp[2] == fVecOriginSprite[2])
    {
        
ftD7Log(__"[client_PreThink] iID: %d. Trace start and end origins are the same(inside the player model)."iID)
        goto 
LabelTraceStart;
    }
    
    
//free_tr2(iIDTrace);
    
    
engfunc(EngFunc_MessageBeginMSG_PASSVC_TEMPENTITYfVecOrigin0)
    
//engfunc(EngFunc_MessageBegin, MSG_BROADCAST, SVC_TEMPENTITY, fVecOrigin, 0)
    
write_byte(TE_BEAMPOINTS);
    
engfunc(EngFunc_WriteCoordfVecTemp[0]) // x
    
engfunc(EngFunc_WriteCoordfVecTemp[1]) // y
    
engfunc(EngFunc_WriteCoordfVecTemp[2]) // z
    
engfunc(EngFunc_WriteCoordfVecOriginSprite[0]) // x
    
engfunc(EngFunc_WriteCoordfVecOriginSprite[1]) // y
    
engfunc(EngFunc_WriteCoordfVecOriginSprite[2]) // z
    
write_short(g_iIDSpriteDot);
    
write_byte(1);    // framestart 
    
write_byte(1);    // framerate 
    
write_byte(1);    // life in 0.1's 
    
write_byte(2);    // width
    
write_byte(0);    // noise 
    
write_byte(255);    // r, g, b 
    
write_byte(128);    // r, g, b 
    
write_byte(0);    // r, g, b 
    
write_byte(200);    // brightness 
    
write_byte(0);    // speed 
    
message_end();
    
    
iIDTrace random_num(0sizeof g_szSprites 1);
    
    
// if Z origin is lower than X, subsctract some more.
    
    // Smoke sprite
    
engfunc(EngFunc_MessageBeginMSG_PASSVC_TEMPENTITYfVecOrigin0)
    
write_byte(TE_SMOKE// TE id
    
engfunc(EngFunc_WriteCoordfVecOriginSprite[0]) // x
    
engfunc(EngFunc_WriteCoordfVecOriginSprite[1]) // y
    
engfunc(EngFunc_WriteCoordfVecOriginSprite[2]) // z
    
write_short(g_iIDsSprites[iIDTrace]) // sprite
    
write_byte(random_num(13)) // scale
    
write_byte(random_num(g_iCountSpritesFrames[iIDTrace] * 2floatround(g_iCountSpritesFrames[iIDTrace] * 1.5floatround_floor))) // framerate
    
message_end()
/*    
    engfunc(EngFunc_MessageBegin, MSG_PAS, SVC_TEMPENTITY, fVecOrigin, 0)
    write_byte(TE_PROJECTILE)
    engfunc(EngFunc_WriteCoord, fVecOriginSprite[0]) // x
    engfunc(EngFunc_WriteCoord, fVecOriginSprite[1]) // y
    engfunc(EngFunc_WriteCoord, fVecOriginSprite[2]) // z
    engfunc(EngFunc_WriteCoord, 0.0) // x
    engfunc(EngFunc_WriteCoord, 0.0) // y
    engfunc(EngFunc_WriteCoord, 30.0) // z
    write_short(g_iIDsSprites[iIDTrace])
    write_byte(g_iCountSpritesFrames[iIDTrace] / 10)
    write_byte(iID) //projectile won't collide with owner (if owner == 0, projectile will hit any client).
    message_end()*/
    
    //set_task(random_float(0.1, 0.1), "client_PreThink", iID)
}
/*
#define    TE_SMOKE                    5        // Alphablend sprite, move vertically 30 pps
// write_byte(TE_SMOKE)
// write_coord(position.x)
// write_coord(position.y)
// write_coord(position.z) 
// write_short(sprite index)
// write_byte(scale in 0.1's)
// write_byte(framerate)

#define    TE_EXPLOSION                3        // Additive sprite, 2 dynamic lights, flickering particles, explosion sound, move vertically 8 pps
// write_byte(TE_EXPLOSION)
// write_coord(position.x)
// write_coord(position.y)
// write_coord(position.z)
// write_short(sprite index)
// write_byte(scale in 0.1's)
// write_byte(framerate)
// write_byte(flags)
//
// The Explosion effect has some flags to control performance/aesthetic features:
#define TE_EXPLFLAG_NONE            0        // All flags clear makes default Half-Life explosion
#define TE_EXPLFLAG_NOADDITIVE      1        // Sprite will be drawn opaque (ensure that the sprite you send is a non-additive sprite)
#define TE_EXPLFLAG_NODLIGHTS       2        // Do not render dynamic lights
#define TE_EXPLFLAG_NOSOUND         4        // Do not play client explosion sound
#define TE_EXPLFLAG_NOPARTICLES     8        // Do not draw particles

#define TE_PROJECTILE               119      // Makes a projectile (like a nail) (this is a high-priority tent)
// write_byte(TE_PROJECTILE)
// write_coord(position.x)
// write_coord(position.y)
// write_coord(position.z)
// write_coord(velocity.x)
// write_coord(velocity.y)
// write_coord(velocity.z)
// write_short(modelindex)
// write_byte(life)
// write_byte(owner)  projectile won't collide with owner (if owner == 0, projectile will hit any client).
*/ 
Attached Files
File Type: inc D7Debug.inc (2.9 KB, 122 views)
File Type: sma Get Plugin or Get Source (D7TestSpriteTraceToModel.sma - 168 views - 8.5 KB)
__________________

Last edited by georgik57; 02-18-2020 at 03:47.
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
Old 11-07-2019, 15:35
georgik57
This message has been deleted by georgik57.
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 02-18-2020 , 03:47   Re: Reproducing Source engine realistic fire effects on model
Reply With Quote #2

up
__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 02-18-2020 , 23:54   Re: Reproducing Source engine realistic fire effects on model
Reply With Quote #3

TE_SPRITE
__________________
DJEarthQuake is offline
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 02-19-2020 , 08:38   Re: Reproducing Source engine realistic fire effects on model
Reply With Quote #4

Doesn't have velocity
__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 02-19-2020 , 11:29   Re: Reproducing Source engine realistic fire effects on model
Reply With Quote #5

The old saying where there is smoke there must be fire.

That video only has the smoke. It takes blending of many particles or a Source grade animated sprite to take the work off the engine and programmer.

Take a look at the flame thrower mods. Smoke is just one of the many particles. It is not orange.
Quote:
which have only greyscale color support.
This is the orange. The way we work around it.
sprites/zerogxplode.spr
__________________

Last edited by DJEarthQuake; 02-19-2020 at 11:29.
DJEarthQuake is offline
Abhinash
Senior Member
Join Date: Jan 2015
Location: India,kolkata
Old 02-23-2020 , 02:59   Re: Reproducing Source engine realistic fire effects on model
Reply With Quote #6

Quote:
Originally Posted by DJEarthQuake View Post
The old saying where there is smoke there must be fire.

That video only has the smoke. It takes blending of many particles or a Source grade animated sprite to take the work off the engine and programmer.

Take a look at the flame thrower mods. Smoke is just one of the many particles. It is not orange.


This is the orange. The way we work around it.
sprites/zerogxplode.spr
Can you provide me link for the Flame thrower mod ?
Abhinash is offline
Reply


Thread Tools
Display Modes

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 16:06.


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