Talk:SetPlayerProjectile

From the Oblivion ConstructionSet Wiki
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, 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)

I have found a bug. If target dies from a scripted is hit by spell that has been shot from an activator and changed to player projectile all actors that use ranged spells will stop using them for the rest of game session, instead they will just try to summon creatures and attack with melee attacks when approached close enough. It only happens when script is responsible for death. First I tought it is related to script but then I tested some more and it appear to happen even with normal effects and is not related to death. I have hard time to nail down the exact cause as it doesn't seem to happen after first cast. I am doing more testing right now and it appear to happen when casting from activator few times in a row with short time between casts and setting to player spell each time. I'll keep you updated if I find out more.

I'd also like to add that if you want to avoid getting skillup set type to lesser power. Mitchalek 16:03, 6 October 2011 (EDT)

Interesting stuff; that's a serious bug, if true. If you can really nail down how that happens, that would be great.
Dragoon Wraith TALK 18:17, 6 October 2011 (EDT)
I think I nailed it finally. I made script for testing where I can push button and activator will shoot at nearby actor, all that while having summoned fire atronach at my side and use it as a reference to see when it stop shooting fireballs at the enemy. You'd never guess how weird this bug is so here are my results... You can only change projectile source on 5 projectiles, 6th projectile will always cause the bug. I tried with all kind of delays between the casts and that's no matter. Even loading the game doesn't help it nor it resets the counter, 6 is a definite number for the whle game session. I really can't understand what exactly is causing this and how to avoid it and I would ask someone else to test it also just to make sure I'm correct and it is not specific to my mod environment. With my findings one will know what to do and what to look for. What I didn't test is using different spells or shooting from different activators to see if it add to the same counter. Mitchalek 20:10, 6 October 2011 (EDT)
Whoa. That is... bizarre. Perhaps not the most bizarre bug Oblivion has, but definitely up there. I think it's time to mention it on the Forums; perhaps you can upload your test plugin somewhere (I can't remember if the Wiki allows that; I'm thinking that it doesn't)?
Great tests, though; it's appreciated.
Dragoon Wraith TALK 17:03, 8 October 2011 (EDT)
Ok I uploaded that test plugin to mediafire you can get it from http://www.mediafire.com/?oxz64dmni3f0vq2 . When you run the game with plugin enabled messagebox should give you insight in what to do. Basically you just press enter and script will bring 2 activators to player location and shoot spell from one to another. You must wait 5 seconds between each shot and console + game message will count source change for the current game session. Also it adds summon fire attronach lesser power for 5 min which can then be used as a reference to see when it stop using fire spells. Happy testing ;) Mitchalek 07:44, 11 October 2011 (EDT)