Scripted OnHit Bleeding Effect?

Post » Tue Jun 19, 2012 11:57 am

I have an OnHit script that calculates if a weapon strike is successful.
If it is successful, I want to add a bleeding effect to the struck actor... the one with the script attached.

I declared the spell...
SPELL PROPERTY BleedingSpell AUTO

And I attempted to cause the struck actor to cast the bleeding spell on itself...
BleedingSpell.cast(Self , Self)

I also filled the property with the Bleeding Spell from the vanilla game. I updated the spell to have a magnitude of 10 with a duration of 10.

I can strike the target... and the strike succeeds according to my calculations, however, no health drain takes place at all.

Am I missing something?
User avatar
Javaun Thompson
 
Posts: 3397
Joined: Fri Sep 21, 2007 10:28 am

Post » Tue Jun 19, 2012 1:42 pm

Was it a levelled actor that you were hitting? There's something on the wiki that states that scripts aren't applied to levelled actors:

You may not attach a script to an actor if that actor would be used by a leveled actor list. If an actor is used in a leveled actor list, its "Scripts" section will be disabled.
  • There is a workaround in this in cases where you need actors to be both leveled and scripted - you can create a constant/self magic effect and apply that at the race level. For example, the FXDragonBloodDamageScript handles applying some special blood FX to dragons through combat. Since dragons are used to populate leveled lists, however, we attach this script to AbFXDragonBloodDamage, which is an effect on the AbDragonBloodFX spell. That's then assigned as a special racial ability of the DragonRace. You can look at a similar example in how the WispMothers work, too.
http://www.creationkit.com/Actor_Script

Perhaps that's the problem?
User avatar
Karl harris
 
Posts: 3423
Joined: Thu May 17, 2007 3:17 pm

Post » Tue Jun 19, 2012 1:27 am

Was it a levelled actor that you were hitting? There's something on the wiki that states that scripts aren't applied to levelled actors:

I believe thats talking about sticking scripts to the actor in the ck, the poster is trying to stick a script in game

I have an OnHit script that calculates if a weapon strike is successful.
If it is successful, I want to add a bleeding effect to the struck actor... the one with the script attached.

What is this OnHit Script attached to? If its attached to the weapon, OnHit won't work the way you think it should. OnHit is used to detect when an object/actor is being hit, not when it is hitting something.
User avatar
Austin Suggs
 
Posts: 3358
Joined: Sun Oct 07, 2007 5:35 pm

Post » Tue Jun 19, 2012 11:00 am

There's something on the wiki that states that scripts aren't applied to levelled actors:

Now THAT is very interesting. Thank you for letting me know about it.


Was it a levelled actor that you were hitting?
What is this OnHit Script attached to?

I've got the script attached to Hadvar. I'm testing it out as soon as we enter the keep after the dragon attack in Helgen. Everything seems to work properly there. I've had bleeding effects applied before, but never through a script. I'm just not sure if I've got the syntax correct. Is there a script from vanilla that applies spells inside of an OnHit event? I've been modifying my script from a Wabbajack script :-P
User avatar
CRuzIta LUVz grlz
 
Posts: 3388
Joined: Fri Aug 24, 2007 11:44 am

Post » Tue Jun 19, 2012 2:07 am

Is there a script from vanilla that applies spells inside of an OnHit event? I've been modifying my script from a Wabbajack script :-P

Yes. There are four scripts that do. They are:

DA13SpellBreakerEnchScript
DragonPriestUltraMaskEffect
dunHarmugstahlSpiderDead
PerkAvoidDeathScript

Check out my script index in my signature. I took the list of scripts that use OnHit event, and Cast function, compared the lists and looked through the common scripts to see which ones used cast in OnHit.

-MM
User avatar
aisha jamil
 
Posts: 3436
Joined: Sun Jul 02, 2006 11:54 am

Post » Tue Jun 19, 2012 11:19 am

Oh my, thank you very much! I hope that will do the trick! :-)
User avatar
Tarka
 
Posts: 3430
Joined: Sun Jun 10, 2007 9:22 pm

Post » Tue Jun 19, 2012 5:41 am

Also for target impacting scripts, the OnEffectStart event triggers when the effect applies to the victim. Target will be a reference to your victim which you can store in a local variable to the script. From within the ActiveMagicScript you can setup ANY event triggers that would normally apply to the target. Here's a sample script I wrote because I didn't like the way that paralysis works in the game:

Scriptname mm_BeluaBreathOfFrostScript extends ActiveMagicEffect Spell Property mm_BeluaVampireBreathOfFrostSpell AutoActor TheTargetEvent OnEffectStart(Actor target, Actor caster)if caster.GetActorValue("Magicka") < 25  caster.UnEquipSpell(mm_BeluaVampireBreathOfFrostSpell,2)  Self.Dispel()  target.DispelSpell(mm_BeluaVampireBreathOfFrostSpell)else  caster.DamageActorValue("Magicka",25)  TheTarget = targetendifEndEventEvent OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)TheTarget.EnableAI(false)utility.wait(5)TheTarget.EnableAI(true)EndEvent

You could just as easily intercept any of the http://www.creationkit.com/ObjectReference_Scriptevents for your target in your ActiveMagicEffect script AS LONG AS the magic effect is active on them. It's a great way to apply scripts dynamically to actors within range of a cloak spell or something.

-MM
User avatar
Sarah MacLeod
 
Posts: 3422
Joined: Tue Nov 07, 2006 1:39 am

Post » Tue Jun 19, 2012 1:47 am

Thank you :-)

I still seem to be having trouble getting a spell to work for some reason. I can get these to work...

Target.PushActorAway(Target, 0)
and...
Target.kill(Target)

But I can't get a spell to consistently work. Here are some snippets of code...

SPELL PROPERTY Bleeding AUTOActor property Target autoEvent OnEffectStart(Actor akTarget, Actor akCaster)Target = akTargetendEventEvent OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, \  bool abBashAttack, bool abHitBlocked)Bleeding.cast( Target , Target )EndEvent


I also tried a fire spell using this under the OnHit Event...

FireSAWD.Cast(GetTargetActor())

It seems that it only took place VERY rarely... and it only set the attacker on fire :-P


I know it's difficult to know why without putting the whole code... I guess I'm just trying to figure out how to apply a spell properly. I modified the Bleeding spell and effect to cost no magicka. It should do 10 damage for 10 seconds. It's doing nothing :-P
User avatar
Rachel Briere
 
Posts: 3438
Joined: Thu Dec 28, 2006 9:09 am

Post » Tue Jun 19, 2012 4:32 pm

YAY!!! I got a bleeding spell to work! :-D

Now, I can't get a stagger spell to work, hahaha! :-P
User avatar
Gill Mackin
 
Posts: 3384
Joined: Sat Dec 16, 2006 9:58 pm

Post » Tue Jun 19, 2012 3:26 am

YAY!!! I got a bleeding spell to work! :-D

Now, I can't get a stagger spell to work, hahaha! :-P

Sweet! Congrats!
User avatar
Jaylene Brower
 
Posts: 3347
Joined: Tue Aug 15, 2006 12:24 pm

Post » Tue Jun 19, 2012 5:09 am

Kageseigi,

Would you be willing to share what you did for the Bleeding spell itself? I have a spell called "Blood Rend" for my vampire, which "rips the blood from the attackers" and allows you to absorb it. I've got a stream of particles which flows to the caster, but I'd like to actually make the targets bleed and haven't figured out quite how to do that, even though I have impact data set to one of the Bleeding sets.

Thanks!

-MM
User avatar
glot
 
Posts: 3297
Joined: Mon Jul 17, 2006 1:41 pm


Return to V - Skyrim