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

Replacing sprite on model


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MayroN
Senior Member
Join Date: Aug 2017
Location: Kyiv
Old 05-22-2018 , 12:41   Replacing sprite on model
Reply With Quote #1

Actually how to replace the sprite on your model ( .mdl).
Piece of code.When you hover over the player's sight, shows here is a sprite (ult night Elves )

It works from here.
PHP Code:
public NE_ULT_EntangleEffectid )
{

    
// Get the user's origin
    
new vOrigin[3];
    
get_user_originidvOrigin );
    
    
// Play the entangle sound
    
emit_soundidCHAN_STATICg_szSounds[SOUND_ENTANGLING], 1.0ATTN_NORM0PITCH_NORM );

    new 
iStart[3], iEnd[3], iHeight;
    new 
iRadius    20iCounter 0;
    new 
x1y1x2y2;

    
// Some sweet crap that I don't understand courtesy of SpaceDude - draws the "cylinder" around the player
    
while ( iCounter <= )
    {
        if ( 
iCounter == || iCounter == )
            
x1 = -iRadius;
        else if ( 
iCounter == || iCounter == )
            
x1 = -iRadius 100/141;
        else if ( 
iCounter == || iCounter == )
            
x1 0;
        else if ( 
iCounter == || iCounter == )
            
x1 iRadius*100/141
        
else if ( iCounter == )
            
x1 iRadius

        
if ( iCounter <= )
            
y1 sqrootiRadius*iRadius-x1*x1 );
        else
            
y1 = -sqrootiRadius*iRadius-x1*x1 );

        ++
iCounter;

        if ( 
iCounter == || iCounter == )
            
x2 = -iRadius;
        else if ( 
iCounter == || iCounter==)
            
x2 = -iRadius*100/141;
        else if ( 
iCounter == || iCounter==)
            
x2 0;
        else if ( 
iCounter == || iCounter==)
            
x2 iRadius*100/141;
        else if ( 
iCounter == )
            
x2 iRadius;
        
        if ( 
iCounter <= )
            
y2 sqrootiRadius*iRadius-x2*x2 );
        else
            
y2 = -sqrootiRadius*iRadius-x2*x2 );

        
iHeight 16 iCounter;

        while ( 
iHeight > -40 )
        {
            
            
iStart[0]    = vOrigin[0] + x1;
            
iStart[1]    = vOrigin[1] + y1;
            
iStart[2]    = vOrigin[2] + iHeight;
            
iEnd[0]        = vOrigin[0] + x2;
            
iEnd[1]        = vOrigin[1] + y2;
            
iEnd[2]        = vOrigin[2] + iHeight 2;
            
            
Create_TE_BEAMPOINTSiStartiEndg_iSprites[SPR_BEAM], 00, ( floatroundENTANGLE_TIME ) * 10 ), 1051010823255);

            
iHeight -= 16;
        }
    }

    return;

The sprite itself
PHP Code:
g_iSprites[SPR_BEAM
The outcome of an Elf
PHP Code:
/*ґЇ`·.ёё.ґЇ`·.ёё.ґЇ`·.ёё.ґЇ`·.ёё.ґЇ`·.ёё.ґЇ`·.ёё.ґЇ`·.ёё.ґЇ`·.ёё.ґЇ`·.ёё.ґЇ`·.ёё.ґЇ`·.ёё.
*    Race: Night Elf Functions
ґЇ`·.ёё.ґЇ`·.ёё.ґЇ`·.ёё.ґЇ`·.ёё.ґЇ`·.ёё.ґЇ`·.ёё.ґЇ`·.ёё.ґЇ`·.ёё.ґЇ`·.ёё.ґЇ`·.ёё.ґЇ`·.ёё.*/

#define    ENTANGLE_TIME        10.0

// Initiate Ultimate
public NE_ULT_EntangleiCasteriEnemy )
{

    
// Follow the user until they stop moving...
    
Create_TE_BEAMFOLLOWiEnemyg_iSprites[SPR_TRAIL], 1051010823255 );
    
    
// User is now stunned so we can't do any other stun abilities
    
p_data_b[iEnemy][PB_STUNNED] = true;
    
    
// Set the speed of the enemy (this will auto-stun them)
    
SHARED_SetSpeediEnemy );
    
    
// Start waiting for the user to stop...
    
new parm[4];
    
parm[0] = iEnemy;
    
parm[1] = 0;
    
parm[2] = 0;
    
parm[3] = 0;
    
_NE_ULT_EntangleWaitparm );
    
    
// Drop the user's weapon
    
if ( get_pcvar_numCVAR_wc3_entangle_drop ) )
    {
        new 
ammoclip;
        new 
iWeapon get_user_weaponiEnemyammoclip );
        
        
// Only drop the weapon if it is the user's primary weapon
        
if ( SHARED_IsPrimaryWeaponiWeapon ) )
        {
            
client_cmdiEnemy"drop" );
        }
    }
}



// Wait for the user to stop moving
public _NE_ULT_EntangleWaitparm[4] )
{

    new 
id parm[0];

    if ( !
p_data_b[id][PB_ISCONNECTED] )
    {
        return;
    }

    new 
vOrigin[3];
    
get_user_originidvOrigin );
    
    
// Checking to see if the user has actually stopped yet?
    
if ( vOrigin[0] == parm[1] && vOrigin[1] == parm[2] && vOrigin[2] == parm[3] )
    {
        
SHARED_SetSpeedid );

        
// Reset the user's speed in ENTANGLE_TIME amount of time
        
set_taskENTANGLE_TIME"SHARED_ResetMaxSpeed"TASK_RESETSPEED id );
        
        
// Entangle the user
        
NE_ULT_EntangleEffectid )
    }

    
// If not lets run another check in 0.1 seconds
    
else
    {
        
parm[1] = vOrigin[0];
        
parm[2] = vOrigin[1];
        
parm[3] = vOrigin[2];

        
set_task0.1"_NE_ULT_EntangleWait"TASK_ENTANGLEWAIT idparm);
    }
    return;
}

public 
NE_ULT_EntangleEffectid )
{

    
// Get the user's origin
    
new vOrigin[3];
    
get_user_originidvOrigin );
    
    
// Play the entangle sound
    
emit_soundidCHAN_STATICg_szSounds[SOUND_ENTANGLING], 1.0ATTN_NORM0PITCH_NORM );

    new 
iStart[3], iEnd[3], iHeight;
    new 
iRadius    20iCounter 0;
    new 
x1y1x2y2;

    
// Some sweet crap that I don't understand courtesy of SpaceDude - draws the "cylinder" around the player
    
while ( iCounter <= )
    {
        if ( 
iCounter == || iCounter == )
            
x1 = -iRadius;
        else if ( 
iCounter == || iCounter == )
            
x1 = -iRadius 100/141;
        else if ( 
iCounter == || iCounter == )
            
x1 0;
        else if ( 
iCounter == || iCounter == )
            
x1 iRadius*100/141
        
else if ( iCounter == )
            
x1 iRadius

        
if ( iCounter <= )
            
y1 sqrootiRadius*iRadius-x1*x1 );
        else
            
y1 = -sqrootiRadius*iRadius-x1*x1 );

        ++
iCounter;

        if ( 
iCounter == || iCounter == )
            
x2 = -iRadius;
        else if ( 
iCounter == || iCounter==)
            
x2 = -iRadius*100/141;
        else if ( 
iCounter == || iCounter==)
            
x2 0;
        else if ( 
iCounter == || iCounter==)
            
x2 iRadius*100/141;
        else if ( 
iCounter == )
            
x2 iRadius;
        
        if ( 
iCounter <= )
            
y2 sqrootiRadius*iRadius-x2*x2 );
        else
            
y2 = -sqrootiRadius*iRadius-x2*x2 );

        
iHeight 16 iCounter;

        while ( 
iHeight > -40 )
        {
            
            
iStart[0]    = vOrigin[0] + x1;
            
iStart[1]    = vOrigin[1] + y1;
            
iStart[2]    = vOrigin[2] + iHeight;
            
iEnd[0]        = vOrigin[0] + x2;
            
iEnd[1]        = vOrigin[1] + y2;
            
iEnd[2]        = vOrigin[2] + iHeight 2;
            
            
Create_TE_BEAMPOINTSiStartiEndg_iSprites[SPR_BEAM], 00, ( floatroundENTANGLE_TIME ) * 10 ), 1051010823255);

            
iHeight -= 16;
        }
    }

    return;
}

NE_EvasionidiHitZone )
{
    static 
iSkillLevel;

    
// Check to see if they should evade this shot?
    
iSkillLevel SM_GetSkillLevelidSKILL_EVASION );

    if ( 
iSkillLevel && random_float0.01.0 ) <= p_evasion[iSkillLevel-1] )
    {
        new 
iGlowIntensity random_num2050 );
        
        
// Head shot
        
if ( iHitZone & (<< HITGROUP_HEAD) )
        {
            
iGlowIntensity += 250;
        }

        
// Chest
        
else if ( iHitZone & (<< HITGROUP_CHEST) )
        {
            
iGlowIntensity += 75;
        }
        
        
// Make the user glow!
        
SHARED_Glowid00iGlowIntensity);

        
Create_ScreenFadeid, (1<<10), (1<<10), (1<<12), 00255g_GlowLevel[id][2] );

        return 
1;
    }

    return 
0;
}

NE_SkillsOffensiveiAttackeriVictimiWeaponiDamageiHitPlace )
{
    static 
iSkillLevel;

    
// Trueshot Aura
    
iSkillLevel SM_GetSkillLeveliAttackerSKILL_TRUESHOT );
    if ( 
iSkillLevel )
    {
        static 
iTempDamage;
        
iTempDamage floatroundfloatiDamage ) * p_trueshot[iSkillLevel-1] );
        
        
// Damage the user
        
WC3_DamageiVictimiAttackeriTempDamageiWeaponiHitPlace );

        
// Make the user glow!
        
SHARED_GlowiVictim, ( iTempDamage ), 00);

        
// Create a screen fade
        
Create_ScreenFadeiVictim, (1<<10), (1<<10), (1<<12), 25500iTempDamage );
    }
}

NE_SkillsDefensiveiAttackeriVictimiDamageiHitPlace )
{
    static 
iSkillLevel;

    
// Thorns Aura ( attacker could be dead... i.e. nade )
    
iSkillLevel SM_GetSkillLeveliVictimSKILL_THORNS );
    if ( 
iSkillLevel && is_user_aliveiAttacker ) )
    {
        static 
iAdditionalDamage;
        
iAdditionalDamage floatroundfloatiDamage ) * p_thorns[iSkillLevel-1] );
        
        
// Damage the user
        
WC3_DamageiAttackeriVictimiAdditionalDamageCSW_THORNSiHitPlace );

        
// Make the user glow!
        
SHARED_GlowiAttacker, ( iAdditionalDamage ), 00);
        
        
// Create a screen fade
        
Create_ScreenFadeiAttacker, (1<<10), (1<<10), (1<<12), 00255iAdditionalDamage )
    }

Thank you for your help and attention

The model size looks almost like a sprite ( the player is fully fit )
Example: (and this is the end result )

If all goes well, I then show what a beautiful result with animation to get in the game
MayroN is offline
Send a message via ICQ to MayroN Send a message via Skype™ to MayroN
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 19:17.


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