How do you register a script to follow an event?

Post » Mon Jun 18, 2012 2:38 pm

I'm still working on my earlier problem, and what I think I need to do now is register one script to follow the OnSpellCast event for the other spell, and just get the data all in one script.

But looking through the information on Events in the Papyrus pages, there is no example of how to tell a script to monitor a particular event. Here is my current script:

Spoiler
Scriptname PlayerTeleportSpellScript extends activemagiceffect  {Keeps track of the location of the current teleport node and moves the player there when teleport is cast.}import gameimport utilityObjectReference playerObjectReference TeleportHereEvent OnSpellCast(form IncomingSpell)Debug.MessageBox("Spell Cast Detected: " + IncomingSpell)	Spell ThisSpell = IncomingSpell as spell	if ThisSpell && ThisSpell == TeleportLaunch		Utility.Wait(0.25) ; Make sure the projectile has been fired!		ObjectReference ThisIsIt = FindClosestReferenceOfTypeFromRef(MagicLightTeleportSpell,Game.Getplayer(),5000)		TeleportHere = ThisIsIt		Debug.MessageBox("Launch spell detected, looking for Node. Node Assigned: " + TeleportHere)	endifEndEventEvent OnEffectStart(Actor Target, Actor Caster) ; No real target, and the caster is the player, since it's a player-only spell	player = (game.getPlayer() as ObjectReference)	if TeleportHereDebug.MessageBox("Teleport Node: " + TeleportHere)		Utility.Wait(0.5)		player.MoveTo(TeleportHere)			TeleportHere.Delete() ; Make sure node goes poof.		TeleportHere = FindClosestReferenceOfTypeFromRef(MagicLightTeleportSpell,Game.Getplayer(),10000000)		while TeleportHere ; Now to get rid of any extras that may or may not be floating around somewhere in the cell.			TeleportHere.Delete()			TeleportHere = FindClosestReferenceOfTypeFromRef(MagicLightTeleportSpell,Game.Getplayer(),10000000)		endwhile	else; Debug.MessageBox("No Teleport Node Assigned!")	endifEndEventLight Property MagicLightTeleportSpell autoSpell Property TeleportLaunch Auto

Now it is never entering the "OnSpellCast" event code, no matter how many spells I cast (Not even the one this effect is actually IN.)
The example they give of the OnSpellCast event in the reference pages...doesn't work. Here it is:

Event OnSpellCast(Form akSpell)   Spell spellCast = akSpell as Spell   if spellCast && spellCast == FireballSpell		  Debug.Trace("We just cast a fireball!")   else		  Debug.Trace("We cast something, but we don't know what it is")   endIfendEvent

Now examples are supposed to show how to do something. An example that doesn't work is not a good example now, is it?

So has anyone with massive telepathic abilities been able to divine how to make a script properly "listen" for an event triggered elsewhere? The script I wrote DOES respond to the OnEventStart event, but only for itself.

Is how to do this hidden on some obscure, not-linked-to event related page in the documentation somewhere?


And no, this isn't a duplicate thread...different issue, different thread.
User avatar
Sandeep Khatkar
 
Posts: 3364
Joined: Wed Jul 18, 2007 11:02 am

Post » Mon Jun 18, 2012 11:46 am

I'm still working on my earlier problem, and what I think I need to do now is register one script to follow the OnSpellCast event for the other spell, and just get the data all in one script.

But looking through the information on Events in the Papyrus pages, there is no example of how to tell a script to monitor a particular event. Here is my current script:

Scriptname PlayerTeleportSpellScript extends activemagiceffect  {Keeps track of the location of the current teleport node and moves the player there when teleport is cast.}import gameimport utilityObjectReference playerObjectReference TeleportHereEvent OnSpellCast(form IncomingSpell)Debug.MessageBox("Spell Cast Detected: " + IncomingSpell)	Spell ThisSpell = IncomingSpell as spell	if ThisSpell && ThisSpell == TeleportLaunch		Utility.Wait(0.25) ; Make sure the projectile has been fired!		ObjectReference ThisIsIt = FindClosestReferenceOfTypeFromRef(MagicLightTeleportSpell,Game.Getplayer(),5000)		TeleportHere = ThisIsIt		Debug.MessageBox("Launch spell detected, looking for Node. Node Assigned: " + TeleportHere)	endifEndEventEvent OnEffectStart(Actor Target, Actor Caster) ; No real target, and the caster is the player, since it's a player-only spell	player = (game.getPlayer() as ObjectReference)	if TeleportHereDebug.MessageBox("Teleport Node: " + TeleportHere)		Utility.Wait(0.5)		player.MoveTo(TeleportHere)			TeleportHere.Delete() ; Make sure node goes poof.		TeleportHere = FindClosestReferenceOfTypeFromRef(MagicLightTeleportSpell,Game.Getplayer(),10000000)		while TeleportHere ; Now to get rid of any extras that may or may not be floating around somewhere in the cell.			TeleportHere.Delete()			TeleportHere = FindClosestReferenceOfTypeFromRef(MagicLightTeleportSpell,Game.Getplayer(),10000000)		endwhile	else; Debug.MessageBox("No Teleport Node Assigned!")	endifEndEventLight Property MagicLightTeleportSpell autoSpell Property TeleportLaunch Auto

Now it is never entering the "OnSpellCast" event code, no matter how many spells I cast (Not even the one this effect is actually IN.)
The example they give of the OnSpellCast event in the reference pages...doesn't work. Here it is:

Event OnSpellCast(Form akSpell)   Spell spellCast = akSpell as Spell   if spellCast && spellCast == FireballSpell		  Debug.Trace("We just cast a fireball!")   else		  Debug.Trace("We cast something, but we don't know what it is")   endIfendEvent

Now examples are supposed to show how to do something. An example that doesn't work is not a good example now, is it?

So has anyone with massive telepathic abilities been able to divine how to make a script properly "listen" for an event triggered elsewhere? The script I wrote DOES respond to the OnEventStart event, but only for itself.

Is how to do this hidden on some obscure, not-linked-to event related page in the documentation somewhere?


And no, this isn't a duplicate thread...different issue, different thread.
OnSpellCast is an event from an ObjectReference script, not useable in an ActiveMagicEffect script. It triggers when the ObjectReference casts a spell, ex: when a weapon with an enchantment strikes someone. Actor scripts extend the ObjectReference script so you can listen for the OnSpellCast event within the player and it'll trigger whenever the player casts a spell

http://www.creationkit.com/OnSpellCast_-_ObjectReference
User avatar
Hairul Hafis
 
Posts: 3516
Joined: Mon Oct 29, 2007 12:22 am

Post » Mon Jun 18, 2012 3:34 pm

OnSpellCast is an event from an ObjectReference script, not useable in an ActiveMagicEffect script. It triggers when the ObjectReference casts a spell, ex: when a weapon with an enchantment strikes someone. Actor scripts extend the ObjectReference script so you can listen for the OnSpellCast event within the player and it'll trigger whenever the player casts a spell

http://www.creationkit.com/OnSpellCast_-_ObjectReference

So you're saying that the same script cannot respond to both an ActivemagicEffect event and an ObjectReference event?

Doesn't that kinda defeat the whole purpose of using events at all? If an event happens, it happens...so there's no "listener" type that could be added to the script to make it function?

The events have to be in the same script, because they both need to access the TeleportHere reference, and you can only make a global reference in a Quest script, and this isn't a quest.

So what I need to do is add the script the the actual player object?
User avatar
Ebony Lawson
 
Posts: 3504
Joined: Fri Feb 16, 2007 11:00 am

Post » Mon Jun 18, 2012 10:19 am

Theonly actor I can find named "player" is the one with the name field of "Prisoner" - is that the base data object?
User avatar
Catherine N
 
Posts: 3407
Joined: Sat Jan 27, 2007 9:58 pm

Post » Mon Jun 18, 2012 11:48 am

You cannot “register” for events like in some other languages (with the exception of a few special events, listed as “RegisterForX” functions in the wiki). However, the ActiveMagicEffect script (which your example script extends) is special in that it receives events from any actors the magic effect is attached to (see the bottom of the http://www.creationkit.com/ActiveMagicEffect_Script#Events on the wiki)

So in your particular case, if your scripted magic effect is attached to a target, then it will receive spell cast events whenever the target casts a spell. If this isn’t happening, you’ll want to make sure that the magic effect is attached to the object you want to listen for spell casts on.
User avatar
April D. F
 
Posts: 3346
Joined: Wed Mar 21, 2007 8:41 pm

Post » Mon Jun 18, 2012 4:02 pm

You cannot “register” for events like in some other languages (with the exception of a few special events, listed as “RegisterForX” functions in the wiki). However, the ActiveMagicEffect script (which your example script extends) is special in that it receives events from any actors the magic effect is attached to (see the bottom of the http://www.creationkit.com/ActiveMagicEffect_Script#Events on the wiki)

So in your particular case, if your scripted magic effect is attached to a target, then it will receive spell cast events whenever the target casts a spell. If this isn’t happening, you’ll want to make sure that the magic effect is attached to the object you want to listen for spell casts on.

They're both being cast by the player...does that make them "attached?" How do you attach an effect to the player then? (Hopefully avoiding actually modifying the player object, since that is probably going to be the object most modified in mods, and is a massive source of potential Denial-of-mod errors...)
User avatar
ZzZz
 
Posts: 3396
Joined: Sat Jul 08, 2006 9:56 pm

Post » Mon Jun 18, 2012 8:20 pm

Hmn...variables are by script, right? so if I put the script in BOTH magic effects, and use the OnEffectStart event, one will update the variable, and the other will use it, and it will still be the same value? Just wonder if that would work...
User avatar
David John Hunter
 
Posts: 3376
Joined: Sun May 13, 2007 8:24 am

Post » Mon Jun 18, 2012 11:34 am

The events have to be in the same script, because they both need to access the TeleportHere reference, and you can only make a global reference in a Quest script, and this isn't a quest.
Are you absolutely sure of this? I've scripted stuff in Oblivion, and I could use global vars in other script than Quest scripts (although I don't remember if I used these in any in spell scripts). However much has changed since, that's why I'm asking...
User avatar
Rachell Katherine
 
Posts: 3380
Joined: Wed Oct 11, 2006 5:21 pm

Post » Mon Jun 18, 2012 2:07 pm

Are you absolutely sure of this? I've scripted stuff in Oblivion, and I could use global vars in other script than Quest scripts (although I don't remember if I used these in any in spell scripts). However much has changed since, that's why I'm asking...

The only global variables you can define in CK are Int, Float, etc (Values only, not references)
User avatar
Marquis deVille
 
Posts: 3409
Joined: Thu Jul 26, 2007 8:24 am

Post » Mon Jun 18, 2012 10:43 am

OK, it looks like without a global reference variable, it is absolutely impossible to pass reference variables between two effects. Even with the variable in the same script, the value is not retained from one event to the next:

Spoiler
Scriptname PlayerTeleportSpellScript extends ActiveMagicEffect{Keeps track of the location of the current teleport node and moves the player there when teleport is cast.}import gameimport utilityObjectReference playerObjectReference TeleportHereEvent OnEffectStart(Actor Target, Actor Caster) ; For the case where the node strikes an actor and "sticks"	if Target == Caster; This case means it was called from the self cast teleport, not the spell that fires the projectile		Debug.MessageBox("Teleport Node: " + TeleportHere)		player = (game.getPlayer() as ObjectReference)		if TeleportHere			Utility.Wait(0.5)			player.MoveTo(TeleportHere)				TeleportHere = None ; Make sure node goes poof.			TeleportHere = (FindClosestReferenceOfTypeFromRef(TeleportSpellProjectile,Game.Getplayer(),10000000) as ObjectReference)			while TeleportHere ; Now to get rid of any extras that may or may not be floating around somewhere in the cell.				TeleportHere.Delete()				TeleportHere = (FindClosestReferenceOfTypeFromRef(TeleportSpellProjectile,Game.Getplayer(),10000000) as ObjectReference)			endwhile		else ; Try to find the TeleportSpellProjectile or light.			TeleportHere = (FindClosestReferenceOfTypeFromRef(TeleportSpellProjectile,Game.Getplayer(),10000000) as ObjectReference)			if !TeleportHere				TeleportHere = (FindClosestReferenceOfTypeFromRef(MagicLightTeleportSpell,Game.Getplayer(),10000000) as ObjectReference)			endif			if !TeleportHere				TeleportHere = (FindClosestReferenceOfTypeFromRef(MagicLightTeleportSpell,Game.Getplayer(),10000000) as ObjectReference)			endif			if !TeleportHere				Debug.MessageBox("Unable to locate any teleport node by any means.")			else				player.MoveTo(TeleportHere)				Debug.MessageBox("Node Assigned to:" + TeleportHere)				TeleportHere = None ; Make sure node goes poof.			endif		endif	else		TeleportHere = None ; Get rid of the old node.		TeleportHere = (Target  as ObjectReference)		Debug.MessageBox("Node Assigned: " + TeleportHere)	endifEndEventLight Property MagicLightTeleportSpell autoProjectile Property TeleportSpellProjectile autoSpell Property TeleportLaunch AutoSpell Property TeleportMove Auto

You would think that even though this script is attached to two different effects, it's still the same script so the variable should be retained...but it isn't...I only get a valid value when I shoot the node at an actor...and the value is gone when I cast the other spell.

Also, the FindClosestReferenceOfTypeFromRef aren't working at all. How exactly do I find out what I need to pass it to actually locate something? It's obviously NOT the editor reference, but probably some long integer or sometthing...

The example they give in the wiki is searching for a diamond, but it doesn't even compile as typed...you have to create a property called "Diamond", but there is no object with the EditorID "Diamond" (It's actually 'GemDiamond" and 'Diamond" is in the name field.) - does this mean that FindClosestReferenceOfTypeFromRef is actually looking for whatever is in the name field? A string, and not a form type as the description claims?
User avatar
Juan Suarez
 
Posts: 3395
Joined: Sun Nov 25, 2007 4:09 am

Post » Tue Jun 19, 2012 1:33 am

So, can anyone explain, in an easy-to-understand way, exactly how to use FindClosestReferenceOfTypeFromRef? (With working example I can take apart, please, not just a link to the nonfunctional version on the wiki!)

I've tried it quite a few different ways, but it never seems to find anything. The example in the Wiki doesn't work (all I get is a compiler error telling me that diamond is undefined...thanks a lot, compiler!)

I tried making an auto property called "Diamond" and that made it compile, but even with some diamonds scattered aroiund, it's not finding them.
User avatar
Emily Jones
 
Posts: 3425
Joined: Mon Jul 17, 2006 3:33 pm

Post » Mon Jun 18, 2012 5:15 pm

The only global variables you can define in CK are Int, Float, etc (Values only, not references)
My apologies, I,ve misread the OP : Global reference (I was on the global variables assignment wagon, out of context)... My bad.

In regards to the problem at hand - and I'm just guessing out of unverified assumptions here : is there a way to convert types ? I mean, can one use some type conversion function so as to convert a string or an hex/num value to some reference type (is there a specific defined type for global references) ? Or would the engine/compiler themselves block the manipulation of global references outside of quest scripts ? Whatever, there could be a solution at hand, read the following.

You would think that even though this script is attached to two different effects, it's still the same script so the variable should be retained...but it isn't...I only get a valid value when I shoot the node at an actor...and the value is gone when I cast the other spell.
Could the use of a token on the caster (and/or the target if it has a container), and is properties or local variables be used : another spell's script could then have these variables and their values at hand. The spell could put a token on the caster, modify its local vars values (like some vars or vector having their values corresponding to whatever event you can heuristically "guess" or functionally state), so that these values can then after be accessible by another spell script...

Side-Note : for another context where targets are NPCs, if a token cannot be put on the caster during the whole effect you wish to render (for instance where not all NPCs should be "hit" by the spell effect, like a single one amongst a crowd and who was targeted by the first spell which has put a token in its inventory), the second spell could be an area spell, and if the token is present then the spell would access its local variables to know exactly what to do next - thus you wouldn't need any Quest script so as to know about some global reference and its state, however I'm talking about NPCs here so it's irrelevant for your context).

Another solution (?) : "mark" your target. If you can have access to the spell's target properties or attached local variables, from within the spell's script, you could get its exact location, put a "phantom" NPC/item right onto that location, and then have the next spell specifically target that phantom NPC from within its script - I don't know if it's possible to cast a spell to some exact coordinates instead of some objects - I don't think so -, which is why a phantom NPC could be used. Of course these solutions require handling a token or a phantom NPC, meaning that the spell scripts should not only add them, but also remove them after the effect. A token on the caster could also do that job and remove itself at the end.

Given my above "wild guess", my big question would be : can a spell script access local variables attached to whatever object's script (either a target with a container having a token - the caster - or an attached script - the target (if it.'s an NPC, this would be done via a scripted token else via an attached script, which script would only declare/initialize local variables then after handled by the spell script) ?
User avatar
roxanna matoorah
 
Posts: 3368
Joined: Fri Oct 13, 2006 6:01 am

Post » Mon Jun 18, 2012 11:48 pm

Assuming I can find someone to tell me how to make the FindClosestReferenceOfTypeFromRef function to work, and some way of making script member variables of the "There can be only one" type, all my problems with this spell would be solved.
To answer part of your query, Hawk, a Reference is basically the address of a memory location (We used to call them "pointers") - but the actual value of the Reference is private, and is handled "behind the scenes" - there is no way to read the value, save it in an integer, and then later turn it back into a reference again.
User avatar
Marcin Tomkow
 
Posts: 3399
Joined: Sun Aug 05, 2007 12:31 pm

Post » Mon Jun 18, 2012 12:03 pm

I haven't tried this myself. There's not a single script in Skyrim that actually uses that function, there may be a reason. There is, however, an ENTIRE section of code that is commented out in the following:

DA13GooActivatorScript.psc

; bool exterminating = TRUE  ; while exterminating == TRUE  ; search for any of the ghostly rats nearby   ; objectReference nextRef = FindClosestReferenceOfTypeFromRef(DA13hallucinatedSkeever, self, 4096)   ; if nextRef != NONE	; nextRef.disable()	; nextRef.delete()   ; else	; exterminating = FALSE   ; endif  ; endWhile    ; STATE VisionTwo; EVENT onActivate(objectReference actronaut)  ; setUpVars()    ; if actronaut == player   ; if DA13.getStage() == 75	; DA13.setStage(80)	; BeginVision()   ; elseif DA13.getStage() > 75 && DA13.getStageDone(100) == FALSE	; Peryite.activate(player)   ; endif  ; endif; endEVENT; EVENT onUpdate(); if DA13.getStageDone(100) == FALSE	   ; if player.getHeadingAngle(Peryite) > 50 || player.getHeadingAngle(Peryite) < -50	; Peryite.activate(player)   ; endif  ; else   ;this takes us out of the vision   ; endVision()   ; self.disable()   ; self.delete()  ; endif; endEVENT; endSTATE


self will be the script activator. If you're looking within a radius of the player, you could replace that with Game.GetPlayer()
DA13hallucinatedSkeever is going to have to be a property defined at the top, and resolved in the script properties.

form property DA13hallucinatedSkeever auto

Assuming they didn't comment this out because the function simply doesn't work (again, no scripts use it) then you just need to update your form property to point to what you're looking for instead of a hallunicating skeever.

-MM
User avatar
Lovingly
 
Posts: 3414
Joined: Fri Sep 15, 2006 6:36 am

Post » Mon Jun 18, 2012 9:14 pm

I haven't tried this myself. There's not a single script in Skyrim that actually uses that function, there may be a reason. There is, however, an ENTIRE section of code that is commented out in the following:

DA13GooActivatorScript.psc

; bool exterminating = TRUE  ; while exterminating == TRUE  ; search for any of the ghostly rats nearby   ; objectReference nextRef = FindClosestReferenceOfTypeFromRef(DA13hallucinatedSkeever, self, 4096)   ; if nextRef != NONE	; nextRef.disable()	; nextRef.delete()   ; else	; exterminating = FALSE   ; endif  ; endWhile    ; STATE VisionTwo; EVENT onActivate(objectReference actronaut)  ; setUpVars()    ; if actronaut == player   ; if DA13.getStage() == 75	; DA13.setStage(80)	; BeginVision()   ; elseif DA13.getStage() > 75 && DA13.getStageDone(100) == FALSE	; Peryite.activate(player)   ; endif  ; endif; endEVENT; EVENT onUpdate(); if DA13.getStageDone(100) == FALSE	   ; if player.getHeadingAngle(Peryite) > 50 || player.getHeadingAngle(Peryite) < -50	; Peryite.activate(player)   ; endif  ; else   ;this takes us out of the vision   ; endVision()   ; self.disable()   ; self.delete()  ; endif; endEVENT; endSTATE


self will be the script activator. If you're looking within a radius of the player, you could replace that with Game.GetPlayer()
DA13hallucinatedSkeever is going to have to be a property defined at the top, and resolved in the script properties.

form property DA13hallucinatedSkeever auto

Assuming they didn't comment this out because the function simply doesn't work (again, no scripts use it) then you just need to update your form property to point to what you're looking for instead of a hallunicating skeever.

-MM

It works. I added the second example in the wiki page a few days ago: http://www.creationkit.com/FindClosestReferenceOfTypeFromRef_-_Game

My only problem with making it work is that I couldn't figure how to autofill form properties, but using a Door property instead, in my case, made it work.
User avatar
NAkeshIa BENNETT
 
Posts: 3519
Joined: Fri Jun 16, 2006 12:23 pm

Post » Mon Jun 18, 2012 11:03 pm

Interesting. The only caveats to auto-fill that I've run into are
  • The property name must match the Editor ID value for the form
  • The script must be compiled with the new property name
If those two conditions aren't met, then AUTOFILL will not work. AutoFilling is not a requirement though, if it doesn't autofill you can manually associate the property with the correct editor id/form.
User avatar
BlackaneseB
 
Posts: 3431
Joined: Sat Sep 23, 2006 1:21 am

Post » Mon Jun 18, 2012 4:50 pm

I think I can solve this for you in a more simplified way. You can create a quest, set it to Start Game Enabled, or w/e the checkbox is, then add a script to your quest on the script tab. Then go and define properties or functions in this script that you would like to use from other scripts. Then in your active magic effect script add a property of type and in the property manager set it to point to your quest. Then you can go and . and you'll have a global like variable or function of any type u want.
User avatar
Sammykins
 
Posts: 3330
Joined: Fri Jun 23, 2006 10:48 am

Post » Mon Jun 18, 2012 9:39 pm

And to add onto this, if you're using a projectile to mark where u want to teleport, you can add an explosion onto it (theres an explosion called emptyexplosion or something that you can duplicate) and then set the explosion property place object to an object (something like an activator works well, because you can just attach a script onto it) then attach an OnInit script to that activator that accesses your quest script global variables and set one to its location. Or actually if you're using a marker you could probably just have the explosion directly place your marker.


Edit:
I just realized this post is from February 13th, don't know if you still need this information or not.
User avatar
Kim Bradley
 
Posts: 3427
Joined: Sat Aug 18, 2007 6:00 am

Post » Mon Jun 18, 2012 5:41 pm

Interesting. The only caveats to auto-fill that I've run into are
  • The property name must match the Editor ID value for the form
  • The script must be compiled with the new property name
If those two conditions aren't met, then AUTOFILL will not work. AutoFilling is not a requirement though, if it doesn't autofill you can manually associate the property with the correct editor id/form.

Maybe I'm doing something terribly wrong then. What I mean, if I take the second example script that I put in the wiki page and change the Door Property by a Form Property, autofilling set it as NONE. And when trying to set it manually, I can only choose NONE, CommandingActorPersistenceForm and PapyrusPersistenceForm. Any of the three will return a non valid form warning when called from the function...
User avatar
Dean Brown
 
Posts: 3472
Joined: Fri Aug 31, 2007 10:17 pm

Post » Mon Jun 18, 2012 4:24 pm

I think I can solve this for you in a more simplified way. You can create a quest, set it to Start Game Enabled, or w/e the checkbox is, then add a script to your quest on the script tab. Then go and define properties or functions in this script that you would like to use from other scripts. Then in your active magic effect script add a property of type and in the property manager set it to point to your quest. Then you can go and . and you'll have a global like variable or function of any type u want.

As outlined http://www.creationkit.com/Variables_and_Properties_%28Papyrus%29.

Right. I tested this and it works a treat. Successfully passes an Actor reference between two seperate ActiveMagicEffect scripts running on two seperate Actors. To test yourself, do as follows.

Create a quest set to start automatically (default). I gave mine a CK ID of rkt_rt_Quest. Then attach a script to the quest as follows ...

Scriptname rkt_rt_QuestScript extends Quest  Actor actorRef_store = NONEActor property actorRef	Actor function get()	    return actorRef_store	endFunction	function set( Actor actorRef_in )	    actorRef_store = actorRef_in	endFunction	endProperty

Now create a magic effect and spell to cast on a target. Give the magic effect a script as follows ...

Scriptname rkt_rt_TargetEffectScript extends activemagiceffect  rkt_rt_QuestScript Property questRef autoEvent OnEffectStart( Actor akTarget, Actor akCaster )	Debug.Notification( "Target OnEffectStart" )	questRef.actorRef = akTargetEndEventEvent OnEffectFinish( Actor akTarget, Actor akCaster )	questRef.actorRef = NONEEndEvent

Take note of this part

rkt_rt_QuestScript Property questRef auto

The property type is the name of the script attached to the quest.

Now select your script and click the properties button. Select the single property and click edit. You get one option, the name of the quest. Select this. Autofill will not work.

Now create a magic effect and spell to cast on yourself. Give the magic effect a script as follows ...

Scriptname rkt_rt_CasterEffectScript extends activemagiceffect  rkt_rt_QuestScript Property questRef autoEvent OnEffectStart( Actor akTarget, Actor akCaster )	Debug.Notification( "Caster OnEffectStart" )	akCaster.MoveTo( questRef.actorRef as ObjectReference, 0.0, 0.0, 0.0, true )EndEventEvent OnEffectFinish( Actor akTarget, Actor akCaster )	questRef.actorRef = NONEEndEvent

As before, take note of this part

rkt_rt_QuestScript Property questRef auto

Once again, the property type is the name of the script attached to the quest.

Now do the same as before to fill in the property with the name of the quest.

Then load in game and give yourself both spells. Cast the target spell on an NPC, run a distance away and cast the Caster Spell on yourself. You teleport.
User avatar
мistrєss
 
Posts: 3168
Joined: Thu Dec 14, 2006 3:13 am


Return to V - Skyrim