Jump to content

[LE] how to cast fire&forget spell from concentration spell script?


Recommended Posts

Hi Everyone :smile:

 

I'm trying to make a concentration spell with a few effects like Detect life, Invisibility and Nighteye (no problem) but i also want to run the SlowTime effect at the same time and have it despel once the button is released.

 

It turns out that I can't just add the SlowTime effect to the concentration spell because SlowTime is a fire & forget spell and doesn't seem to work once converted into a concentration type spell.

So i figure i have to add it in by script.

 

This is what i have so far...

Scriptname STTestScript extends activemagiceffect  


MagicEffect Property STSlowTimeEffect3 Auto
Spell Property SlowTimeTest3 auto

Actor Player


	EVENT OnEffectStart(Actor akTarget, Actor akCaster)
		Game.GetPlayer().addSpell(slowtimetest3)
			debug.notification("slow time added")


		SlowTimeTest3.cast(game.getplayer())	

EndEvent


	FUNCTION SetNthEffectMagnitude()
			debug.notification("magnitude set")

EndFunction

	FUNCTION SetNthEffectDuration()
			debug.notification("duration set")

EndFunction


	Event OnEffectFinished(Actor akTarget, Actor akCaster)
		Utility.Wait(10)

			Game.GetPlayer().dispelSpell(slowtimetest3)
				debug.notification("dispelled")

			Game.GetPlayer().removeSpell(slowtimetest3)
				debug.notification("removed")
		
EndEvent


So far i can get all the debug messages to fire off, meaning that the spell gets added by the script, but then it doesn't do anything. The visual effect starts to play but then it stops and time hasn't slowed down.

 

(I can do it the other way - add all my concentration effects by script on a fire & forget type spell, which gets the slow time effect working but looses some of the other effects.)

((Mixing spell types like this by script might not be possible??))

 

I've read somewhere that i might be able to add the SlowTime effect to an ability and then call that in a script but i'm not too sure about that process. That will be the next thing i try.

 

If anyone knows how to add a spell effect like this through script id love to find out how to do it. Any help/advice would be most welcomed. This is driving me crazy now.

Edited by SandMouseAnarchy
Link to comment
Share on other sites

Me too, I was sure that Spell.Cast() would work.. Hmm

 

And I have tried converting the slow time spell into a concentration spell but it doesn't work. The spell starts and all the other effects start - just not the slow time effect.

 

Is anyone else able to make slow time concentration spell?

Did you give it a duration? Try giving it at least 1 second.

Link to comment
Share on other sites

Thanks for the replies :)

 

I have tried to give it a duration yeh, I've tried 0.5, 1, 10 etc (for the concentration spell using the script to cast the slow time fire and forget spell. I've even tried messing around with the casting time too but it's still not working.

 

Which duration box should have the value 1? The one in the magic effect with the script itself, the one in the spell that points to the script magic effect, or in the slowtime magic effect or in the slow time spell? There's a lot of boxes ;)

 

I've read that a concentration spell will recast it's effects every second and ends the effect straight away each second. I think that maybe the slow time effect is being cancelled by the concentration spell recasting, and isn't being given enough time to properly start.

 

Maybe selecting no-recast in the other effects will work?

Edited by SandMouseAnarchy
Link to comment
Share on other sites

Thanks for the replies :smile:

 

I have tried to give it a duration yeh, I've tried 0.5, 1, 10 etc (for the concentration spell using the script to cast the slow time fire and forget spell. I've even tried messing around with the casting time too but it's still not working.

 

Which duration box should have the value 1? The one in the magic effect with the script itself, the one in the spell that points to the script magic effect, or in the slowtime magic effect or in the slow time spell? There's a lot of boxes :wink:

 

I've read that a concentration spell will recast it's effects every second and ends the effect straight away each second. I think that maybe the slow time effect is being cancelled by the concentration spell recasting, and isn't being given enough time to properly start.

 

Maybe selecting no-recast in the other effects will work?

I think you're right. Add a condition to the cast, something like

if !slowtimetest3.HasMagicEffect()
     SlowTimeTest3.cast(game.getplayer())
EndIf

or a condition to the spell that does the same thing as well as the no-recast.

 

As for the 1 second, add it to the spell itself.

Link to comment
Share on other sites

Thanks for the replys :)

I'll try the no-recast idea soon and post the results.

As for a condition on the spell - if. Hasmagiceffect() can only be called on actors maybe something like -

 

OnInit(actor akTarget, actor akCaster)

If ActiveMagicEffect().SlowTimeEffect3

Game.GetPlayer().MagicEffectStart(STSlowTimeEffect3)

 

And then use

if ActiveMagicEffect().SlowTimeTest3

setNthEffectDuration()

 

I'm not sure if .MagicEffectStart is a legitimate code, intact I'm pretty sure it isn't. But maybe it's possible to call the MagicEffect directly, bypassing the spell another way?

Edited by SandMouseAnarchy
Link to comment
Share on other sites

OK so... I've experimented with the effect spell duration and the script spell duration, neither seem to make a difference.

The slow time effect still doesn't seem to start.

(a little hour glass icon shows up on screen for a split second and then disappears, so the spell is definitely casting just not for its full duration)

 

I've tried Oninit() but (Game.GetPlayer()) and (actor akTarget, actor akCaster) won't go after Oninit and I get a compile error. (I don't think I'm using OnInit right?)

And I've also tried -

 

Onspellcast(akSpell)

SlowTimeTest3.Cast(game.getplayer())

 

But that doesn't seem to work either.

I've also tried a few conditions like getcastduration but no luck there either.

 

Is there a way to override the concentration spell recasting/refreshing the slow time effect? I've tried taking all the other effects out of the spell leaving only the spell script and slow time spell/effect, now no other spell is being recast or overiding the duration, but still no success.

Maybe there is a way to tell the concentration spell to recast every 10seconds instead of 1?

Edited by SandMouseAnarchy
Link to comment
Share on other sites

Did you try something simple like this?

Scriptname 

Your properties

Event OnEffectStart(Actor akTarget, Actor akCaster)

If akCaster.MagicEffectStart(STSlowTimeEffect3) == 0
 SlowTimeTest3.cast(akCaster)
Else    
 debug.notification("Slow time is already running")
EndIf	

EndEvent
Link to comment
Share on other sites

  • Recently Browsing   0 members

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