Apply magic effect to an actor via script?

Post » Wed Jun 20, 2012 4:14 am

I need a way to apply a magic effect to the player via a script as if they had consumed a potion. Any ideas on how to do this? I've scoured the Actor, ObjectReference, Potion, ActiveMagicEffect, and MagicEffect script pages on the wiki, but have come up dry.

Anyone else been able to do anything like this?
User avatar
Alex Blacke
 
Posts: 3460
Joined: Sun Feb 18, 2007 10:46 pm

Post » Tue Jun 19, 2012 5:21 pm

Make a spell/ability/any magic, apply your magic effect on it, set the [no duration] on the mgef and build in smth like this into your script:
Game.getPlayer().cast(spellproperty)
User avatar
Ronald
 
Posts: 3319
Joined: Sun Aug 05, 2007 12:16 am

Post » Wed Jun 20, 2012 6:33 am

Fairly certain that version of the function is from the old language.

Searching for it in Papyrus, I came upon the new one, which needs to be called on a spell, as opposed to an object reference or actor. With any luck, it should do what I need it to.

Thanks for pointing me in the right direction!
User avatar
Sarah Edmunds
 
Posts: 3461
Joined: Sat Jul 08, 2006 8:03 pm

Post » Wed Jun 20, 2012 8:10 am

Create a spell that uses the magic effect. Then:

Game.GetPlayer().AddSpell(spell_name)
User avatar
Ross
 
Posts: 3384
Joined: Thu Aug 10, 2006 7:22 pm

Post » Tue Jun 19, 2012 8:31 pm

Create a spell that uses the magic effect. Then:

Game.GetPlayer().AddSpell(spell_name)

Doesn't addspell TEACH them the spell?
User avatar
BrEezy Baby
 
Posts: 3478
Joined: Sun Mar 11, 2007 4:22 am

Post » Tue Jun 19, 2012 5:54 pm

Yeah, turns out the actor doesn't even need to know the spell.

Using [Spell].Cast(Game.GetPlayer()) works.
User avatar
Milad Hajipour
 
Posts: 3482
Joined: Tue May 29, 2007 3:01 am

Post » Wed Jun 20, 2012 7:25 am

Create a spell that uses the magic effect. Then:

Game.GetPlayer().AddSpell(spell_name)

This would only work if the spell was an ability, if it is an equipable spell it would only teach them the spell as redwood said
User avatar
Damned_Queen
 
Posts: 3425
Joined: Fri Apr 20, 2007 5:18 pm


Return to V - Skyrim