Jump to content

[LE] Continuous spell casting via papyrus


Jollypolly

Recommended Posts

Hello,

I'm trying to cast a simple ward spell when I equip a certain item.

 

The code I tried is as follows :

 

Scriptname TQspell extends ObjectReference

 

SPELL Property WardSpell Auto

Actor Property Player Auto

 

Event OnEquipped(Actor Player)

WardSpell.Cast(Player,Player)

EndEvent

 

Nothing happens.

I just need the ward visuals to appear for a certain amount of time when I equip the object.

Any Idea how I can do this?

Thanks

Link to comment
Share on other sites

Use

Actor Property PlayerRef Auto

 

Then

 

If Player == PlayerRef

Ward.Cast(PlayerRef)

EndIf

 

Sorry for not containing, on mobile.

Thanks Rizalgar for your reply.

The spell does trigger but it doesn't maintain itself. Any Idea how to keep it going for a defined amount of time?

I looked in the .nif of the effect with nifskope and it seems to have different stages : among those are CastStart, Cast and CastEnd. It seems when you use the .Cast() function through script, it only triggers the CastStart phase which only lasts a second or so.

I tried using a while loop to recast the ward every 0.5 sec but the ward just pops on and off and you don't get a continuous ward effect. Changing the duration in the creation kit of the magic effect doesn't do anything either.

Link to comment
Share on other sites

I haven't done much work with it... But check in to using the effect shader via Play. Find the effect your ward uses, then do something like

 

WardEffect.Play(PlayerRef, x.x) ;Replace x.x with float time, or remove to play indefinitely until told to stop using .Stop()

Link to comment
Share on other sites

Hmmm creation kit doesn't recognise Play().

I can't find such a function in the CKwiki or any similar one to apply directly a magic effect to the player with a timer.

Ah sorry, I was using a magic effect property and not an effect shader one, thats why Play() didn't work. Still, that won't do the trick since the ward doesn't call any shader.

Link to comment
Share on other sites

Is this the exact code you have on the item? If it is, I am not sure it would even compile. You have an actor set as Player twice.

 

You are also going to have an issue because of the type of spell a ward is. It is not fire and forget it is a spell an actor needs to cast continuously. How does the game know how long to keep the ward up? You may need to create a new ward spell to get it to work like this.

Scriptname TQspell extends ObjectReference

 

SPELL Property WardSpell Auto

Actor Property Player Auto

 
Event OnEquipped(Actor Player)

WardSpell.Cast(Player,Player)

EndEvent

Try this and let me know what happens. Make sure you have the properties filled.

Scriptname TQspell extends ObjectReference

 

SPELL Property WardSpell Auto

Event OnEquipped(Actor akActor)
Debug.Notification("Equipped")
  if akActor == Game.GetPlayer()
    WardSpell.cast(akActor)
  endIf
endEvent
Edited by SurfsideNaturals
Link to comment
Share on other sites

hi SurfSide, this is my script :

 

Scriptname TQspell extends ObjectReference

SPELL Property WardSpell Auto
Actor Property PlayerRef Auto

Event OnEquipped(Actor akActor)
if akActor == PlayerRef
WardSpell.cast(PlayerRef)
EndIf
EndEvent

 

Yes the Ward triggers but dissipates immediately after. What I'm trying to figure out is if there is a way to keep it going through script or at least through the creation kit. But at this point i'm thinking the only way is by modifying the nif animated object which seems like a tedious task given the cryptic data structure of the nif file.

Edited by Jollypolly
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...