Talk:SetPlayerProjectile

From the Oblivion ConstructionSet Wiki
Revision as of 03:00, 23 August 2008 by imported>Khrabanas (Example of use)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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. One way to stop this is to use "SetSkillUseIncrement 0 destruction 2" (replacing destruction for the school attached) - just be sure to save it and restore it with GetSkillUseIncrement afterwards. --Khrabanas 03:00, 23 August 2008 (EDT)