Talk:SetPlayerProjectile

From The Elder Scrolls Construction Set Wiki

This is an incredibly useful function, but actually getting a reference to a projectile is not explained in the OBSE documentation. The most common use of this is probably going to be catching a scripted effect shot by a hidden activator - here's an example of how to do it:

pActivator.Cast MySpell pTarget; (cast MySpell from pActivator at pTarget)
ref pProjectile
set pProjectile to GetFirstRef 34
label 4
if (pProjectile != 0)
	if (pProjectile.GetProjectileSource == pActivator)
		pProjectile.SetPlayerProjectile
	endif
	set pProjectile to GetNextRef
	goto 4
endif

The shot will be caught instantly and will be treated just like the player fired it. That also means that the player will get the skill increase from the shot hitting a target, which may not be desirable. --Khrabanas 03:00, 23 August 2008 (EDT)

I've made a template based on this example and added it to all of the projectile function articles.--Haama 11:28, 23 August 2008 (EDT)