Raised This Month: $ Target: $400
 0% 

Attaching a sprite to a moving entity.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 11-17-2007 , 18:31   Attaching a sprite to a moving entity.
Reply With Quote #1

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.
hlstriker is offline
P34nut
AMX Mod X Beta Tester
Join Date: Feb 2006
Location: Netherlands
Old 11-17-2007 , 18:34   Re: Attaching a sprite to a moving entity.
Reply With Quote #2

Please show the code you used
__________________
All you need to change the world is one good lie and a river of blood
P34nut is offline
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 11-17-2007 , 18:50   Re: Attaching a sprite to a moving entity.
Reply With Quote #3

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
hlstriker is offline
P34nut
AMX Mod X Beta Tester
Join Date: Feb 2006
Location: Netherlands
Old 11-18-2007 , 06:19   Re: Attaching a sprite to a moving entity.
Reply With Quote #4

change this:
PHP Code:
 set_pev(spritepev_movetypeMOVETYPE_FLY); 
to this:
PHP Code:
set_pev(spritepev_movetypeMOVETYPE_FOLLOW); 
__________________
All you need to change the world is one good lie and a river of blood
P34nut is offline
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 11-18-2007 , 15:13   Re: Attaching a sprite to a moving entity.
Reply With Quote #5

Quote:
Originally Posted by P34nut View Post
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 Weird thing is that it was working with fly.

Quote:
Originally Posted by Wilson [29th ID] View Post
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

Anyhow, it's working perfectly now. Thanks for helping
hlstriker is offline
Wilson [29th ID]
Veteran Member
Join Date: Nov 2005
Location: London
Old 11-18-2007 , 12:52   Re: Attaching a sprite to a moving entity.
Reply With Quote #6

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 )
__________________

Day of Defeat AMXX Community

FakeMeta Research . Voice Proximity . Advanced Deploy . Technician
Wilson [29th ID] is offline
Send a message via ICQ to Wilson [29th ID] Send a message via AIM to Wilson [29th ID] Send a message via MSN to Wilson [29th ID] Send a message via Yahoo to Wilson [29th ID]
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 01:17.


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