AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Attaching a sprite to a moving entity. (https://forums.alliedmods.net/showthread.php?t=63313)

hlstriker 11-17-2007 18:31

Attaching a sprite to a moving entity.
 
I'm trying to attach a sprite to a moving entity. I looked through all the temp ents and didn't see anything that would do what I wanted.

I tried to make a an env_sprite entity and set the aiment to the entity I want it to follow. This didn't work.

I'm assuming there is a temp ent to do this but I just can't find it.

P34nut 11-17-2007 18:34

Re: Attaching a sprite to a moving entity.
 
Please show the code you used

hlstriker 11-17-2007 18:50

Re: Attaching a sprite to a moving entity.
 
Was testing some more and got it working with this code...

PHP Code:

new sprite engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"env_sprite"));
if(!
sprite) return PLUGIN_CONTINUE;
set_pev(spritepev_classname"spritetest");
engfunc(EngFunc_SetModelsprite"sprites/glow01.spr");
engfunc(EngFunc_SetSizespriteFloat:{0.0,0.0,0.0}, Float:{0.0,0.0,0.0});
engfunc(EngFunc_SetOriginspriteorigin);
set_pev(spritepev_solidSOLID_NOT);
set_pev(spritepev_movetypeMOVETYPE_FLY);
set_pev(spritepev_aimentent); 

Still need to set some key/values to get it to look right ;p

P34nut 11-18-2007 06:19

Re: Attaching a sprite to a moving entity.
 
change this:
PHP Code:

 set_pev(spritepev_movetypeMOVETYPE_FLY); 

to this:
PHP Code:

set_pev(spritepev_movetypeMOVETYPE_FOLLOW); 


Wilson [29th ID] 11-18-2007 12:52

Re: Attaching a sprite to a moving entity.
 
If you're attaching it to a player,

#define TE_PLAYERATTACHMENT 124 // Attaches a TENT to a player (this is a high-priority tent)
// write_byte(TE_PLAYERATTACHMENT)
// write_byte(entity index of player)
// write_coord(vertical offset) (attachment origin.z = player origin.z + vertical offset)
// write_short(model index)
// write_short(life * 10 )

hlstriker 11-18-2007 15:13

Re: Attaching a sprite to a moving entity.
 
Quote:

Originally Posted by P34nut (Post 554184)
change this:
PHP Code:

 set_pev(spritepev_movetypeMOVETYPE_FLY); 

to this:
PHP Code:

set_pev(spritepev_movetypeMOVETYPE_FOLLOW); 


Woah, didn't even notice I had it on fly. That's what I get for copy and pasting :P Weird thing is that it was working with fly.

Quote:

Originally Posted by Wilson [29th ID] (Post 554323)
If you're attaching it to a player,

#define TE_PLAYERATTACHMENT 124 // Attaches a TENT to a player (this is a high-priority tent)
// write_byte(TE_PLAYERATTACHMENT)
// write_byte(entity index of player)
// write_coord(vertical offset) (attachment origin.z = player origin.z + vertical offset)
// write_short(model index)
// write_short(life * 10 )

That's what I tried first on the non-player entity. It just spit errors out at me in the console :P

Anyhow, it's working perfectly now. Thanks for helping :)


All times are GMT -4. The time now is 01:17.

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