AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Sprite animations (https://forums.alliedmods.net/showthread.php?t=162106)

bogdyuttzu 07-15-2011 03:18

Sprite animations
 
I try to attach to player an animatesprite with this code but don't work

Code:

        engfunc(EngFunc_SetModel, ent, "sprites/zombihealer.spr");
        set_pev(ent, pev_aiment, id);
        set_pev(ent, pev_movetype, MOVETYPE_FOLLOW);
        set_pev(ent, pev_owner, id);
       
        set_pev(ent, pev_scale, 1.0);
       
        set_pev(ent, pev_rendermode, kRenderTransAlpha);
        set_pev(ent, pev_renderamt, 255.0);       
       
        set_pev(ent, pev_animtime, get_gametime())
        set_pev(ent, pev_framerate, 1.0)
        set_pev(ent, pev_spawnflags, SF_SPRITE_STARTON)
       
        dllfunc(DLLFunc_Spawn, ent)

The sprite don't spawn

abdul-rehman 07-15-2011 03:39

Re: Sprite animations
 
Can you post the whole code behind the scene?

bogdyuttzu 07-15-2011 03:45

Re: Sprite animations
 
PHP Code:

    g_playerenth[id] = engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"env_sprite"));        
    
    if(
pev_valid(ent))
        return
    
    
engfunc(EngFunc_SetModelg_playerenth[id], "sprites/zombihealer.spr");
    
set_pev(g_playerenth[id], pev_aimentid);
    
set_pev(g_playerenth[id], pev_movetypeMOVETYPE_FOLLOW);
    
set_pev(g_playerenth[id], pev_ownerid);
    
    
set_pev(g_playerenth[id], pev_scale1.0);
    
    
set_pev(g_playerenth[id], pev_rendermodekRenderTransAlpha);
    
set_pev(g_playerenth[id], pev_renderamt255.0);    
    
    
set_pev(g_playerenth[id], pev_animtimeget_gametime())
    
set_pev(g_playerenth[id], pev_framerate1.0)
    
set_pev(g_playerenth[id], pev_spawnflagsSF_SPRITE_STARTON)
    
    
dllfunc(DLLFunc_Spawng_playerenth[id]) 


Hunter-Digital 07-15-2011 03:50

Re: Sprite animations
 
Quote:

Originally Posted by bogdyuttzu (Post 1510994)
PHP Code:

    if(pev_valid(ent))
        return 


So if entity is valid, just cancel the whole thing =) ... add a NOT logic operator ( ! ) before pev_valid().

bogdyuttzu 07-15-2011 03:52

Re: Sprite animations
 
LOL I forgot this my fail

bogdyuttzu 07-15-2011 03:57

Re: Sprite animations
 
Now is work but have black background

Hunter-Digital 07-15-2011 04:01

Re: Sprite animations
 
See what type of transparency the sprite has and use that in your pev_rendermode... you can view sprites with "SprView" program and use View -> Sprite Information to see transparency mode.

EDIT: actually, if it's not alphatest, it should be additive, so try that rendermode.

bogdyuttzu 07-15-2011 04:08

Re: Sprite animations
 
Done it's work now

Ms Hunter pt ajutor

abdul-rehman 07-15-2011 05:41

Re: Sprite animations
 
I tested with alphatest and it worked for me however additive sprite doesnt work from some reason.
What alterations did you do to make it work ?

Hunter-Digital 07-15-2011 06:07

Re: Sprite animations
 
Quote:

Originally Posted by abdul-rehman (Post 1511041)
I tested with alphatest and it worked for me however additive sprite doesnt work from some reason.
What alterations did you do to make it work ?

It's sprite related, you can't just test with any sprite, you must have the exact sprite he's using... do you ?


All times are GMT -4. The time now is 00:51.

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