AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Attach sprite(model) to player (https://forums.alliedmods.net/showthread.php?t=2547)

werdig 06-08-2004 07:37

Attach sprite(model) to player
 
How Attach sprite(model) to player??

devicenull 06-08-2004 08:40

With a specific command

werdig 06-08-2004 09:26

What a specific command? I think with client message, but i dont' know by what message i need..... :(

ts2do 06-08-2004 11:16

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

werdig 06-08-2004 12:23

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.

ts2do 06-08-2004 12:56

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

werdig 06-08-2004 17:12

If it not difficult for u, plz write some code, because i'm not understand all good.

IceMouse[WrG] 06-08-2004 19:34

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

werdig 06-09-2004 06:02

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 ?

IceMouse[WrG] 06-09-2004 16:28

Yes you have to redraw it, or give it velocity... Use Entity_prethink or whatever it is


All times are GMT -4. The time now is 14:52.

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