Addon Details

Watch - Add Favorite


Does this version work for you?
1
w00ts
w00t!2

Damage Library - Version 1.1

posted on 2008-01-17 06:40:05
by 7355608

Requires:


Description

This is a library I wrote to handle the full capabilities of point_hurt. Since this uses es_tools anyways, I also added custom death events made easy! This file goes in your ../addons/eventscripts/_libs/python/ folder and is used the same as other libraries. By default the custom death events are on, you can easily change that if you wish, or run this command to disable it on load: dmg.death_events(0) To use the custom events, just follow the example below. dmg_death_fired will return 0 for the event that is blocked or 1 for the custom event. This is kind of important, since you don't usually want to do the same thing twice everytime. Methods: hurt(victim,damage=1,type=2,weapon='point_hurt',interval=0.0,delay=0.0,radius=0,ff=0) when friendly fire is set to 0 it will make the entity deal team specific damage. This one covers pretty much everything, I have added these next ones which are just wrappers for this command. The weapon name should be 1 word!!! So for multiple words follow my example. This is for instant 1-hitters. point(victim,damage=1,type=2,weapon='point_hurt',ff=1) This is for repeating damage (poison) repeat(victim,damage=1,type=2,weapon='point_hurt',interval=0.0,delay=0.0,ff=0) This is for radius damage ** you cannot get credit from kills made by this! These always show up as suicide kills. radius(damage=1,type=2,weapon='point_hurt',interval=0.0,delay=0.0,radius=0,ff=0) This is for adding more deaths to the death event queue. I don't really advise using it. It's mostly for internal use. store(victim,attacker=0,weapon='point_hurt',headshot=0) This is for creating an instance. get(userid) This is for changing event hooking on/off. death_events(flag=0) This is checking wether this is the blocked event or fired event. Rerturns 1 for fired. dmg_death_fired(userid) This is for hooking/firing death events. dmg_player_death(event_var) example usage: import es import dmg def load(): dmg.death_events(1) def player_hurt(event_var): dmg.get(int(event_var['attacker'])).point(int(event_var['userid']),100,2,'Uber_Gunz0r') def player_death(event_var): #if you're using the events these 2 commands must be called! If you don't call them it will break. dmg.dmg_player_death(event_var) fired = dmg.dmg_death_fired(event_var['userid']) es.msg('#green','event fired: ' + str(fired)) In this example anytime you damage someone it will deal 100 dmg extra, and show up as a kill by "Uber_Gunz0r"

Version Notes For 1.1

Updated on: 2008-01-20 11:21:16 EST by 7355608
Updated the internal death event queueing system, now requires no delays, and never seems to fail.

( Previous Versions )