Raised This Month: $12 Target: $400
 3% 

[TF2] halloween_skeleton_killed Event Not Firing?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Cryotheum
Junior Member
Join Date: Mar 2017
Location: Earth
Old 11-27-2019 , 04:27   [TF2] halloween_skeleton_killed Event Not Firing?
Reply With Quote #1

I am trying to make a PVE gamemode and I wanted to use skeletons (tf_zombie) as the enemies. One necessary step, is rewarding players for killing the skeletons but the only event I found that had any relation was halloween_skeleton_killed. When I tired to use it, I noticed it never fired. I had spawned in the skeleton using ent_create and thought that might have something to do with it. So I went to the map plr_hightower_event to see if the skeletons spawned on that map would cause the event to fire; and it did not. So, I tried searching for other events and found npc_hurt but that did not affect skeletons only the halloween bosses. I wanted to make sure the event was getting hooked, so I used HookEventEx to check, and it is. I've attached the code below and if anyone knows anything about why this is happening, please shed some light. Thanks.
Attached Files
File Type: sp Get Plugin or Get Source (nzombies.sp - 166 views - 1.2 KB)

Last edited by Cryotheum; 11-27-2019 at 04:57.
Cryotheum is offline
PC Gamer
Veteran Member
Join Date: Mar 2014
Old 11-29-2019 , 00:44   Re: [TF2] halloween_skeleton_killed Event Not Firing?
Reply With Quote #2

I couldn't get it to fire either using the code below. I was on koth_lakeside_event, spawned all bosses and skeletons using bossspawns.

Hook Events not working: "halloween_skeleton_killed" and "halloween_boss_killed"
Hook Event working: "escaped_loot_island"

PHP Code:
#pragma semicolon 1

public Plugin:myinfo = {
    
name         "Test of Skeleton Death",
    
author         "PC Gamer",
    
description "Tests the firing of events",
    
version     "1.0",
    
url         "http://www.sourcemod.net"
};

public 
OnPluginStart()
{
    
HookEvent("halloween_skeleton_killed"OnSkeletonDeathEventHookMode_Post);
    
HookEvent("halloween_boss_killed"OnBossDeathEventHookMode_Post);
    
HookEvent("escaped_loot_island"OnEscapeIslandEventHookMode_Post);        
}

public 
OnMapEnd()
{
    
UnhookEvent("halloween_skeleton_killed"OnSkeletonDeath);
    
UnhookEvent("halloween_boss_killed"OnBossDeath);
    
UnhookEvent("escaped_loot_island"OnEscapeIsland);    
}

public 
Action:OnSkeletonDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event,"player"));
    
PrintToChatAll("Event Fired: halloween_skeleton_killed");
    
PrintToChatAll("Event Notice: Skeleton was killed by %N"client);
    
PrintToServer("Event Notice: Skeleton was killed by %N"client);    
}


public 
Action:OnBossDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event,"killer"));
    
int bosstype GetEventInt(event,"boss");
    
PrintToChatAll("Event Fired: halloween_boss_killed");    
    
PrintToChatAll("Event Notice: Boss Type: %i was killed by %N"bosstypeclient);
    
PrintToServer("Event Notice: Boss Type: %i was killed by %N"bosstype,client);    
}

public 
Action:OnEscapeIsland(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event,"player"));
    
PrintToChatAll("Event Fired: escaped_loot_island");    
    
PrintToChatAll("Event Notice: %N Escaped Loot Island"client);
    
PrintToServer("Event Notice: %N Escaped Loot Island"client);    

PC Gamer is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 12-03-2019 , 10:38   Re: [TF2] halloween_skeleton_killed Event Not Firing?
Reply With Quote #3

I think I had this issue also back in like 2014. Event didn't fire so I had to use SDKHooks OnTakeDamage and just do some quick math of the damage the skeleton was taking and it's current HP to determine who the killer was. OnEntityDestroyed() might also give you something also but not as much as just hooking the damage of the skeleton entities after they spawn.
Mitchell is offline
Cryotheum
Junior Member
Join Date: Mar 2017
Location: Earth
Old 12-03-2019 , 11:18   Re: [TF2] halloween_skeleton_killed Event Not Firing?
Reply With Quote #4

Quote:
Originally Posted by Mitchell View Post
I think I had this issue also back in like 2014. Event didn't fire so I had to use SDKHooks OnTakeDamage and just do some quick math of the damage the skeleton was taking and it's current HP to determine who the killer was. OnEntityDestroyed() might also give you something also but not as much as just hooking the damage of the skeleton entities after they spawn.
Yeah, that's how I dealt with the problem but the event would have been perfect as I just needed to know who killed the skeleton. Supposedly I could detour CZombie::Event_Killed but honestly this is much easier.
__________________
Code:
function number isEven(Number:number)
{
	#[Date: Oct 2 2016
	Purpose: Checks if a number is even! ]#
	if (Number==2) {return 1}
	if (Number==4) {return 1}
	if (Number==6) {return 1}
	if (Number==8) {return 1}
	...
Cryotheum is offline
Reply


Thread Tools
Display Modes

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 04:13.


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