Jump to content

Get a reference to the actual projectile instance in OnHit event


Recommended Posts

I'm trying to make a system where if you hit an archery target with an arrow or bolt, it will "return" the item to your inventory (i.e.: delete the item, and add a new instance to the player).

With OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile...) I can't figure out how to use the value for akProjectile to get a reference to the actual arrow or bolt instance that struck the target.

FormList Property ammoList Auto
Actor Property playerRef Auto

Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
if (akProjectile == None)
	return
endIf

if (ammoList.HasForm(akProjectile))
	playerRef.AddItem(akProjectile, 1)
	ObjectReference ammoRef = ; ??
	ammoRef.DisableNoWait()
	ammoRef.Delete()
endIf

Endevent

Can someone tell me how to go about getting the projectile instance reference, or perhaps another approach if this isn't going to work?

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...