Scripting a magic effect?

Post » Mon Jun 18, 2012 1:11 am

Ok since I guess the questions I asked previously got no answers whatsoever, I figured it was because my thread was too long, so here is what I really need in short.

I need a script so when you click the attack button or a certain key with a certain weapon drawn, a magical effect is cast on the caster, in this case, the Drugged effect from sleeping tree sap.

Another script I would really like is one that if you have 2 items and click on 1 of them, they combine to form a third. I already have the models and creation kit data for the items, I just need a script to implement them.

And also, is there any way to make a misc. item able to be equipped/have a magical effect on the player/person holding it?
User avatar
Elizabeth Lysons
 
Posts: 3474
Joined: Fri Feb 02, 2007 7:16 am

Post » Mon Jun 18, 2012 3:21 am

bump
User avatar
Charlotte Lloyd-Jones
 
Posts: 3345
Joined: Fri Jun 30, 2006 4:53 pm

Post » Mon Jun 18, 2012 8:17 am

For the last one at least, you could possibly attach a script to a player that checks the inventory (somehow) and if that item is there, it will apply the effect?
User avatar
Dawn Porter
 
Posts: 3449
Joined: Sun Jun 18, 2006 11:17 am

Post » Mon Jun 18, 2012 5:07 am

For my first one I tried
scriptName DruggedEffectAdd extends ObjectSpell property druggedSpell AutoEVENT OnActivate(ObjectReference akActionRef)   druggedSpell.Cast(Self, Self)EndEVENT
But I don't know how to attach that to my item and make it only happen when I click the mouse or a key. Also, I'm not even sure if that code is the right one to use!
User avatar
Cedric Pearson
 
Posts: 3487
Joined: Fri Sep 28, 2007 9:39 pm

Post » Mon Jun 18, 2012 11:56 am

Afaik you can't equip a misc item.
What you can do is attach a script to the misc item, so that it does something when the player adds it to it's inventory and reverses that whe he drops it

Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)Event OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer)
User avatar
ladyflames
 
Posts: 3355
Joined: Sat Nov 25, 2006 9:45 am

Post » Mon Jun 18, 2012 8:17 am

Hmm. Is there any way to make that script happen, but when you click on one of the items?
User avatar
April D. F
 
Posts: 3346
Joined: Wed Mar 21, 2007 8:41 pm

Post » Mon Jun 18, 2012 6:43 am

Check the wiki out, there is a good tutorial that shows you how an event (in that case walking into a trigger area) results in a spell being cast (raise dead). I think a little bit of alteration should suit your needs?
User avatar
sally coker
 
Posts: 3349
Joined: Wed Jul 26, 2006 7:51 pm

Post » Mon Jun 18, 2012 12:34 am

If not sure if clicking something in the invertory triggers anything at all.
What you coukld do as a workarround is assign an empty mesh to your item (the inventory and ground mesh will still be normal), define it as an armor and use one of the unused armor slots. Then you could listen for equip and unequip events (or even use a simple enchantment)

For your Weapon backfires at player (that's how I understood it^^) you could try attaching an enchantment to the weapon and listen for

http://www.creationkit.com/OnAnimationEvent_-_Form

in your activeMagicEffect Script

No idea if this works :D
User avatar
Dark Mogul
 
Posts: 3438
Joined: Tue Feb 20, 2007 11:51 am

Post » Mon Jun 18, 2012 1:00 pm

I don't think items without an equip type can be equipped. Some items can, however, and if I remember correctly torches are unusual misc items in that they can be equipped.

It may be required that you execute a short http://www.creationkit.com/Wait_-_Utility, so the script will not continue to run until the player has closed the inventory screen.

Cipscis
User avatar
Naomi Lastname
 
Posts: 3390
Joined: Mon Sep 25, 2006 9:21 am

Post » Mon Jun 18, 2012 2:54 am

Cipscis, since you seem like your a good scripter, would this work?
ScriptName BlaBla extends ActiveMagicEffectSpell property spellToCast autoEvent OnEffectStart(Actor akTarget, Actor akCaster)debug.trace(self + " bla  bla")spellToCast.Cast(akCaster, None)EndEVENT
And if it would as an enchanment, how would I tie to to an effect already in the game (ie: the drugged effect)
Would I replace spellToCast with the dunSleepingTreeDrugged effect?
User avatar
Amanda savory
 
Posts: 3332
Joined: Mon Nov 27, 2006 10:37 am

Post » Mon Jun 18, 2012 3:53 am

Help?
User avatar
Steve Fallon
 
Posts: 3503
Joined: Thu Aug 23, 2007 12:29 am


Return to V - Skyrim