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

[INFO] TFC PrecacheEvent/PlaybackEvent Index and Name List


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DynamicBits
Senior Member
Join Date: Sep 2007
Location: US
Old 08-09-2013 , 17:45   [INFO] TFC PrecacheEvent/PlaybackEvent Index and Name List
Reply With Quote #1

This is a list of event names and indexes used with the PrecacheEvent and PlaybackEvent forwards in Team Fortress Classic. I ultimately didn't end up using any of this in the plugin I was coding, but I figured someone else might find this information helpful.

In theory the event IDs could change, and you should get them programatically in plugin_precache().

Code:
#    Event Name				Comment
 1 = events/wpn/tf_sg.sc		Single-Barrel Shotgun (Scout, Soldier, Pyro, Demoman, Heavy Weapons Guy, Medic)
 2 = events/wpn/tf_sgreload.sc		Both shotguns reload
 3 = events/wpn/tf_sgpump.sc		Both shotguns pump
 4 = events/wpn/tf_axe.sc		Knife (Spy), Medkit (Medic), Umbrella (Civilian)
 5 = events/wpn/tf_axedecal.sc		??
 6 = events/wpn/tf_knife.sc		?? (Spy)
 7 = events/wpn/tf_mednormal.sc		?? (Medic)
 8 = events/wpn/tf_medsuper.sc		?? (Medic)
 9 = events/wpn/tf_medsteam.sc		?? (Medic)
10 = events/wpn/tf_nail.sc		Nailgun (Spy, Sniper, Scout)
11 = events/wpn/tf_snail.sc		Super Nailgun (Medic)
12 = events/wpn/tf_rpg.sc		Rocket Launcher (Soldier)
13 = events/wpn/tf_ic.sc		Incendiary Cannon (Pyro)
14 = events/wpn/tf_flame.sc		Flamethrower (Pyro)
15 = events/wpn/tf_tranq.sc		Tranquilizer Gun (Spy)
16 = events/wpn/tf_sniper.sc		Sniper Rifle laser on (Sniper)
17 = events/wpn/tf_sniperhit.sc		Sniper Rifle laser off/fire (Sniper)
18 = events/wpn/tf_ar.sc		Automatic Rifle (Sniper)
19 = events/wpn/tf_rail.sc		Railgun (Engineer)
20 = events/wpn/tf_acwu.sc		Assault Cannon spin up (Heavy Weapons Guy)
21 = events/wpn/tf_acwd.sc		Assault Cannon spin down (Heavy Weapons Guy)
22 = events/wpn/tf_acfire.sc		Assault Cannon fire 1 round (Heavy Weapons Guy)
23 = events/wpn/tf_acsspin.sc		Assault Cannon out of ammo (Heavy Weapons Guy)
24 = events/wpn/tf_acspin.sc		Assault Cannon spin (no ammo) (Heavy Weapons Guy)
25 = events/wpn/tf_acstart.sc		Assault Cannon start shooting (Heavy Weapons Guy)
26 = events/wpn/tf_gl.sc		Grenade Launcher (Demoman)
27 = events/wpn/tf_pipel.sc		Pipebomb Launcher (Demoman)
28 = events/wpn/tf_ssg.sc		Double-Barrel Shotgun (Soldier, Heavy Weapons Guy, Medic, Engineer, Spy)
29 = events/misc/tf_buildingevent.sc	Build/dismantle/detonate (Engineer)
30 = events/explode/tf_concuss.sc	Concussion Grenade (Scout, Medic)
31 = events/explode/tf_emp.sc		EMP Grenade (Engineer)
32 = events/explode/tf_pipe.sc		Pipebomb Launcher detonation (Demoman)
33 = events/explode/tf_gren.sc		Grenade Launcher detonation (Demoman)
34 = events/explode/tf_engrgren.sc	??
35 = events/explode/tf_normalgren.sc	Hand grenade (All except Scout/Civilian)
36 = events/explode/tf_mirvmain.sc	MIRV grenade initial explosion (Heavy Weapons Guy, Demoman)
37 = events/explode/tf_mirv.sc		MIRV grenade little explosions (Heavy Weapons Guy, Demoman)
38 = events/explode/tf_fire.sc		Napalm Grenade initial explosion (Pyro)
39 = events/explode/tf_burn.sc		Napalm Grenade fire (Pyro)
40 = events/explode/tf_gas.sc		Halucination Grenade (Spy)
41 = events/explode/tf_nailgren.sc	Nail Grenade (Soldier) 1 round of nails
42 = events/explode/tf_ng.sc		Nail Grenade (Soldier) terminating blast
43 = events/misc/gibs.sc		??
44 = events/door/doorgoup.sc		Door/gate/lift opening
45 = events/door/doorgodown.sc		Door/gate/lift closing
46 = events/door/doorhittop.sc		Door/gate/lift fully open
47 = events/door/doorhitbottom.sc	Door/gate/lift fully closed

Here's some sample code for logging the events and blocking a specific one:
PHP Code:
#include <amxmodx>
#include <fakemeta>

public plugin_init() {
    
register_forward(FM_PlaybackEvent"fw_playbackevent_pre"0);
}

public 
plugin_precache() {
    
register_forward(FM_PrecacheEvent"fw_precacheevent_post"1);
}

public 
fw_playbackevent_pre(flagsinvokereventindexdelayFloat:origin[3], Float:angles[3], Float:fparam1Float:fparam2iparam1iparam2bparam1bparam2) {
    if (
eventindex != 35) {    // If it isn't the hand grenade event, ignore it
        
return FMRES_IGNORED;
    }

    
log_amx("Grenade explosion blocked.");
    return 
FMRES_SUPERCEDE;    // This blocks the visual/sound effects, but not the actual damage
}

public 
fw_precacheevent_post(type, const event_name[]) {
    
log_amx("fw_precacheevent_post: event_name(%s) eventindex(%d)"event_nameget_orig_retval());
    return 
FMRES_IGNORED;


See also this post by VEN which demonstrates how to programmatically get the index (event ID) when you know the event/script name.

If anyone can provide more details on #5-9, 34, or 43, (or knows if there are any above 47,) please reply and I'll update this post.


--
Andy

Last edited by DynamicBits; 08-10-2013 at 13:47.
DynamicBits is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-10-2013 , 08:05   Re: [INFO] TFC PrecacheEvent/PlaybackEvent Index and Name List
Reply With Quote #2

Number is not reliable because it is allocated from the order events are precache, and as some events are precache when entities are spawned, it depends on map.

Code:
events/wpn/tf_sg.sc			1
events/wpn/tf_sgreload.sc		2
events/wpn/tf_sgpump.sc			3
events/wpn/tf_axe.sc			4
events/wpn/tf_axedecal.sc		5
events/wpn/tf_knife.sc			6
events/wpn/tf_mednormal.sc		7
events/wpn/tf_medsuper.sc		8
events/wpn/tf_medsteam.sc		9
events/wpn/tf_nail.sc			10
events/wpn/tf_snail.sc			11
events/wpn/tf_rpg.sc			12
events/wpn/tf_ic.sc			13
events/wpn/tf_flame.sc			14
events/wpn/tf_tranq.sc			15
events/wpn/tf_sniper.sc			16
events/wpn/tf_sniperhit.sc		17
events/wpn/tf_ar.sc			18
events/wpn/tf_rail.sc			19
events/wpn/tf_acwu.sc			20
events/wpn/tf_acwd.sc			21
events/wpn/tf_acfire.sc			22
events/wpn/tf_acsspin.sc		23
events/wpn/tf_acspin.sc			24
events/wpn/tf_acstart.sc		25
events/wpn/tf_gl.sc			26
events/wpn/tf_pipel.sc			27
events/wpn/tf_ssg.sc			28
events/misc/tf_buildingevent.sc		29
events/explode/tf_concuss.sc		30
events/explode/tf_emp.sc		31
events/explode/tf_pipe.sc		32
events/explode/tf_gren.sc		33
events/explode/tf_engrgren.sc		34
events/explode/tf_normalgren.sc		35
events/explode/tf_mirvmain.sc		36
events/explode/tf_mirv.sc		37
events/explode/tf_fire.sc		38
events/explode/tf_burn.sc		39
events/explode/tf_gas.sc		40
events/explode/tf_nailgren.sc		41
events/explode/tf_ng.sc			42
events/misc/gibs.sc			43
events/door/doorgoup.sc			44
events/door/doorgodown.sc		45
events/door/doorhittop.sc		46
events/door/doorhitbottom.sc		47
Regarding to events/ folder content, seems that misc/benchmark.sc is missing.
Either it is something for developpers, either it is not used on the map i launched to log events.
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 08-10-2013 at 09:15.
ConnorMcLeod is offline
DynamicBits
Senior Member
Join Date: Sep 2007
Location: US
Old 08-10-2013 , 13:52   Re: [INFO] TFC PrecacheEvent/PlaybackEvent Index and Name List
Reply With Quote #3

Quote:
Originally Posted by ConnorMcLeod View Post
Number is not reliable because it is allocated from the order events are precache, and as some events are precache when entities are spawned, it depends on map.
Ok, thanks for the clarification. I suspected that might be the case, but I didn't witness it myself. I only tested on a couple of official maps.


--
Andy
DynamicBits is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-10-2013 , 16:39   Re: [INFO] TFC PrecacheEvent/PlaybackEvent Index and Name List
Reply With Quote #4

On cs, you can send all precache_event at plugin_init instead of hooking the fonction from plugin_precache to plugin_init.
When i have tested this, server crashed at firs EngFunc_PrecacheEvent call.


Maybe you gonna have more chance than me :
Spoiler
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 08-10-2013 at 16:41.
ConnorMcLeod is offline
DynamicBits
Senior Member
Join Date: Sep 2007
Location: US
Old 08-10-2013 , 17:13   Re: [INFO] TFC PrecacheEvent/PlaybackEvent Index and Name List
Reply With Quote #5

Quote:
Originally Posted by ConnorMcLeod View Post
On cs, you can send all precache_event at plugin_init instead of hooking the fonction from plugin_precache to plugin_init.
When i have tested this, server crashed at firs EngFunc_PrecacheEvent call.
VEN says that precaching the standard events can desynchronize the server and client and cause issues which is probably what you're seeing. His code sample gets the event ID and then unregisters the FM_PrecacheEvent forward, so it shouldn't have any impact on server performance from that point on.

I didn't actually test manually precaching the events because I've realized that none of this is needed in the plugin I am working on.


--
Andy
DynamicBits is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-11-2013 , 02:20   Re: [INFO] TFC PrecacheEvent/PlaybackEvent Index and Name List
Reply With Quote #6

I'm doing this at plugin_init, so events have already been precached and indexes are not changed.
What he said was if you precache events at plugin_precache, so before the game has precached them.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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 04:30.


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