Raised This Month: $ Target: $400
 0% 

Solved Select sprite frame


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Airkish
AlliedModders Donor
Join Date: Apr 2016
Location: Lithuania
Old 09-01-2018 , 09:31   Select sprite frame
Reply With Quote #1

How do I select sprite frame?
__________________

Last edited by Airkish; 09-02-2018 at 03:43.
Airkish is offline
Ghosted
Veteran Member
Join Date: Apr 2015
Location: Georgia
Old 09-01-2018 , 10:11   Re: Select sprite frame
Reply With Quote #2

EV_FL_frame/pev_frame
Here's more for sprite (C++)
__________________

[MOD] CS Weapon Mod V1.7.1
[MM] MetaMod-C V1.0
[MOD] CS NPC Mod (5%)


Probably Left AM

Last edited by Ghosted; 09-01-2018 at 10:12.
Ghosted is offline
Airkish
AlliedModders Donor
Join Date: Apr 2016
Location: Lithuania
Old 09-01-2018 , 10:16   Re: Select sprite frame
Reply With Quote #3

Quote:
Originally Posted by Ghosted View Post
EV_FL_frame/pev_frame
Here's more for sprite (C++)
Yeah I got that part. Now I'm having troubles getting sprite entity id...

PHP Code:
    message_beginMSG_ALLSVC_TEMPENTITY );
    
write_byteTE_PLAYERATTACHMENT );
    
write_byteid );
    
write_coord80 );
    
write_shortg_t_red_spr ); 
    
write_shortget_pcvar_numg_sprtime ) );
    
message_end(); 
Tried find_ent_by_* but didn't get the id :/
__________________
Airkish is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 09-01-2018 , 10:53   Re: Select sprite frame
Reply With Quote #4

Simply retrieve it by caching the value of precache_model in plugin_precache? Find_ent_by_* doesn't work because it's not an entity index, it's simply an index.
__________________
edon1337 is offline
Airkish
AlliedModders Donor
Join Date: Apr 2016
Location: Lithuania
Old 09-01-2018 , 10:59   Re: Select sprite frame
Reply With Quote #5

Quote:
Originally Posted by edon1337 View Post
Simply retrieve it by caching the value of precache_model in plugin_precache? Find_ent_by_* doesn't work because it's not an entity index, it's simply an index.
This is the code atm:

PHP Code:
    message_beginMSG_ALLSVC_TEMPENTITY );
    
write_byteTE_PLAYERATTACHMENT );
    
write_byteid );
    
write_coord80 );
    
write_shortg_t_red_spr ); 
    
write_shortget_pcvar_numg_sprtime ) );
    
message_end();

    
set_pev(g_t_red_sprpev_scale0.9);
    
set_pev(g_t_red_sprpev_frame2); 
sprite doesn't get scaled nor frame changed..
__________________

Last edited by Airkish; 09-01-2018 at 11:42.
Airkish is offline
Ghosted
Veteran Member
Join Date: Apr 2015
Location: Georgia
Old 09-01-2018 , 12:21   Re: Select sprite frame
Reply With Quote #6

you should create entity and set modelindex to precached sprite model. svc_tementity messages for drawing sprites wont work, you cant get entities from this message.
__________________

[MOD] CS Weapon Mod V1.7.1
[MM] MetaMod-C V1.0
[MOD] CS NPC Mod (5%)


Probably Left AM
Ghosted is offline
Airkish
AlliedModders Donor
Join Date: Apr 2016
Location: Lithuania
Old 09-01-2018 , 12:40   Re: Select sprite frame
Reply With Quote #7

Quote:
Originally Posted by Ghosted View Post
you should create entity and set modelindex to precached sprite model. svc_tementity messages for drawing sprites wont work, you cant get entities from this message.
I probably did something wrong, may you check

PHP Code:
    new ent create_entity("info_target")

    if(
is_valid_ent(ent)) {
        
entity_set_model(entT_SPRITE)
        
set_pev(entpev_scale0.2);
        
set_pev(entpev_frame2.0);
    } 
__________________
Airkish is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 09-01-2018 , 12:54   Re: Select sprite frame
Reply With Quote #8

Quote:
Originally Posted by Airkish View Post
I probably did something wrong, may you check

PHP Code:
    new ent create_entity("info_target")

    if(
is_valid_ent(ent)) {
        
entity_set_model(entT_SPRITE)
        
set_pev(entpev_scale0.2);
        
set_pev(entpev_frame2.0);
    } 
You get the sprite index, when you precache sprite.

PHP Code:
public plugin_precache( )
{
    
g_iSpriteIndex precache_model("YourSprite.spr");

__________________
edon1337 is offline
Airkish
AlliedModders Donor
Join Date: Apr 2016
Location: Lithuania
Old 09-01-2018 , 12:57   Re: Select sprite frame
Reply With Quote #9

Quote:
Originally Posted by edon1337 View Post
You get the sprite index, when you precache sprite.

PHP Code:
public plugin_precache( )
{
    
g_iSpriteIndex precache_model("YourSprite.spr");

Exactly it's the index but entity_set_model param 2 requires path to model.

P.S. If you mean I should've done like this:

PHP Code:
set_pev(g_t_red_sprpev_scale0.2); 
I tried that, it didn't had any effect.
__________________
Airkish is offline
Ghosted
Veteran Member
Join Date: Apr 2015
Location: Georgia
Old 09-01-2018 , 13:20   Re: Select sprite frame
Reply With Quote #10

Quote:
Originally Posted by edon1337 View Post
You get the sprite index, when you precache sprite.

PHP Code:
public plugin_precache( )
{
    
g_iSpriteIndex precache_model("YourSprite.spr");

Thats for messages. For sprite entity you should use model name.


Use this structure, works for me

Code:
	>entity_set_model
	>entity_set_origin
	// Convert to pawn code
	>movetype = MOVETYPE_NOCLIP;
	>rendermode = kRenderTransAdd;
	>renderamt = 255.0f;
	>scale = 2.0f;
	>solid = SOLID_NOT;
	>framerate = 18.0f;
	//After this you should loop nexttink to set frame on specified value
	>nextthink
__________________

[MOD] CS Weapon Mod V1.7.1
[MM] MetaMod-C V1.0
[MOD] CS NPC Mod (5%)


Probably Left AM

Last edited by Ghosted; 09-01-2018 at 13:23.
Ghosted 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 11:31.


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