|
Veteran Member
Join Date: Sep 2017
Location: Taiwan, Asia
|
01-21-2020
, 06:39
Re: [L4D] Target Patch - Ignore Incapped (1.1) [14-Jan-2020]
|
#9
|
Quote:
Originally Posted by Silvers
"m_isIT"
|
Got it!
I already make special infected only target the nearest survivor who is not incapped,pinned, or hanging from ledge.
Ignore vomit effect, meaning tank finally won't change target to someone who get vomited.
Spoiler
PHP Code:
public MRESReturn ChooseVictimPost(int client, Handle hReturn) { // Ignore no target int victim = DHookGetReturn(hReturn); if( victim <= 0 ) return MRES_Ignored; // Ignore non-specified special infected int class = GetEntProp(client, Prop_Send, "m_zombieClass"); if( class == 5 ) class = 4;
if( g_iCvarTargets & (1 << class - 1) == 0 ) return MRES_Ignored;
// Find nearest survivor float vPos[3], vTarg[3]; float near = 50000.0; float dist; int newVictim; GetClientAbsOrigin(client, vPos);
for( int i = 1; i <= MaxClients; i++ ) { if( IsClientInGame(i) && IsPlayerAlive(i) && GetClientTeam(i) == 2) { if(IsPlayerPinned(i)) //ignore player pinned by hunter&smoker continue; if(IsHandingFromLedge(i)) //ignore player handingFromLedge continue; if(IsIncapacitated(i)) //ignore player incapped continue; /* if(IsPlayerOnVomit(i)) //ignore player get vomited continue; */ GetClientAbsOrigin(i, vTarg); dist = GetVectorDistance(vPos, vTarg); if( dist < near ) { near = dist; newVictim = i; } } }
// Override victim if( newVictim ) { DHookSetReturn(hReturn, newVictim); return MRES_Supercede; }
return MRES_Ignored;// Allow targeting anyone if all players are down. }
public bool IsPlayerPinned(int client) { int attacker = -1; attacker = GetEntPropEnt(client, Prop_Send, "m_pounceAttacker"); if (attacker > 0) // player is pinned by hunter { return true; } attacker = GetEntPropEnt(client, Prop_Send, "m_tongueOwner"); if (attacker > 0) // player is pinned by smoker { return true; } return false; } /* public bool IsPlayerOnVomit(int client) { return view_as<bool>(GetEntPropEnt(client, Prop_Send, "m_isIT")); } */ public bool IsHandingFromLedge(int client) { return view_as<bool>(GetEntProp(client, Prop_Send, "m_isHangingFromLedge") || GetEntProp(client, Prop_Send, "m_isFallingFromLedge")); }
public bool IsIncapacitated(int client) { return view_as<bool>(GetEntProp(client, Prop_Send, "m_isIncapacitated")); }
__________________
Last edited by HarryPotter; 01-21-2020 at 06:48.
|
|
|
|