Raised This Month: $ Target: $400
 0% 

Attach sprite(model) to player


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
werdig
Junior Member
Join Date: May 2004
Old 06-08-2004 , 07:37   Attach sprite(model) to player
Reply With Quote #1

How Attach sprite(model) to player??
werdig is offline
Send a message via ICQ to werdig
devicenull
Veteran Member
Join Date: Mar 2004
Location: CT
Old 06-08-2004 , 08:40  
Reply With Quote #2

With a specific command
__________________
Various bits of semi-useful code in a bunch of languages: http://code.devicenull.org/
devicenull is offline
werdig
Junior Member
Join Date: May 2004
Old 06-08-2004 , 09:26  
Reply With Quote #3

What a specific command? I think with client message, but i dont' know by what message i need.....
werdig is offline
Send a message via ICQ to werdig
ts2do
Senior Member
Join Date: Mar 2004
Old 06-08-2004 , 11:16  
Reply With Quote #4

message_begin(MSG_ALL,SVC_TEMPENTITY)
write_short(TE_PLAYERATTACHMENT)
write_entity(id)
write_coord(z axis offset from user origin)
write_short(model index)
write_short(life)
message_end()
__________________
ts2do is offline
Send a message via AIM to ts2do
werdig
Junior Member
Join Date: May 2004
Old 06-08-2004 , 12:23  
Reply With Quote #5

If i understand, by TE_PLAYERATTACHMENT i can set only z origin, but i need create a sprite which be in front of player model, so i need set x & y origin too.
werdig is offline
Send a message via ICQ to werdig
ts2do
Senior Member
Join Date: Mar 2004
Old 06-08-2004 , 12:56  
Reply With Quote #6

you spawn a info_target and set the model to the sprite and then set the origin to the origin +/- the difference with entity_set_model and entity_set_origin
then set EV_INT_movetype to MOVETYPE_FOLLOW and the EV_ENT_aiment to the user
__________________
ts2do is offline
Send a message via AIM to ts2do
werdig
Junior Member
Join Date: May 2004
Old 06-08-2004 , 17:12  
Reply With Quote #7

If it not difficult for u, plz write some code, because i'm not understand all good.
werdig is offline
Send a message via ICQ to werdig
IceMouse[WrG]
Senior Member
Join Date: Mar 2004
Old 06-08-2004 , 19:34  
Reply With Quote #8

Code:
#DEFINE UNITS 20 // How many units out it should be new origin[3], look[3], vec[3], spriteorigin[3]; new i; get_user_origin(id,origin); get_user_origin(id,origin,3); for(i = 0; i < 3; i++)     vec[i] = look[i] - origin[i]; } /* NORMALIZE vec[] HERE... I DON'T KNOW IF THERE IS A SQROOT FUNCTION OR A NORMALIZE... Normalize it by Magnitude = sqroot(x*x+y*y+z*z); vec[0] = vec[0] / Magnitude; And so on*/ for(i=0;i<3;i++) {     spriteorigin[i] = vec[i]  * UNITS; } /* SPAWN THE SPRITE HERE, OBVIOUSLY USING spriteorigin[] AS ITS ORIGIN */
No warranties
IceMouse[WrG] is offline
Send a message via AIM to IceMouse[WrG] Send a message via MSN to IceMouse[WrG] Send a message via Yahoo to IceMouse[WrG]
werdig
Junior Member
Join Date: May 2004
Old 06-09-2004 , 06:02  
Reply With Quote #9

I must draw sprite for 1 cycle, when i use code by IceMouse[WrG], becouse origins out of date after every cycle. I am right ?
werdig is offline
Send a message via ICQ to werdig
IceMouse[WrG]
Senior Member
Join Date: Mar 2004
Old 06-09-2004 , 16:28  
Reply With Quote #10

Yes you have to redraw it, or give it velocity... Use Entity_prethink or whatever it is
IceMouse[WrG] is offline
Send a message via AIM to IceMouse[WrG] Send a message via MSN to IceMouse[WrG] Send a message via Yahoo to IceMouse[WrG]
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 14:52.


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