AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugin/Gameplay Ideas and Requests (https://forums.alliedmods.net/forumdisplay.php?f=60)
-   -   Solved [L4D2] Witch target override in better way? (https://forums.alliedmods.net/showthread.php?t=329520)

HarryPotter 12-27-2020 22:00

[L4D2] Witch target override in better way?
 
As the title says, I need a function like this
PHP Code:


//entitiy: witch
//client: a target that witch will chase 
//return true if succeed, return false if can't change witch target

bool WitchAttackTargetint entityint client

Change target when the witch incapacitates or kills victim,
I know some plugins already did this before, but there are still some problems.

Example:
1. [L4D & L4D2] Evil Witch
Spawns a new witch and give a hurt point. I think that is not good.

2. [L4D2] Relentless Witch
He uses signature "@_ZN8Infected15OnHitByVomitJarEP20CBaseComba tCharacter" on witch, but the director will call a horde.

Edit:
Thanks BHaType, xZk, cravenge and silvers, I write code here for myself

Marttt 12-28-2020 00:23

Re: [L4D2] Witch target override in better way?
 
Is not exactly what you asked...

Maybe you can force the target with CommandABot

Usually, we use that for bots (clients) (Scavenge Bots use this, I think).

I have never seen a plugin to common infected/witch.

Didn't test but here are some examples.

https://gist.github.com/Rectus/8d760...c5ce378ed09264 (steamworkshop source)

https://github.com/search?q=commanda...3Asp&type=code

BHaType 12-28-2020 03:27

Re: [L4D2] Witch target override in better way?
 
My old practices, they work but as far as I remember the server will crash if you change the target when the witch is not scared yet

You can also literally change the target to any entity and patch the WitchAttack::IsValidEnemy function so the witch can run after anyone and not just survivors

Spoiler


Note:
If this still works then I might try to make a more advanced version and this is for windows only

HarryPotter 12-28-2020 04:27

Re: [L4D2] Witch target override in better way?
 
I will give a try and report

HarryPotter 12-28-2020 07:45

Re: [L4D2] Witch target override in better way?
 
Quote:

Originally Posted by BHaType (Post 2730405)
Note:
If this still works then I might try to make a more advanced version and this is for windows only

I just tested,
Everything works fine in windows server,
no crash, no wired behavior.

I just have a little wish,
It could be better if we can force witch to attack another target again even after witch had lost her target or killed survivor already.

larrybrains 12-29-2020 22:47

Re: [L4D2] Witch target override in better way?
 
Quote:

Originally Posted by BHaType (Post 2730405)
If this still works then I might try to make a more advanced version and this is for windows only

Would love to see a Linux version of this.

xZk 01-02-2021 20:15

Re: [L4D2] Witch target override in better way?
 
ago I was looking for something like that, and maybe this can be useful when the witch loses her objective, but I think it only works for survivors :/:
PHP Code:

stock void WitchChangeTarget(int witchint target)
{
    
//PrintToChatAll("attacking target %N", target);
    
if(GetEntProp(witchProp_Send"m_bIsBurning") == 1){
        
ExtinguishEntity(witch);
        
SDKHooks_TakeDamage(witchtargettarget0.0DMG_BURN);
    }else{
        
int anim GetEntProp(witchProp_Send"m_nSequence");
        
SDKHooks_TakeDamage(witchtargettarget0.0DMG_BURN);
        
SetEntProp(witchProp_Send"m_nSequence"anim);
        
SetVariantFloat(0.0);
        
AcceptEntityInput(witch"IgniteLifetime");
        
//ExtinguishEntity(witch);// no works
        
SetEntProp(witchProp_Send"m_bIsBurning"0);
        
int ent GetEntPropEnt(witchProp_Data"m_hMoveChild");
        if(
IsValidEnt(ent)){
            
char classname[32];
            
GetEntityClassname(entclassnamesizeof(classname));
            if(
strcmp(classname"entityflame") == 0){
                
SDKHook(entSDKHook_SetTransmitSetTransmit_Fire);
            }
        }
    }
}

public 
Action SetTransmit_Fire(int entityint client)
{
    return 
Plugin_Handled;



HarryPotter 01-04-2021 21:30

Re: [L4D2] Witch target override in better way?
 
Quote:

Originally Posted by xZk (Post 2731092)
ago I was looking for something like that, and maybe this can be useful when the witch loses her objective, but I think it only works for survivors :/:

Working for survivors is enough to me, I will give a try

HarryPotter 01-10-2021 07:21

Re: [L4D2] Witch target override in better way?
 
Thanks BHaType, xZk, cravenge and silvers, I write a script for myself

Witch target override Improved version 1.8 [2022/11/14]
Change target when the witch incapacitates or kills victim + witchs auto follow survivors

Feature
* Witch is allowed to chase another target after she incapacitates a survivor.
* Witch is allowed to chase another target after she kills a survivor.
* Witch will not follow survivor if there is a wall between witch and survivor.
* Witch will not follow survivor if survivor standing on the higher place.
* Witch burns for a set amount of time and die. ("z_witch_burn_time" is 15 seconds)

apply to:
L4D1/2


-Source Code Download-
Latest version always here

cravenge 01-10-2021 08:47

Re: [L4D2] Witch target override in better way?
 
You might improve the method on completely removing the fire from the Witch. You could take a look at the Bots Trigger Witch plugin by Silvers.


All times are GMT -4. The time now is 07:54.

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