prevent casting a spell in a fight & 100% magicka usage,

Post » Sun Nov 18, 2012 11:26 pm

Hello,

My custom spell should not be used if the player is in a fight and instead of using an amount of magicka it should use 100% magicka and 100% stamina.
What has to be done to meet my conditions?

So far, I have created a nice magic effect and added the effect to a spell. I think I have to apply a script to my magic effect to reduce players attributes, right? But I have no idea how to prevent to use that spell being attacked.

Thanks for help
User avatar
Josh Dagreat
 
Posts: 3438
Joined: Fri Oct 19, 2007 3:07 am

Post » Sun Nov 18, 2012 9:15 pm

You can put an IsInCombat condition on your Magic effect.
User avatar
Budgie
 
Posts: 3518
Joined: Sat Oct 14, 2006 2:26 pm

Post » Mon Nov 19, 2012 4:45 am

Thanks Ingenue,

I tried GetAttacked before, but it wasn't working. Now I used your command with the player as target and zero as value. It works perfect, not the way I wanted but good enough, because the spell is casting and the message shows that the target resist... I was thinking the the spell isn't cast while being attacked. At the end of the day the result counts.

I solved magicka consumption. It is my first script, it works but is this ok or is something wrong?

Float myMagickaFloat myStaminaEvent OnEffectFinish(Actor akCaster, Actor akTarget)	 myMagicka = Game.GetPlayer().GetActorValue("Magicka") as Float	 Game.GetPlayer().DamageAV("Magicka", myMagicka)	 myStamina = Game.GetPlayer().GetActorValue("Stamina") as Float	 Game.GetPlayer().DamageAV("Stamina", myStamina)EndEvent

In the Magic Effect window at Target Condition I put GetActorValue Magicka >= 50 on the player. Means if Magicka lower than 50 points the spell will fail.
Actually I want 20% because if a player has 600 Magicka the 50 points limit are too low compared to a player with 100 Magicka. How can I solve this?
I thought I could use my script with OnEffectStart and calculate MaxMagicka * 0.2 and compare this in an if command with the current Magicka. But in a script, how do I stop that spell?
Thanks for help
User avatar
Isabel Ruiz
 
Posts: 3447
Joined: Sat Nov 04, 2006 4:39 am

Post » Mon Nov 19, 2012 7:01 am

There is a GetActorValuePercent condition you could use on your magic effect, too.

Don't use Game.GetPlayer(), by the way; it's slow. Add a property to your script of type Actor, called PlayerRef, and use that instead.
User avatar
Chris Guerin
 
Posts: 3395
Joined: Thu May 10, 2007 2:44 pm

Post » Mon Nov 19, 2012 6:20 am

Thanks again Ingenue and for the tip too.
Why do I always overlook those commands! :confused:
User avatar
Amy Gibson
 
Posts: 3540
Joined: Wed Oct 04, 2006 2:11 pm

Post » Sun Nov 18, 2012 10:30 pm

There is a GetActorValuePercent condition you could use on your magic effect, too.

Don't use Game.GetPlayer(), by the way; it's slow. Add a property to your script of type Actor, called PlayerRef, and use that instead.

I tried GetActorValuePercent but I don't get it to work.
If I use the Condition Function GetActorValue, select Magicka >= 50 and Run on Player, it is working perfectly. But if I change the condition to GetActorValuePercent, the spell is blocked from 0 to 100 percent magicka. If I change the comparisation to <= 50 the spell goes through from 0 too 100% magicka. the value isn't count in my case.
What am I doing wrong here?

Thanks for any help
User avatar
helliehexx
 
Posts: 3477
Joined: Fri Jun 30, 2006 7:45 pm

Post » Mon Nov 19, 2012 4:49 am

http://www.creationkit.com/GetActorValuePercent - I'm loving the extensive description on that one :D

http://www.creationkit.com/GetActorValue - Much better help/description


And so I wonder whether GetActorValuePercent is one of those functions that is not functioning correctly?
User avatar
Lynette Wilson
 
Posts: 3424
Joined: Fri Jul 14, 2006 4:20 pm

Post » Sun Nov 18, 2012 11:36 pm

I believe the condition, like the Papyrus function, returns 1.0 for 100%, 0.5 for 50%.
User avatar
Kate Schofield
 
Posts: 3556
Joined: Mon Sep 18, 2006 11:58 am

Post » Sun Nov 18, 2012 10:21 pm

Yes, thanks again.
It is pre-calculated 50/100=0.5 I just tested it and it works.

Thanks, now I'm done :wave:
User avatar
Robert
 
Posts: 3394
Joined: Sun Sep 02, 2007 5:58 am


Return to V - Skyrim