Raised This Month: $ Target: $400
 0% 

[Help scripting code] Monster Controllable - Attack


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
devilsquare
Junior Member
Join Date: Sep 2013
Old 02-23-2017 , 16:09   [Help scripting code] Monster Controllable - Attack
Reply With Quote #1

Hello, I was wondering if it is possible to let the monster draw blood from only the front players!

Look at the example below to understand a little of what I'm talking about:

Code:
public set_attack(ent)
{
    new owner = entity_get_edict(ent, EV_ENT_owner)
    new victim = get_victim(ent)
    new Float:start[3], Float:end[3], Float:flFraction, pHit
    entity_get_vector(ent, EV_VEC_origin, start)
    entity_get_vector(victim, EV_VEC_origin, end)

    engfunc(EngFunc_TraceLine, start, end, DONT_IGNORE_MONSTERS, ent, 0)
    get_tr2(0, TR_flFraction, flFraction)
    pHit = get_tr2(0, TR_pHit)

    if (flFraction < 1.0) if (is_valid_ent(pHit)) set_damage(pHit, owner, npc_damage)
}
Sorry for the language mistranslated
devilsquare is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 02-25-2017 , 05:45   Re: [Help scripting code] Monster Controllable - Attack
Reply With Quote #2

The target selection seems to be made in get_victim().

You could use TraceHull with an appropriate body to determine if the target is partly covered by something. But it may not have the effect that you want.

A simple distance check should also work. But I'm assuming get_victim() has something like this since no parameters are fed into it.
__________________
Black Rose is offline
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 21:53.


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