Custom spell not appearing in inventory

Post » Fri Nov 16, 2012 1:22 pm

I'm trying to make a spell that when cast to an npc, it will run a script on him. So I did:
1) A MagicEffect called "myEffect", with these parameters:
Effect archetype: Script
Casting type: Fire and forget
Delivery: Target actor
Magic skill: NONE
and everything else is "NONE" or unchecked.
I put a script in "Pypyrus scripts" sections which looks as follows:
Scriptname myScript extends MagicEffectActor NPC_targetEvent OnEffectStart(Actor akTarget, Actor akCaster)	Debug.Trace("Magic effect was started on " + akTarget)	NPC_Target = akTargetEndEvent
2) A Spell object called "mySpell", with these parameters:
Type: Spell
Casting: Fire and forget (it's greyed out)
Delivery: Target actor (it's greyed out)
Menu display object: MAGINVIceSpellArt
Equip type: EitherHand
Casting perk: DestructionNovice00
Range: 20.0 ft
And then I checked "auto-calculate", "ignore resistance", and "no dual cast modifications"
And added as effect my "myEffect", with:
magnitude: 20
Duration: 3s
and no conditions

But when I call ingame the console function "player.AddSpell <(correct ID of my spell)>", it says the spell was added to player, but I cannot see it in magic inventory. What is wrong?
User avatar
m Gardner
 
Posts: 3510
Joined: Sun Jun 03, 2007 8:08 pm

Post » Fri Nov 16, 2012 6:27 pm

I had this. Apparently the magic school and casting perk have to agree or it won't show up
User avatar
Leonie Connor
 
Posts: 3434
Joined: Mon Mar 12, 2007 4:18 pm

Post » Fri Nov 16, 2012 7:37 pm

I had this. Apparently the magic school and casting perk have to agree or it won't show up
Thanks Doc, looks like it was that. I set "Magic Skill" to Destruction and now it appeared. But now I'm trying to make that script work, cause when I cast the spell on an npc, it does not show the messagebox. Are magnitude, range and duration important for these spells where you use "cast and forget" on "target actor" and run a script? Do I have to add also a distruction effect as my spell is a distruction spell?
User avatar
NIloufar Emporio
 
Posts: 3366
Joined: Tue Dec 19, 2006 6:18 pm

Post » Fri Nov 16, 2012 12:49 pm

I ran into this same issue, Skyrim just doesn't like it when your spell isn't in one of the magical schools...

Make sure you set a spell magnitude of at least 1. I see you have it set to 20, but it's worth noting anyway: magnitude 0 will cause the spell to silently fail and the script will not execute. Also, after you insert the MagicEffect into the Spell, edit it again and hit cancel; this will update the spell effect's Area, which sometimes solves problems with the spell failing.

Also, if the script you posted above is still the one you're using, note that "debug.trace" doesn't pop up a message box, it logs the message to papyrus.log. Try debug.notification for on-screen messages, or debug.messagebox.
User avatar
Amber Hubbard
 
Posts: 3537
Joined: Tue Dec 05, 2006 6:59 pm

Post » Fri Nov 16, 2012 2:03 pm

Thanks everybody, now it seems to work. I just searched for some already made scripted spell in the CK and made a copy of them, I picked MQpathtoHHShrineBlessing as Spell, which uses MQpathToHHShrineEffect magic effect, and changed delivery to "target actor" for both, using my script instead of MQpathtoHHShrineEffectScript.

Make sure you set a spell magnitude of at least 1. I see you have it set to 20, but it's worth noting anyway: magnitude 0 will cause the spell to silently fail and the script will not execute.
The one I copied has magnitude 0 and the script works, so it must have been something else.

Also, if the script you posted above is still the one you're using, note that "debug.trace" doesn't pop up a message box, it logs the message to papyrus.log. Try debug.notification for on-screen messages, or debug.messagebox.
Yes thanks for the debugging, I really have "trace", "notification", and "messagebox" spread randomly in my scripts, I will use "notification" so it will always appear in game.

Now I hope that spell will not give me any more trouble.
User avatar
willow
 
Posts: 3414
Joined: Wed Jul 26, 2006 9:43 pm

Post » Sat Nov 17, 2012 4:07 am

Another question: my magic effect has duration 1, but after 1 second the script is still running, will it be deleted from the npc when it does all the operations in the "OnEffectFinish" event (I used it istead of "OnEffectStart" cause the messagebox appeared too early), or will the npc have this script running on him forever, doing nothing?
User avatar
Robyn Lena
 
Posts: 3338
Joined: Mon Jan 01, 2007 6:17 am


Return to V - Skyrim