Raised This Month: $ Target: $400
 0% 

[CS] Find entity if it is within the radius and apply damage


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Rirre
Veteran Member
Join Date: Nov 2006
Old 08-28-2013 , 13:17   Re: [CS] Find entity if it is within the radius and apply damage
Reply With Quote #3

Finally I made it to find them in the radius with this:
Code:
        new ent = -1         while((ent = find_ent_by_class(ent, "func_wall")))         {             new Float:fldist, Float:florigin[3]             pev(ent, pev_takedamage, takedamage)             if( takedamage > DAMAGE_NO && pev(ent, pev_flags) & FL_MONSTER )             {                 pev(ent, pev_origin, florigin)                 fldist = get_distance_f(florigin, fl_vExplodeAt)                 if (fldist <= dmgradius && fm_is_ent_visible(pToucher, ent, 0))                 {                     dRatio = floatdiv(fldist,float(dmgradius))                     damage = maxdamage - floatround(floatmul(float(maxdamage),dRatio))                     //...do damage                     server_print("Monster hit")                 }             }         }
EDIT:
Made the damage to work also.

I can't find "can_see_fm" anywhere so I used "fm_is_ent_visible".
Quote:
Originally Posted by Nextra
fm_is_ent_visible will return false negatives relatively often (at least there are many common situations where it will due to the origin comparison).
And yes, it does. Any other suggestions?

Last edited by Rirre; 08-28-2013 at 14:21.
Rirre is offline
 



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 18:57.


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