[CS] Find entity if it is within the radius and apply damage
I need to find if "func_wall" entities with FL_MONSTER flag are close enough to deal damage to and then apply damage to them if they are.
The same way as it does for client-/players with adjustable damage depending on the distance from the explosion. But I am out of ideas how to get it to work. Also, "m203_nade" is supposed to only hurt FL_MONSTER's if it is visible for the m203_nade (not the player/owner of it) to not hurt them through walls. Tried Ham_FVisible but it doesn't seem to work :/ Code:
|
Re: [CS] Find entity if it is within the radius and apply damage
Try using can_see_fm(entityid1, entityid2)
-entityid1 is nade id -entityid2 is victim id |
Re: [CS] Find entity if it is within the radius and apply damage
Finally I made it to find them in the radius with this:
Code:
Made the damage to work also. I can't find "can_see_fm" anywhere so I used "fm_is_ent_visible". Quote:
|
Re: [CS] Find entity if it is within the radius and apply damage
Quote:
PHP Code:
|
Re: [CS] Find entity if it is within the radius and apply damage
Thanks, works fine.
|
Re: [CS] Find entity if it is within the radius and apply damage
vexd_pfntouch, pfn_touch, FM_Touch are bad to use.
You could greatly optimize your code using register_touch. Also, consider find_ent_sphere so you can retrieve entity list within the wanted sphere : PHP Code:
|
Re: [CS] Find entity if it is within the radius and apply damage
:arrow:
Code:
Code:
error 009: invalid array size (negative or zero) |
Re: [CS] Find entity if it is within the radius and apply damage
Haven't tested code at all, mainly you have to declare MONSTER_CLASS not as const, and may be you haven't passed a Float as radius, or you passed a Float but native wants an integer.
For other warnings, if you use amxx1.8.3 you can use write_coord_f and write_angle_f, else you can use engfunc(EngFunc_WriteCoords and engfunc(EngFunc_WriteAngle when Float args are passed. Anyway, this is scriptin/help forum, you should be able to get rid of such warnings by yourself. |
Re: [CS] Find entity if it is within the radius and apply damage
About your deleted post, why don't you use ExecuteHam(Ham_TakeDamage to apply damage on entities ?
You could even remove pev_takedamage checks. Else, make sure you set pev_dmg_inflictor to the nade index, so game and other plugins can know which entity is calling damage. |
Re: [CS] Find entity if it is within the radius and apply damage
Quote:
Ye, you're right. Now that I've thought about it. takedamage is only set to 0.0/DAMAGE_NO when the CallGibMonster() is called. ScreenShake & do_damage do nothing when I switched to yours. Code:
|
| All times are GMT -4. The time now is 18:57. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.