Raised This Month: $ Target: $400
 0% 

Solved Select sprite frame


Post New Thread Reply   
 
Thread Tools Display Modes
Airkish
AlliedModders Donor
Join Date: Apr 2016
Location: Lithuania
Old 09-01-2018 , 14:04   Re: Select sprite frame
Reply With Quote #11

Quote:
Originally Posted by Ghosted View Post
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
Would you mind sharing the code?
__________________
Airkish is offline
Ghosted
Veteran Member
Join Date: Apr 2015
Location: Georgia
Old 09-01-2018 , 14:45   Re: Select sprite frame
Reply With Quote #12

Quote:
Originally Posted by Airkish View Post
Would you mind sharing the code?
That's it.
Code:
// Create entity

entity_set_model(Entity, <Model>);
entity_set_origin(Entity, <Origin>);
entity_set_int(Entity, EV_INT_movetype, MOVETYPE_NOCLIP);
entity_set_int(Entity, EV_INT_rendermode, kRenderTransAdd);
entity_set_float(Entity, EV_FL_renderamt, 255.0);
entity_set_float(Entity, EV_FL_scale, 2.0);
entity_set_int(Entity, EV_INT_solid, SOLID_NOT);
entity_set_float(Entity, EV_FL_framerate, 18.0);
entity_set_float(Entity, EV_FL_nextthink, 0.016);
Hook hamsandwich think and then set EV_FL_frame
__________________

[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 15:26.
Ghosted is offline
Airkish
AlliedModders Donor
Join Date: Apr 2016
Location: Lithuania
Old 09-01-2018 , 17:23   Re: Select sprite frame
Reply With Quote #13

Quote:
Originally Posted by Ghosted View Post
That's it.
Code:
// Create entity

entity_set_model(Entity, <Model>);
entity_set_origin(Entity, <Origin>);
entity_set_int(Entity, EV_INT_movetype, MOVETYPE_NOCLIP);
entity_set_int(Entity, EV_INT_rendermode, kRenderTransAdd);
entity_set_float(Entity, EV_FL_renderamt, 255.0);
entity_set_float(Entity, EV_FL_scale, 2.0);
entity_set_int(Entity, EV_INT_solid, SOLID_NOT);
entity_set_float(Entity, EV_FL_framerate, 18.0);
entity_set_float(Entity, EV_FL_nextthink, 0.016);
Hook hamsandwich think and then set EV_FL_frame
PHP Code:
public createEntity(id) {
    static 
Float:flOrigin[3]
    new 
ent;
    
pev(idpev_originflOrigin)
    
ent create_entity("rank_ent")
 
    
entity_set_model(entT_SPRITE);
    
entity_set_origin(entflOrigin);
    
entity_set_int(entEV_INT_movetypeMOVETYPE_NOCLIP);
    
entity_set_int(entEV_INT_rendermodekRenderTransAdd);
    
entity_set_float(entEV_FL_renderamt255.0);
    
entity_set_float(entEV_FL_scale0.4);
    
entity_set_int(entEV_INT_solidSOLID_NOT);
    
entity_set_float(entEV_FL_framerate18.0);
    
entity_set_float(entEV_FL_nextthink0.016);
}
 
public 
ham_think(ent) {
    
entity_set_float(entEV_FL_nextthinkget_gametime() + 0.1)

I am able to spawn entity with my sprite and chosen scale, frame. Thanks!

Next, how do I set sprite to show like TE_PLAYERATTACHMENT (I mean above player's head and follow him)?
__________________
Airkish is offline
Ghosted
Veteran Member
Join Date: Apr 2015
Location: Georgia
Old 09-01-2018 , 17:52   Re: Select sprite frame
Reply With Quote #14

Quote:
Originally Posted by Airkish View Post
Next, how do I set sprite to show like TE_PLAYERATTACHMENT (I mean above player's head and follow him)?
I'm afraid that's impossible. You can anyway do that by setting origin (by PreThink) but it will look laggy.
__________________

[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 17:52.
Ghosted is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 09-01-2018 , 18:26   Re: Select sprite frame
Reply With Quote #15

It's possible, check my CS Battle Royale plugin where I set Arrow Sprite above teammates head.
__________________

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

Quote:
Originally Posted by edon1337 View Post
It's possible, check my CS Battle Royale plugin where I set Arrow Sprite above teammates head.
You've used TE_PLAYERATTACHMENT message

PHP Code:
        message_beginMSG_ONE_UNRELIABLESVC_TEMPENTITY_iHost )
        
write_byteTE_PLAYERATTACHMENT );
        
write_byteiEnt );
        
write_coord45 );
        
write_shortg_iSprite ); 
        
write_short20 );
        
message_end( ); 
I need to scale sprite and select frame (which is not possbile with TE_PLAYERATTACHMENT).

Edit: Solved by setting entity's origin on ham_think
__________________

Last edited by Airkish; 09-02-2018 at 03:44.
Airkish is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 09-02-2018 , 06:54   Re: Select sprite frame
Reply With Quote #17

Quote:
Originally Posted by Airkish View Post
Next, how do I set sprite to show like TE_PLAYERATTACHMENT (I mean above player's head and follow him)?
Quote:
Originally Posted by Airkish View Post
You've used TE_PLAYERATTACHMENT message

message_begin( MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, _, iHost )
write_byte( TE_PLAYERATTACHMENT );
write_byte( iEnt );
write_coord( 45 );
write_short( g_iSprite );
write_short( 20 );
message_end( );
I gave you exactly what you asked for, it's just that you're unsure about what you're trying to do.
You can set a sprite frame by using pev_frame and change the scale by using pev_scale.
Add these two natives in my code and show the results instead of using Ham_Think.
__________________

Last edited by edon1337; 09-02-2018 at 06:58.
edon1337 is offline
Ghosted
Veteran Member
Join Date: Apr 2015
Location: Georgia
Old 09-02-2018 , 07:09   Re: Select sprite frame
Reply With Quote #18

And what is the entity id which you use as first param in set_pev for pev_scale/pev_frame ?
__________________

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


Probably Left AM
Ghosted is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 09-02-2018 , 07:15   Re: Select sprite frame
Reply With Quote #19

Quote:
Originally Posted by Ghosted View Post
And what is the entity id which you use as first param in set_pev for pev_scale/pev_frame ?
I don't really get what you're talking about, but, if you're talking about the first parameter on Ham_Think, then that's the fourth parameter in AddToFullPack.
__________________

Last edited by edon1337; 09-02-2018 at 07:16.
edon1337 is offline
Ghosted
Veteran Member
Join Date: Apr 2015
Location: Georgia
Old 09-02-2018 , 07:18   Re: Select sprite frame
Reply With Quote #20

Quote:
Originally Posted by edon1337 View Post
I don't really get what you're talking about, but, if you're talking about the first parameter on Ham_Think, then that's the fourth parameter in AddToFullPack.
He wants to set scale/frame of the sprite entity that is above player head, you said to use TE_PLAYERATTACHMENT and pev_scale/pev_frame and i'm asking how is it possible to use both together.
__________________

[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-02-2018 at 07:21.
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:08.


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