[L4D2] Setting Damage dealt to witch
Hi, I'm wondering how do you set damage dealt to a witch
Code:
public void OnPluginStart() Code:
public Action OnTakeDamage(int victim, int &attacker, int &inflictor, float &damage, int &damagetype) Any Help would be appreciated! |
Re: [L4D2] Setting Damage dealt to witch
The order of events are "random"
You can have a plugin messing with OnTakeDamage But if the plugin that outputs fires first then it may ignore the damage changed. The plugin that outputs to the chat should use OnTakeDamagePost. Can you share the other plugin? (if public) EDIT: So after trying your code I see that you GetClientTeam(victim) == 2 on the witch Victim is the witch Witch is not a client. (So GetClientTeam fails) Team 2 means survivor Try testing with this: PHP Code:
|
Re: [L4D2] Setting Damage dealt to witch
2 Attachment(s)
Quote:
Code:
if (GetClientTeam(victim) == 2) I'm working on the plugin l4d2_critical_shot_m.sp which will deal extra damage by changing the damage in OnTakeDamage. But it doesn't work for witch. This plugin requires the main l4d2_skills_core_V2.2.sp or the main one linked above. Once you buy the skill from the menu the player will be able to have a chance to deal extra damage. GetClientTeam(victim) == 2 is to prevent changing damage done to Survivor team. The original plugin can be found here, I'm making a module for Skills that allow you to buy skills from a menu. |
Re: [L4D2] Setting Damage dealt to witch
Well try to change OnTakeDamagePost to OnTakeDamage
The signature method is wrong (check here) PHP Code:
PHP Code:
If you just wanna check the values check on OnTakeDamagePost (return) Both plugins have too many dependencies (files and includes) so I can't properly test in my local server. |
Re: [L4D2] Setting Damage dealt to witch
Quote:
I will try to implement OnTakeDamagePost to detect the damage instead of OnTakeDamage. Thanks~! |
Re: [L4D2] Setting Damage dealt to witch
My code snippet outputs damage to the witch
If it's not outputting maybe you have some plugin cancelling the damage triggering before. Also witch is not considered as a SI (client), they are more similar to commons (infected) when we compare them as entities |
Re: [L4D2] Setting Damage dealt to witch
PHP Code:
|
Re: [L4D2] Setting Damage dealt to witch
Quote:
Code:
public Action OnTakeDamage(int victim, int &attacker, int &inflictor, float &damage, int &damagetype) |
Re: [L4D2] Setting Damage dealt to witch
You should remove all your plugins and test this one as a single alone.
As I said if another plugin does "return Plugin_Stop;" on OnTakeDamage first. It will not fire your PrintToChat Witchs are not clients, so you can safely check victim > MaxClients If you check the classname before then you don't even need the victim check. The only thing I don't have is that g_iLevel var, maybe this is the problem. As always, to debug your code, start doing simple checks then add more. Maybe one of your checks is failing. From your replies seem that you didn't test my snippet either from cravenge, both are working for us. |
Re: [L4D2] Setting Damage dealt to witch
2 Attachment(s)
Quote:
Also, I change the victim > 10 to victim > MaxClients after you mentioned it, which makes more sense. |
All times are GMT -4. The time now is 06:57. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.