Jump to content

Conditions and spell applied via on hit effect


Recommended Posts

Hello,

 

I'm trying to edit an existing script from a mod ( scripted stagger on hit). And I'm confronted to a problem. The mod add a stagger effect to weapon attacks.

Here is the script :

criptname StaggerOnHit extends activemagiceffect  

SPELL Property stspell  Auto 

Auto State Ready

  Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, \
  bool abBashAttack, bool abHitBlocked)
    
    GoToState("Busy")
    Form RightHandWep = (akAggressor as Actor).GetEquippedWeapon(0)
    Form LeftHandWep = (akAggressor as Actor).GetEquippedWeapon(1)
    if !abPowerAttack  && akAggressor == Game.GetPlayer()
        stspell.Cast(GetTargetActor())
        Utility.Wait(0.1)
  endif
    GoToState("Ready")
  EndEvent
EndState

State Busy
EndState

As I understand it, the script attach a spell to a hit effect.

Now, I'm looking for a way to make the effect different with different weapons. My idea was to attach a condition for the spell regarding the weapon used by the actor who attacked. The problem is that... I don't know how to tell the CK to look for the attacker. I tried in "condition item" to switch the "run on" in every possible way I though of (target, subject, etc), swap subject and target... It never looks for the attacker. It's always the weapon of the victim of the spell which is checked. The only explanation I can think of is that with this script, the attacker is actually not considered as the caster of the stagger spell. Because the caster is the victim.

Could someone tells me if I'm right, and maybe a way to make it work ?

Edited by Arael54
Link to comment
Share on other sites

The event OnHit() is used when you want something to happen when the target 'gets hit'.


I'm trying to understand your idea and i did read carefully your post, but it confuses me.

Try explaining in detail and with simple words your idea: a, b, c, d, etc...


Don't analyze the problems you faced while trying to make your idea work, but analyze your idea.

This is the only way the reader can understand what's actually on your head and can provide the proper assistance.

Link to comment
Share on other sites

I understand. As you can probably tell, I don't know much about scripting; All I can do at the moment is more or less understand how existing scripts work and how to modify them. Sadly I don't know yet which method to use and why.

 

So, as you suggested, I'll try to explain my idea and what happened :

- I was trying to find a way to apply stagger when actors attack, with a different stagger depending of the weapon used ;

- I found this mod (scripted stagger on hit) ;

- The mod does add stagger, with this script that cast a spell, but the magnitude of the effect is always the same ;

- I try to find a way to modify the mod to add different stagger magnitudes depending of the weapon used ;

- I tried to find a way to add condition to the spell, the magic effect or even with a perk that limit stagger so I can add different staggers, by trying to point it to the attacker ;

- As you pointed it, that it wasn't working because the script wasn't casting the spell from the attacker, but from the victim ;

- I'm still trying to find a way to be able to make attacks stagger depending of the weapon used, by modify the script, or with a different script, or with any other solution but modifying attack data.

Edited by Arael54
Link to comment
Share on other sites

Ok now i understand, but i must highlight the fact that what you want to do is in the level of an expert modder and scripter, it's not as easy as to just add some conditions on a spell here and a script there and you are done.


In order for this to work you will need a plethora of things to work together since we are talking about all the kinds of weapons that exists ingame that should fire different attributes (different spell damage) depending on which hand is equipped and what weapon is equipped.

And all of this to be handled by a script that I roughly estimate could easily be around at least 250+ lines.


In another post of yours dylbill gave you a draft idea of how this could work.


Can't expand this any further cause i'm on vacations and after 2 hours my girl is FINALLY ready for our neight out.

Have a pleasant neight everyone!!

Edited by maxarturo
Link to comment
Share on other sites

 

Ok now i understand, but i must highlight the fact that what you want to do is in the level of an expert modder and scripter, it's not as easy as to just add some conditions on a spell here and a script there and you are done.
In order for this to work you will need a plethora of things to work together since we are talking about all the kinds of weapons that exists ingame that should fire different attributes (different spell damage) depending on which hand is equipped and what weapon is equipped.
And all of this to be handled by a script that I roughly estimate could easily be around at least 250+ lines.
In another post of yours dylbill gave you a draft idea of how this could work.
Can't expand this any further cause i'm on vacations and after 2 hours my girl is FINALLY ready for our neight out.
Have a pleasant neight everyone!!

 

Thank you, I indeed understand I'm not quite there yet. A different animation event for each type of weapon (sword, dagger, bow, etc) with a different stagger value could suffice ? So ~8 different event ?

I need to understand this a bit more (well, a lot more).

Thanks for you help, and happy holidays !

Link to comment
Share on other sites

Very simple, though the onhit event is fairly intensive. The script you posted makes very little sense in the way it is written. Distinguishing between right and left handed weapon does nothing here and the onhit event already takes that into account. It tells you what weapon hit the target. Here's essentially what you'd want.

 

 

Scriptname StaggerOnHit extends activemagiceffect
SPELL Property stspell1 Auto
SPELL Property stspell2 Auto
SPELL Property stspell3 Auto
SPELL Property stspell4 Auto
SPELL Property stspell5 Auto
SPELL Property stspell6 Auto
SPELL Property stspell7 Auto
SPELL Property stspell8 Auto
Keyword Property WeapTypeBattleAxe Auto
Keyword Property WeapTypeBow Auto
Keyword Property WeapTypeDagger Auto
Keyword Property WeapTypeGreatsword Auto
Keyword Property WeapTypeMace Auto
Keyword Property WeapTypeSword Auto
Keyword Property WeapTypeWaraxe Auto
Keyword Property WeapTypeWarhammer Auto
Actor Target
Event OnEffectStart(Actor AkTarget, Actor AkCaster)
Target = AkTarget
EndEvent
Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
weap = aksource as weapon
if weap
if weap.haskeyword(WeapTypeBow)
stspell1.Cast(akAggressor, target)
EndIf
if weap.haskeyword(WeapTypeDagger)
stspell2.Cast(akAggressor, target)
EndIf
if weap.haskeyword(WeapTypeSword)
stspell3.Cast(akAggressor, target)
EndIf
if weap.haskeyword(WeapTypeWaraxe)
stspell4.Cast(akAggressor, target)
EndIf
if weap.haskeyword(WeapTypeMace)
stspell5.Cast(akAggressor, target)
EndIf
if weap.haskeyword(WeapTypeGreatsword)
stspell6.Cast(akAggressor, target)
EndIf
if weap.haskeyword(WeapTypeBattleAxe)
stspell7.Cast(akAggressor, target)
EndIf
if weap.haskeyword(WeapTypeWarhammer)
stspell8.Cast(akAggressor, target)
EndIf
Endif
EndEvent
You'd have to make 8 different spells that have the magnitudes you want and line set the properties correctly. Honestly, instead of stspell1-stspell8, maybe call them stspellBow, stspellDagger, etc. for simplicity's sake.
Link to comment
Share on other sites

  • Recently Browsing   0 members

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