Jump to content

[LE] Stagger on Casting.


Recommended Posts

Hello y'all, long time no see...
I'm trying to make a spell stagger the player upon casting it to simulate the impact (it will be a sort of fireball cannon), but so far, I had zero successes.
Does anyone have a tip on this? Thanks!

Link to comment
Share on other sites

You need 2 spells for this, the first is your 'fireball cannon' and the second is a 'fire and forget' or 'delivery type self' stagger spell.
The second will be casted by a script living on your 'fireball cannon' magic effect.
Script example:

Spell Property MyStaggerSpell Auto
 
Event OnEffectStart(Actor akTarget, Actor akCaster)
           MyStaggerSpell.Cast(akCaster, akCaster)
EndEvent

Or, put the player on a quest Alias and run this:

Spell Property MyFireballCannon Auto
Spell Property MyStaggerSpell Auto
 
Event OnSpellCast(Form akSpell)
         If ( akSpell == MyFireballCannon )
               MyStaggerSpell.Cast(PlayerREF, PlayerREF)
  EndIf
EndEvent

 

 

 

But less expensive is option A.

Edited by maxarturo
Link to comment
Share on other sites

 

You need 2 spells for this, the first is your 'fireball cannon' and the second is a 'fire and forget' or 'delivery type self' stagger spell.
The second will be casted by a script living on your 'fireball cannon' magic effect.
Script example:

Spell Property MyStaggerSpell Auto
 
Event OnEffectStart(Actor akTarget, Actor akCaster)
           MyStaggerSpell.Cast(akCaster, akCaster)
EndEvent

Or, put the player on a quest Alias and run this:

Spell Property MyFireballCannon Auto
Spell Property MyStaggerSpell Auto
 
Event OnSpellCast(Form akSpell)
         If ( akSpell == MyFireballCannon )
               MyStaggerSpell.Cast(PlayerREF, PlayerREF)
  EndIf
EndEvent

 

 

 

But less expensive is option A.

 

 

Dang, I'd need to deal with scripting, then? Thanks a lot, man, but unfortunately, I have no idea of how to approach this and Papyrus is very confusing. But I'll try my best to read some resources and try to apply what I learn.

 

EDIT: I've been trying what you said for the last few hours, but the magic effect doesn't even appear in the dropdown menu to be added to the Cannon spell, no matter what I do.

Edited by Krijanowsky
Link to comment
Share on other sites


"EDIT: I've been trying what you said for the last few hours, but the magic effect doesn't even appear in the dropdown menu to be added to the Cannon spell, no matter what I do. "


You need to create a complete spell and then find it from the drop down menu, And Not A Magic Effect!.



For what you want to do things are very simple.

1) Create your 2 spells.

2) Open your 'fireball cannon' magic effect.

3) In the bottom right section of the window there is the 'Papyrus Script' section.

- Press 'Add'

- When the window with scripts opens select the first in the row, 'New Script'.

- Now a small window will appear, here you only need to give the new script your unique ID, then press 'OK'.

- Now a blank window will appear that has only the script's name you gave to it, below that line copy/paste the bellow:



Spell Property MyStaggerSpell Auto

Event OnEffectStart(Actor akTarget, Actor akCaster)
MyStaggerSpell.Cast(akCaster, akCaster)
EndEvent


Now save to compile the script and exit this window.


4) In your 'fireball cannon' magic effect, in the scripts section you will now see your script, select it and press 'Properties'.

The script should have only 1 property, your 'MyStaggerSpell', click on it and find from the drop down menu your stagger spell and you are done.

TIP: If when you create your stagger spell you give it the ID that's in the script "MyStaggerSpell', then in this step you won't need to search for it in the drop down menu, but you can just hit the 'Auto Fill' button and it will be added automaticaly.

Edited by maxarturo
Link to comment
Share on other sites

 

"EDIT: I've been trying what you said for the last few hours, but the magic effect doesn't even appear in the dropdown menu to be added to the Cannon spell, no matter what I do. "
You need to create a comlete spell and then find it from the drop down menu, And Not A Magic Effect!.
For what you want to do things are very simple.
1) Create your 2 spells.
2) Open your 'fireball cannon' magic effect.
3) In the bottom right section of the window there is the 'Papyrus Script' section.
- Press 'Add'
- When the window with scripts opens select the first in the row, 'New Script'.
- Now a small window will appear, here you only need to give the new script your unique ID, then press 'OK'.
- Now a blank window will appear that has only the script's name you gave to it, below that line copy/paste the bellow:
Spell Property MyStaggerSpell Auto
 
Event OnEffectStart(Actor akTarget, Actor akCaster)
      MyStaggerSpell.Cast(akCaster, akCaster)
EndEvent
Now save to compile the script and exit this window.
4) In your 'fireball cannon' magic effect, in the scripts section you will now see your script, select it and press 'Properties'.
The script should have only 1 property, your 'MyStaggerSpell', click on it and find from the drop down menu your stagger spell and you are done.
TIP: If when you create your stagger spell you give it the ID that's in the script "MyStaggerSpell', then in this step you won't need to search for it in the drop down menu, but you can just hit the 'Auto Fill' button and it will be added automaticaly.

 

 

I created both spells and attached a small debug script to see when the effect on them is fired and well, as separate spells, they work as intended: the cannon ball gives me a notification only when it hits an npc and the stagger spell as soon as I cast it. Oddly enough, when I put your script inside the cannon MEffect and cast the spell ingame, two things happen:

 

First, the stagger only occurs when the spell hits an npc, but that's not what I want. I'd like it to stagger the player at the moment of the casting.

 

Second, when the spell hits a target and the stagger (on the player) begins, it doesn't stop. I had to Alt F4 my game Haha

I don't know if it matters, but the delivery type of the spells is, for the cannon, Aimed and for the stagger, Self.

 

The script is like this inside the Magic Effect:

Scriptname AAACannonBallScript extends activemagiceffect  

SPELL Property StaggerSpellProperty  Auto  

Event OnEffectStart(Actor akTarget, Actor akCaster)
     Debug.MessageBox("Got Staggered?")
     StaggerSpellProperty.Cast(akCaster, akCaster)
EndEvent

 

Link to comment
Share on other sites

"First, the stagger only occurs when the spell hits an npc, but that's not what I want. I'd like it to stagger the player at the moment of the casting."

- This is supposed to happen, because a spell's damage/fx fires ONLY when it hits it's target/actor.

This is how the Skyrim spells system works.


"Second, when the spell hits a target and the stagger (on the player) begins, it doesn't stop. I had to Alt F4 my game"

- You have to add a 'Duration' to your stagger spell and to NOT have it as a constant fx, the issue is not with the script or the logic, but with how you created the 'Stagger' spell.


* Writing an alternative solution for you, but give me a few minute, I'm also watching a movie while thinking and typing.

Edited by maxarturo
Link to comment
Share on other sites

 

"First, the stagger only occurs when the spell hits an npc, but that's not what I want. I'd like it to stagger the player at the moment of the casting."
- This is supposed to happen, because a spell's damage/fx fires ONLY when it hits it's target/actor.
This is how the Skyrim spells system works.
"Second, when the spell hits a target and the stagger (on the player) begins, it doesn't stop. I had to Alt F4 my game"
- You have to add a 'Duration' to your stagger spell and to have it as a constant fx, the issue is not with the script or the logic, but with how you created the 'Stagger' spell.
* Writing an alternative solution for you, but give me a few minute, I'm also watching a movie while thinking and typing.

 

Oh, I see. I am trying to fix the stagger spell now.

Thank you for the guidance and patience, it's been REALLY great to have someone to point me in the right direction.

And, of course, good movie to you!

 

Link to comment
Share on other sites

For this approach you will need 3 spells and 2 scripts.

1) You have the 'fireball cannon' and the 'Stagger' spell, now you need an 'Ability' spell. We will call it 'MyAbHoldingStaggerSpell'

- This ability spell (MyAbHoldingStaggerSpell) will have a magic effect with archtype "Script", with no duration and no area.

* You can see how some vanilla spells have their magic effects set up when using archtype script, I can't recall right now one.


2) You will now need to create a quest if you don't have already one and put the payer on a quest alias, and in the alias add this:



Alias Property PlayerAlias Auto
Spell property MyAbHoldingStaggerSpell Auto
Spell Property MyFireballCannonSpell Auto

Event OnObjectEquipped(Form akBaseObject, ObjectReference akReference)
If ((akBaseObject as Spell) == MyFireballCannonSpell)
Actor ActorPlayer = PlayerAlias.GetActorReference()
ActorPlayer.AddSpell(MyAbHoldingStaggerSpell)
EndIf
EndEvent

Event OnObjectUnequipped(Form akBaseObject, ObjectReference akReference)
If ((akBaseObject as Spell) == MyFireballCannonSpell)
Actor ActorPlayer = PlayerAlias.GetActorReference()
ActorPlayer.RemoveSpell(MyAbHoldingStaggerSpell)
EndIf
EndEvent



3) In the magic effect of your Ability spell (MyAbHoldingStaggerSpell) you will add this script:



Spell Property MyFireballCannon Auto
Spell Property MyStaggerSpell Auto
Actor Property PlayerREF Auto

Event OnSpellCast(Form akSpell)
If ( akSpell == MyFireballCannon )
MyStaggerSpell.Cast(PlayerREF, PlayerREF)
EndIf
EndEvent



* This is as simplified as I could come up with, and there are different ways to achieve your effect that are a little bit more complicated, this one is just a simple alternative, maybe someone else with a clearer head can suggest something else.

The movie I'm watching has absorbed all my attention, sorry...

Have a nice week.

Edited by maxarturo
Link to comment
Share on other sites

  • 4 weeks later...

Sorry for the very very late reply, but I've been through some real life problems. Anyways, thank you for this!
I admit that this is a real challenging approach since I know very little about modding, but I'll give it a lot of tries. XD

Link to comment
Share on other sites

  • Recently Browsing   0 members

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