Background for Skyrim SE
Member of the ObjectReference script
eventOnTrapHit(ObjectReferenceakTarget, floatafXVel, floatafYVel, floatafZVel, floatafXPos, floatafYPos, floatafZPos, intaeMaterial, boolabInitialHit, intaeMotionType)

Description

Wiki Description

Event called when the object reference is a trap and has hit a live target. This event is sent every so often as long as a trap object is in contact with a live target.

Documentation Comment

Event recieved when this reference hits a target


Caveats

CK Wiki - Notes

This event can be sent quite rapidly, so be careful how you use it so you don't overstress the script system.


Parameters

  1. ObjectReferenceakTarget

    CK Wiki Description

    The ObjectReference that this reference just hit.

  2. floatafXVel

    CK Wiki Description

    The X velocity for our reference when it hit.

  3. floatafYVel

    CK Wiki Description

    The Y velocity for our reference when it hit.

  4. floatafZVel

    CK Wiki Description

    The Z velocity for our reference when it hit.

  5. floatafXPos

    CK Wiki Description

    The X position of our reference when it hit.

  6. floatafYPos

    CK Wiki Description

    The Y position of our reference when it hit.

  7. floatafZPos

    CK Wiki Description

    The Z position of our reference when it hit.

  8. intaeMaterial

    CK Wiki Description

    Opaque integer value denoting what material the trap is. Not intended to be meaningful to script, just to be passed to other native functions that may use it.

  9. boolabInitialHit

    CK Wiki Description

    True if this is the first time the trap has hit the target.

  10. intaeMotionType

    CK Wiki Description

    The motion type for the trap.

    • Note: Currently there are several read-only properties in the ObjectReference source file that match this, but it will later be changed to an enum and the possible list of values reduced to something more meaningful.

Examples

Event OnTrapHit(ObjectReference akTarget, float afXVel, float afYVel, float afZVel, float afXPos, float afYPos, \
  float afZPos, int aeMaterial, bool abInitialHit, int aeMotionType)
  ; Pass it on to the game trap system with a bit of damage
  akTarget.ProcessTrapHit(self, 10.0, 0.0, afXVel, afYVel, afZVel, afXPos, afYPos, afZPos, aeMaterial, 0.0)
EndEvent

Auto-Generated Example

Scriptname MyCoolScript extends ObjectReference

event OnTrapHit(ObjectReference akTarget, float afXVel, float afYVel, float afZVel, float afXPos, float afYPos, float afZPos, int aeMaterial, bool abInitialHit, int aeMotionType)
    Debug.trace("Event received - OnTrapHit: akTarget = " + akTarget + " afXVel = " + afXVel + " afYVel = " + afYVel + " afZVel = " + afZVel + " afXPos = " + afXPos + " afYPos = " + afYPos + " afZPos = " + afZPos + " aeMaterial = " + aeMaterial + " abInitialHit = " + abInitialHit + " aeMotionType = " + aeMotionType)
endEvent

Related Pages


Additional References

View this event’s page on the Skyrim Creation Kit Wiki

Some data provided by the Skyrim Creation Kit Wiki. Licensed under the Creative Commons Attribution-ShareAlike license.