Magic Effect on Target Object

Post » Tue Jun 19, 2012 10:37 am

Hi guys

Can anyone suggest a way to apply a magic effect script to any object in the game world? I have a Papyrus script applied to a Magic Effect I created which currently extends ActiveMagicEffect, however ActiveMagicEffect only seems to have the function to return a target of type Actor. I am wondering if there is a way to use the "self" to get a reference to any object targeted by the spell, eg. a barrel. I haven't been able to get this to work so far. I am still trying to understand the Papyrus scripting language. In Oblivion I seem to remember I could just make a SpellEffect that went:

begin ScriptEffectStart   set spellTarget to getSelf   spellTarget.doSomethingend

So I am trying to figure out how to do this for Skyrim. I don't really know which Event to use either.

I would appreciate any help!
User avatar
Monika Fiolek
 
Posts: 3472
Joined: Tue Jun 20, 2006 6:57 pm

Post » Tue Jun 19, 2012 11:15 am

As far as I know, spells are only intended to target actors, not objects...which is indeed sad...
User avatar
Ash
 
Posts: 3392
Joined: Tue Jun 13, 2006 8:59 am

Post » Tue Jun 19, 2012 2:53 pm

Telekinesis targets objects, so I don't know if thats entirely true, though maybe the fact that TK can target an object is something inherent to the Telekinesis archetype and can't be accessed by any other type of spell.
User avatar
Fam Mughal
 
Posts: 3468
Joined: Sat May 26, 2007 3:18 am

Post » Tue Jun 19, 2012 2:09 pm

Yeah but there must be a way. In Oblivion you didn't have to rely on an inbuilt function to get the reference to the spell target.
User avatar
Emzy Baby!
 
Posts: 3416
Joined: Wed Oct 18, 2006 5:02 pm

Post » Tue Jun 19, 2012 5:25 am

theres a thread around here somewhere about an unlock spell working on a work around for targeting doors with spells. try doing a search for that.
User avatar
Captian Caveman
 
Posts: 3410
Joined: Thu Sep 20, 2007 5:36 am

Post » Tue Jun 19, 2012 5:20 pm

The http://www.creationkit.com/OnMagicEffectApply_-_ObjectReference event seems to fire for some types of http://www.creationkit.com/ObjectReference_Script, but not others. I think it works on world objects, but not items, although I haven't tested this exhaustively.

Cipscis

EDIT:

Oh, and this code for Oblivion:
begin ScriptEffectStart   set spellTarget to getSelf   spellTarget.doSomethingend
Is exactly the same as this code:
begin ScriptEffectStart   doSomethingend
With the slight difference that the second bit of code is slightly faster.

Cipscis
User avatar
Hannah Barnard
 
Posts: 3421
Joined: Fri Feb 09, 2007 9:42 am

Post » Tue Jun 19, 2012 11:28 am

The OnMagicEffectApply event seems to fire for some types of ObjectReference, but not others. I think it works on world objects, but not items, although I haven't tested this exhaustively.

Cipscis

Cool, that event could probably work, but how do I refer to the spell target? I don't think you can just go "disable()"...

And lol good point about that code. I just got the example by modifying one of Bethesda's scripts slightly.
User avatar
Jordyn Youngman
 
Posts: 3396
Joined: Thu Mar 01, 2007 7:54 am

Post » Tue Jun 19, 2012 1:44 pm

The http://www.creationkit.com/OnMagicEffectApply_-_ObjectReference event seems to fire for some types of http://www.creationkit.com/ObjectReference_Script, but not others. I think it works on world objects, but not items, although I haven't tested this exhaustively.

Cipscis

EDIT:

Oh, and this code for Oblivion:
begin ScriptEffectStart   set spellTarget to getSelf   spellTarget.doSomethingend
Is exactly the same as this code:
begin ScriptEffectStart   doSomethingend
With the slight difference that the second bit of code is slightly faster.

Cipscis

OMG. That would mean...it should work with doors? I will try when I arrive at home :P
User avatar
Kelly James
 
Posts: 3266
Joined: Wed Oct 04, 2006 7:33 pm

Post » Tue Jun 19, 2012 8:30 am

OMG. That would mean...it should work with doors? I will try when I arrive at home :tongue:
I know that you meant otherwise, but... on the other hand, do you really need that spell to open the doors of your home? :>
User avatar
K J S
 
Posts: 3326
Joined: Thu Apr 05, 2007 11:50 am

Post » Tue Jun 19, 2012 6:15 am

The http://www.creationkit.com/OnMagicEffectApply_-_ObjectReference event seems to fire for some types of http://www.creationkit.com/ObjectReference_Script ...

The only problem being that you need the object reference in the first place. A glaring oversight that far too many people are having trouble with.
User avatar
RaeAnne
 
Posts: 3427
Joined: Sat Jun 24, 2006 6:40 pm

Post » Tue Jun 19, 2012 2:53 pm

We might have to listen to cscottydont and do what they ended up doing in http://www.gamesas.com/topic/1346360-so-whats-the-problem-with-creating-an-unlock-spell/page__p__20302578__hl__unlock%20spell__fromsearch__1#entry20302578 :\

Damn you Bethesda! You should have left things the way they worked in TES IV.
User avatar
Matt Gammond
 
Posts: 3410
Joined: Mon Jul 02, 2007 2:38 pm

Post » Tue Jun 19, 2012 5:01 pm

I know that you meant otherwise, but... on the other hand, do you really need that spell to open the doors of your home? :>

Yes, I always lose my keys, so until there is a mod to bash open the door, I need a spell! hahaha!
User avatar
Antonio Gigliotta
 
Posts: 3439
Joined: Fri Jul 06, 2007 1:39 pm

Post » Tue Jun 19, 2012 11:10 am

We might have to listen to cscottydont and do what they ended up doing in http://www.gamesas.com/topic/1346360-so-whats-the-problem-with-creating-an-unlock-spell/page__p__20302578__hl__unlock%20spell__fromsearch__1#entry20302578 :\

Damn you Bethesda! You should have left things the way they worked in TES IV.
Now I'm doing http://www.gamesas.com/topic/1352976-a-working-open-door-spell/ to target objects. I am not sure if there is a way to target any object yet, but at least you could use it (with an explosion placed scripted item in case you want a ranged spell) to target the nearest object of a kind using GetIsObjectType in the Alias window.

As you see in the link you posted, before I was using GetClosestReference...from List functions, but like that you had to keep a list of all objects you were interested in, and it wasn't...cool :)

Hope it helps!
User avatar
Thomas LEON
 
Posts: 3420
Joined: Mon Nov 26, 2007 8:01 am


Return to V - Skyrim