Conditions to allow sneak spell damage on the first cast ?

Post » Sat Nov 17, 2012 1:34 am

Ok. Lets say I want to add a sneak attack damage to Fireball.

My idea is attaching another effect to the Fireball spell, which would deal additional damage but only under certain circumstances. One of the conditions would be 'caster is sneaking' for sure. But I'm not sure about other conditions related to the enemy behavior towards the player.

For example, I want the player to be able to deal sneak damage only on the first cast when the enemy is idle. Don't want the sneak to work after that, when the enemy is already searching for the player, etc.

Any idea which conditions should I use on the effect?
User avatar
Tanya
 
Posts: 3358
Joined: Fri Feb 16, 2007 6:01 am

Post » Sat Nov 17, 2012 7:06 am

Since ActiveMagicEffect scripts aren't bound to an object, they'll not retain any variable or property values between castings. You'll need to keep track elsweyr, like with a quest or some GlobalVariables. You could set up the spell to OneOfYourQuestAliases.http://ForceRefTo(akTarget), then deal with the opponent(s) from their ReferenceAlias script(s), storing the variables there and then http://www.creationkit.com/Clear_-_ReferenceAlias 'em when they're toast/no longer in combat.
User avatar
Josee Leach
 
Posts: 3371
Joined: Tue Dec 26, 2006 10:50 pm

Post » Sat Nov 17, 2012 7:47 am

on the magic effect that deals extra damage:

IsSneaking == 1 AND
IsInCombat == 0 AND
GetGlobalValue AlreadyCast == 0 AND



(AlreadyCast is just an arbitrary name, you would need to create a globalvariable and use this in its place)


create a constant effect ability that tracks the value for the global you created, use these conditions


IsInCombat == 1


and these events for your script

OnEffectStart

AlreadyCast.SetValue(1)




OnEffectFinished

AlreadyCast.SetValue(0)
User avatar
Charles Weber
 
Posts: 3447
Joined: Wed Aug 08, 2007 5:14 pm

Post » Fri Nov 16, 2012 7:09 pm

on the magic effect that deals extra damage:

IsSneaking == 1 AND
IsInCombat == 0 AND
GetGlobalValue AlreadyCast == 0 AND

Hmm, from what I saw in some tests I don't think this will work. I noticed that as soon as a spell approach an enemy (a few meters), that enemy already starts looking for the player (the eye opens a little bit) and you enter combat. So, when the spell hits, the player will already be in combat. Seems the enemy see or listen the projectile itself and immediately becomes aware before being hit, spoiling the IsInCombat condition.

What about the GetDetected condition? Anyone know how exactly it works?
User avatar
Cassie Boyle
 
Posts: 3468
Joined: Sun Nov 05, 2006 9:33 am

Post » Sat Nov 17, 2012 2:34 am

is your spell set to silent cast? enemies should not be alerted if your spell is silent
User avatar
jennie xhx
 
Posts: 3429
Joined: Wed Jun 21, 2006 10:28 am

Post » Sat Nov 17, 2012 12:28 am

is your spell set to silent cast? enemies should not be alerted if your spell is silent

Yes, I had Quiet casting. I believe this perk makes your spells make no sound when cast, but enemies can still see the projectile itself and react to it before being hit. If you pause the game just before the spell hits, you can see the eye is already open and player.isincombat returns true.
User avatar
Barbequtie
 
Posts: 3410
Joined: Mon Jun 19, 2006 11:34 pm


Return to V - Skyrim