-
Notifications
You must be signed in to change notification settings - Fork 0
Event Handlers
Eric Tsai edited this page Jul 25, 2013
·
4 revisions
The AchievementPack class provides handlers for several events in the game. These events are separated into player and game events.
- Match has started (provided by Actor class)
- Match has ended
- Wave has started
- Wave has ended
- Player has died
- Player killed a specimen
- Player damaged a specimen
- Picked up an item
- Hit with a heal dart
- Reloaded current weapon
- Tossed a grenade
- Fired a weapon
- Dropped a weapon
- Objective changed
- Player is damaged
When one of these events are triggered, the respective handlers are called. The game related events will call all handlers, however, the player events will only call the handlers belonging to that player. For example, if player A shoots a specimen, only his event handlers will be called. The other players will not be notified that player A damaged an enemy. Below is the documentation for the event handlers:
/**
* Called when the match is over. The parameters are filled with values pulled from KFGameType
* @param mapname Name of the map
* @param difficulty Difficulty level of the match (7 - HoE, 5 - Suicidal, 4 - Hard, 2 - Normal, 1 - Beginner)
* @param length Length of the game, defined by the constants in KFGameType to check what the length is
* @param waveNum Current wave number
*/
event matchEnd(string mapname, float difficulty, int length, byte result, int waveNum);
/**
* Called when the next wave has begun
* @param waveNum Numerical value of the wave that is starting
*/
event waveStart(int waveNum);
/**
* Called when the current wave has ended
* @param waveNum Numerical value of the wave that just ended
*/
event waveEnd(int waveNum);
/**
* Called when the owner has died
* @param killer Controller of the pawn that killed the owner
* @param damageType Damage type of the killing blow
* @param waveNum Wave number the owner died on
*/
event playerDied(Controller killer, class<DamageType> damageType, int waveNum);
/**
* Called when the owner kills a monster
* @param target The monster that the owner killed
* @param damageType Damage type of the killing blow
* @param headshot True if the killing blow was a head shot
*/
event killedMonster(Pawn target, class<DamageType> damageType, bool headshot);
/**
* Called when the owner damages a monster
* @param damage Amount of damage dealt
* @param target The monster that the owner damaged
* @param damageType Damage type of the blow
* @param headshot True if the blow was a head shot
*/
event damagedMonster(int damage, Pawn target, class<DamageType> damageType, bool headshot);
/**
* Called when the owner picks up an item from the ground
* @param item Item actor that was picked up
*/
event pickedUpItem(Pickup item);
/**
* Called when the owner has touched a heal dart
* @param healDart Heal dart projectile that hit the owner
*/
event touchedHealDart(HealingProjectile healDart);
/**
* Called when the owner has reloaded his current weapon
* @param weapon Weapon that is reloading
*/
event reloadedWeapon(KFWeapon weapon);
/**
* Called when the owner has tossed a frag
* @param fragType Class of the frag the owner tossed
*/
event tossedFrag(class<Grenade> fragType);
/**
* Called when the owner has fired his weapon. This only only called when
* the owner has pressed fire, not each time his weapon fires (i.e. bullpup full auto)
* @param weapon Weapon the owner started firing
*/
event firedWeapon(KFWeapon weapon);
/**
* Player has dropped a weapon from his inventory
* @param weaponPickup Pickup object of the weapon that was dropped
*/
event droppedWeapon(KFWeaponPickup weaponPickup);
/**
* Called when the objective has changed. This is also called for "objectives" that only have
* narrations being played.
* @param newObjective The objective that story mode has switched to
*/
event objectiveChanged(KF_StoryObjective newObjective);
/**
* Player has taken damage
* @param damage Damage inflicted onto the player
* @param instigator The pawn that hurt the player
* @param damageType Damage type of the blow
*/
event playerDamaged(int damage, Pawn instigator, class<DamageType> damageType);