Raised This Month: $51 Target: $400
 12% 

how to make a SPR can be seen everywhere?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Leech_v2
Senior Member
Join Date: Mar 2011
Location: Chinese GuangDong
Old 03-31-2012 , 18:02   how to make a SPR can be seen everywhere?
Reply With Quote #1

Leech_v2 is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 03-31-2012 , 21:09   Re: how to make a SPR can be seen everywhere?
Reply With Quote #2

The picture is kinda confusing but I guess it's about displaying a sprite like it's visible through the walls, no ?

It can't be directly done, it's a trick... do a traceline towards your target and place the sprite where it first hits then alter it's size depending on the distance to fake it's far away look (or not, dunno what behaviour you look for).
Also be sure to display the sprite only for that specific player, not for all players, so use a message or if you must use an entity use addtofullpack forward (search if you don't know what that is).
__________________

Last edited by Hunter-Digital; 03-31-2012 at 21:12.
Hunter-Digital is offline
dias
BANNED
Join Date: Jul 2009
Location: South Vietnam
Old 03-31-2012 , 23:42   Re: how to make a SPR can be seen everywhere?
Reply With Quote #3

PHP Code:
stock create_icon_origin(identspritescale_sprlight_spr)
{
    if (!
pev_valid(ent)) return;
    
    new 
Float:fMyOrigin[3]
    
entity_get_vector(idEV_VEC_originfMyOrigin)
    
    new 
target ent
    
new Float:fTargetOrigin[3]
    
entity_get_vector(targetEV_VEC_originfTargetOrigin)
    
fTargetOrigin[2] += 40.0
    
    
if (!is_in_viewcone(idfTargetOrigin)) return;

    new 
Float:fMiddle[3], Float:fHitPoint[3]
    
xs_vec_sub(fTargetOriginfMyOriginfMiddle)
    
trace_line(-1fMyOriginfTargetOriginfHitPoint)
                            
    new 
Float:fWallOffset[3], Float:fDistanceToWall
    fDistanceToWall 
vector_distance(fMyOriginfHitPoint) - 10.0
    normalize
(fMiddlefWallOffsetfDistanceToWall)
    
    new 
Float:fSpriteOffset[3]
    
xs_vec_add(fWallOffsetfMyOriginfSpriteOffset)
    new 
Float:fScale
    fScale 
0.01 fDistanceToWall
    
    
new scale floatround(fScale)
    
scale max(scale1)
    
scale min(scalescale_spr)
    
scale max(scale1)

    
te_sprite(idfSpriteOffsetspritescalelight_spr)
}

stock te_sprite(idFloat:origin[3], spritescalebrightness)
{    
    
message_begin(MSG_ONESVC_TEMPENTITY_id)
    
write_byte(TE_SPRITE)
    
write_coord(floatround(origin[0]))
    
write_coord(floatround(origin[1]))
    
write_coord(floatround(origin[2]))
    
write_short(sprite)
    
write_byte(scale
    
write_byte(brightness)
    
message_end()
}

stock normalize(Float:fIn[3], Float:fOut[3], Float:fMul)
{
    new 
Float:fLen xs_vec_len(fIn)
    
xs_vec_copy(fInfOut)
    
    
fOut[0] /= fLenfOut[1] /= fLenfOut[2] /= fLen
    fOut
[0] *= fMulfOut[1] *= fMulfOut[2] *= fMul


Last edited by dias; 03-31-2012 at 23:43.
dias is offline
Send a message via Yahoo to dias Send a message via Skype™ to dias
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 10:32.


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