Difference between revisions of "OnHit - ObjectReference"
Jump to navigation
Jump to search
imported>Sagitarius22 (→Notes) |
imported>Jonwd7 m ("akWeapon" is how "akSource" is most commonly referred in the vanilla scripts.) |
||
Line 35: | Line 35: | ||
**akProjectile can be None if hit by a melee attack. | **akProjectile can be None if hit by a melee attack. | ||
*This reference is ''not'' an [[Actor Script|Actor]]: | *This reference is ''not'' an [[Actor Script|Actor]]: | ||
** | **akSource can be None if hit by a projectile attack where the projectile was not fired by a weapon (for example, a magic spell with a projectile component). | ||
**akProjectile can be None if hit by a melee attack. | **akProjectile can be None if hit by a melee attack. | ||
Also, if this reference is an [[Actor Script|Actor]] and the projectile was caused by a weapon enchant, the enchanted weapon will be in | Also, if this reference is an [[Actor Script|Actor]] and the projectile was caused by a weapon enchant, the enchanted weapon will be in akSource. | ||
== See Also == | == See Also == | ||
*[[ObjectReference Script]] | *[[ObjectReference Script]] |
Revision as of 23:23, 29 August 2012
Member of: ObjectReference Script
Event called when the object reference is hit by a weapon or projectile.
Syntax
Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, \
bool abBashAttack, bool abHitBlocked)
Parameters
- akAggressor: The ObjectReference that attacked this reference.
- akSource: The Weapon, Spell, Explosion, Ingredient, Potion, or Enchantment that hit this reference.
- akProjectile: The Projectile that hit this reference.
- abPowerAttack: Was the hit caused by a power attack?
- abSneakAttack: Was the hit caused by a sneak attack?
- abBashAttack: Was the hit caused by a bash attack?
- abHitBlocked: Was the hit blocked?
Examples
Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, \
bool abBashAttack, bool abHitBlocked)
Debug.Trace("We were hit by " + akAggressor)
EndEvent
Notes
akSource and akProjectile can be None under various circumstances:
- This reference is an Actor:
- akSource can be None if hit by a projectile attack where the projectile was not fired by a weapon or spell
- akProjectile can be None if hit by a melee attack.
- This reference is not an Actor:
- akSource can be None if hit by a projectile attack where the projectile was not fired by a weapon (for example, a magic spell with a projectile component).
- akProjectile can be None if hit by a melee attack.
Also, if this reference is an Actor and the projectile was caused by a weapon enchant, the enchanted weapon will be in akSource.