Get reference to spells impact location

Post » Mon Jun 18, 2012 8:06 am

Does anyone know how to do this in papyrus?

Edit:

Right now, ive got a spell, that creates an explosion, the explosion places an item.. the item lands right where the spell impacts so thats working, but I cant get a reference to the spawned item to move my player there.

What I have so far:
Scriptname ConjureSelfScript extends ObjectReference{Used in the ConjureSelf Spell Mod}ObjectReference playerForm targetobjectReference targetRef;VFXActivator property SummonFX AutoeffectShader property fadeOutFX autoeffectShader property fadeInFX autovisualEffect property TrailFX auto;{Let's try some trailing FX to show where I'm going to pop out}Function MoveTo(ObjectReference akTarget, float afXOffset = 0.0, \  float afYOffset = 0.0, float afZOffset = 0.0, bool abMatchRotation = true) native Function RegisterForSingleLOSGain(Actor akViewer, ObjectReference akTarget) NativeFunction SomeFunction()  RegisterForSingleLOSGain(Game.GetPlayer(), targetRef) ; Before we can use OnGainLOS we must register.EndFunctionEvent OnInit()SomeFunction()endEventEvent OnGainLOS(Actor akViewer, ObjectReference akTarget)player = game.getPlayer()target = akTargettargetRef = (target as ObjectReference);Perform the teleportfadeOutFX.play(player);player.setGhost(TRUE)objectReference previousLoc = targetRef.PlaceAtMe(SummonFX)Utility.Wait(0.2)TrailFX.Play(previousLoc, 0.5, targetRef)player.MoveTo(targetRef, 0, 0, 0, false)targetRef.PlaceAtMe(SummonFX)Utility.Wait(0.2)fadeOutFX.stop(player);player.setGhost(FALSE)targetRef.Delete()endEvent
User avatar
Robert Bindley
 
Posts: 3474
Joined: Fri Aug 03, 2007 5:31 pm

Post » Mon Jun 18, 2012 6:08 am

If I understand what you want correctly, you could try added an explosion to the spell's projectile, and attach a script to a "Placed Item" (I think that's what it's called) in order to get a script on a reference at the location where the spell impacted.

Cipscis
User avatar
Louise Dennis
 
Posts: 3489
Joined: Fri Mar 02, 2007 9:23 pm

Post » Mon Jun 18, 2012 1:37 am

Im new to scripting in skyrim, but I've been programming as a hobby for a while now... after setting the spells 'explosion' property what would I need to do code side in order to grab its location? The wiki is frustrating beyond beliefffff.
Event OnEffectStart(Actor akTarget, Actor akCaster)player = game.getPlayer()target = akTargettargetRef = (target as ObjectReference);Perform the teleportfadeOutFX.play(player);player.setGhost(TRUE)objectReference previousLoc = targetRef.PlaceAtMe(SummonFX)Utility.Wait(0.2)TrailFX.Play(previousLoc, 0.5, targetRef)player.MoveTo(targetRef, 0, 0, 0, false)targetRef.PlaceAtMe(SummonFX)Utility.Wait(0.2)fadeOutFX.stop(player);player.setGhost(FALSE)endEvent

Thats a snippet of my current code if that would help.
User avatar
Vera Maslar
 
Posts: 3468
Joined: Wed Sep 27, 2006 2:32 pm

Post » Sun Jun 17, 2012 5:34 pm

You wouldn't use the explosion directly, you'd use a "Placed Object" or "Placed Item" or whatever it's called. This causes a reference to be created at the origin of the explosion, and that reference won't disappear very quickly like the explosion will, so you can use it to run a script that does something at the location, then delete it manually.

Cipscis
User avatar
Abel Vazquez
 
Posts: 3334
Joined: Tue Aug 14, 2007 12:25 am

Post » Sun Jun 17, 2012 7:59 pm

Sorry if this sounds silly but how would I go about placing the item once my spell impacts at a location?
IE Is there an event I should be using? Something like OnSpellImpact()... because the event I have registered right now only fires when I hit an actor.
Btw, I really appreciate the help :smile: Do you use google talk or anything similar?

Edit: Okay I did just notice that I can create an explosion in the CK. So thats what Im doing now.
User avatar
Emma louise Wendelk
 
Posts: 3385
Joined: Sat Dec 09, 2006 9:31 pm

Post » Mon Jun 18, 2012 8:11 am

The game engine should place a reference directly, without needing any extra scripting just for this, if you set one up in the Explosion dialogue box. Otherwise, like you mentioned, the usual spell effects are only applied if the spell hits an actor.

I do have Google Talk, although generally I don't use it for this sort of thing. If you join this group on Steam, others will be able to help you and I'll be on the chat usually when I'm using the Creation Kit, but I won't be there now or for the next few hours at least - http://steamcommunity.com/groups/SkyrimCKPublic

Cipscis
User avatar
Arrogant SId
 
Posts: 3366
Joined: Sat May 19, 2007 11:39 am

Post » Mon Jun 18, 2012 12:09 am

So far I have the explosion spawning the object, but no teleporting :[
How would I get a reference to the helmet that gets placed by the explosion?
User avatar
Dean Brown
 
Posts: 3472
Joined: Fri Aug 31, 2007 10:17 pm

Post » Sun Jun 17, 2012 5:14 pm

If you're making a teleportation spell, one way to do it would be to attach a script to the helmet or whatever it is you're spawning, and have that script move the player to the helmet's location via moveto, then delete the helmet.
User avatar
michael danso
 
Posts: 3492
Joined: Wed Jun 13, 2007 9:21 am

Post » Mon Jun 18, 2012 1:05 am

I've got the Creation Kit open now, so I can check stuff myself. You'll want to create a new object (I'd copy one of the marker objects if I were you) and select that under the "Placed Object" drop down box for your explosion. Then, attach a script to your marker that does what you need, probably in an http://www.creationkit.com/OnInit event.

Cipscis
User avatar
Jeremy Kenney
 
Posts: 3293
Joined: Sun Aug 05, 2007 5:36 pm


Return to V - Skyrim