Jump to content

Spell Scripting Help


jamochawoke

Recommended Posts

How about adding a low damage health effect to the spell? Also, it may matter whether you put it before or after your fortify speed effect. I would try both to see if any turn out the way you want.

 

Ah I did this. Was one of the first things I thought of. However, NPC's refuse to cast a spell on themselves that is considered detrimental. So even if you have a damage value of 0 and a healing value of 10,000, the NPC will never cast it because it has that "detrimental" flag on the Damage Health spell effect.

 

The only way to get that shader on is to use a scripted spell with the shader effect.

Edited by jamochawoke
Link to comment
Share on other sites

How about trying this?

 

scn example

short doOnce

Begin ScriptEffectStart

PlaySound WerewolfHowl

End

Begin ScriptEffectUpdate

if doOnce == 0
	StopMagicEffectVisuals FOAT
	PlayMagicEffectVisuals DGHE
	set doOnce to 1
endif

End

 

Your script effect should stop showing the fortify attribute effect and play the damage health effect instead. (I'm not sure whether it's magic effect visuals or magic shader visuals...)

Edited by fg109
Link to comment
Share on other sites

Ok so I went ahead and got your script working.

 

Now it shows both the magic visuals for fortify attribute and damage health lol :/..

 

I think what's going on is Fortify Attribute: Speed is always getting bumped to the top of the list no matter what. So it has priority. The script starts executing maybe like .1 second after the Fortify Attribute effect has already started. So even though the script does stop the effect, it's already displayed and takes a few more .1 seconds to dissapear while the damage health shader is playing.

 

There has to be a way to simply change the shader of the spell while retaining the fortify attribute effect AND maintaining the ability to cast it throughout the fight.

 

EDIT:::

 

Further testing. I made an entirely scripted spell. However, the NPC absolutely refused to cast it. It would only cast the spell on itself if it had an effect marked beneficial (shield, healing, fortify attribute, et cetera).

 

Right now I am stuck with a perfectly balanced combat style for the werewolf with several unique effects and animations but when he casts his buff and howls both the Damage Health and Fortify Attribute casting effects are shown. I'm not certain if I can live with it because the Fortify Attribute (restoration) effect is very "sparkly" so to speak. Together they don't look that bad... but still. Kind of weird for a bloodthirsty bast.

Edited by jamochawoke
Link to comment
Share on other sites

Well, I don't really know what else you can do. I suppose you try to put a script on the werewolf with conditions on when to cast the spell. For example:

 

scn example

Begin GameMode

if (IsInCombat)
	if (GetAV Health > (0.25 * GetAV Health)) && (HasMagicEffect FOAT == 0) && (GetAV Magicka > 60)
		Cast customspell GetSelf
	elseif (GetDistance Player > 500) && (GetAV Health <= (0.25 * GetAV Health)) && (HasMagicEffect FOAT == 0) && (GetAV Magicka > 60)
		Cast customspell GetSelf
	endif
endif

End

 

That would make the werewolf cast the spell whenever it's in combat and has over 60 magicka, when it doesn't already have a fortify attribute effect on it. (I'm uncertain whether scripting an NPC to cast a spell actually uses any magicka, so you would have to test it out and see.) And if it gets below 25% health, then it would only cast the spell when there's 500 units of distance (I think that's around 2 or 3 body lengths) between itself and the player. You know, so the player doesn't get any free hits in that might just kill it.

 

For the custom spell, set the script effect duration to whatever you want the fortify attribute to last for, set the visual effect to damage health, then for the script use something like this:

 

scn example2

Begin ScriptEffectStart

PlaySound WerewolfHowl
AddSpell fortifyspeedability

End

Begin ScriptEffectFinish

RemoveSpell fortifyspeedability

End

 

And you'll also need to make the fortify speed ability. I don't think adding it as an ability will play the magic effects.

Edited by fg109
Link to comment
Share on other sites

If you want to do it like the deadroth, then you should check sounds in CS. Combat style is not relevant, since it it only defines combat, not magic.

 

Each Deadroth has several sounds defined in the Creature -> Sounds tab. Like aware, death, hit, .... . The aware sound is probably what you refer to.

 

Define these sounds for your werewolf, and make sure, that the animation you use for the spell (castself.kf or casttarget.kf) has this key word. To find out: check the kf's NoTextKeyExtraData with NifSkope.

Link to comment
Share on other sites

I suppose you try to put a script on the werewolf with conditions on when to cast the spell.

 

Ok I made a trial script based off of yours to see if I could make this work. Here's what I got (note, GetSelf was not considered a proper object reference and refused to save it so I had to use a persistent ID reference :/).

 

scn WerewolfSpellActivate

Begin GameMode

       if (IsInCombat)
               if (GetAV Health > (0.25 * GetAV Health)) && (HasMagicEffect FOAT == 0) && (GetAV Magicka > 60)
                       Cast WerewolfBloodthirst Wolf1
               elseif (GetDistance Player > 500) && (GetAV Health <= (0.25 * GetAV Health)) && (HasMagicEffect FOAT == 0) && (GetAV Magicka > 60)
                       Cast WerewolfBloodthirst Wolf1
               endif
       endif

End

 

I removed the spell WerewolfBloodthirst from the creature's spell inventory.

I then added the script to the creature entry to cast the spell instead of the ai.

 

When I loaded the game the werewolf, upon noticing me, went into hand to hand idle stance... then didn't do anything. It just froze. This happened every time. Once I removed the script the werewolf returned to normal combat functions.

 

I don't get it :/.

 

 

Also, how do you go about removing scripts? I have quite a few trial custom scripts now that are cluttering my script choices up.

Edited by jamochawoke
Link to comment
Share on other sites

And I would use TES4Edit to delete stuff.

 

I tried it out myself and figured out what went wrong. It's because the werewolf's object script processes faster than the spell script, so it never gets the fortify attribute effect before the werewolf checks conditions for casting the spell again. I modified the werewolf object script to this, and it worked:

 

scn testcreaturescript

ref self
ref target

float timer

Begin GameMode

if (timer > 0)
	set timer to timer - GetSecondsPassed
endif

if (IsInCombat == 1) && (HasMagicEffect FOAT == 0) && (GetAV Magicka >= 20) && (timer <= 0)
	set self to GetSelf
	set target to GetCombatTarget
	if (GetDistance target > 500)
		Cast testspell self
		ModAV2 Magicka -20
		set timer to 1
	elseif (GetAV Health > (0.25 * GetAV Health))
		Cast testspell self
		ModAV2 Magicka -20
		set timer to 1
	endif
endif

End

 

I had to use ModAV2 because I noticed it wasn't using any magicka to cast the spell, even though I clearly put a magicka cost on the spell.

Edited by fg109
Link to comment
Share on other sites

"Fortify" spells always have a magic shader effect of "heal" i would first make custom shader rather than go to scripting,and also all werewolfs are silenced,last few scripts were ok but they will cause bugs.

 

Why not AddSpell command i think its better.

Link to comment
Share on other sites

"Fortify" spells always have a magic shader effect of "heal" i would first make custom shader rather than go to scripting,and also all werewolfs are silenced,last few scripts were ok but they will cause bugs.

 

 

I haven't gotten to try the scripts yet (at school atm) but I wanted to mention that this is a mod I am making, just using the resources (so not completely from scratch) from the bottom up because I wanted something simpler than what was offered in a lot of the werewolf mods (the whole clans/epic quest/etc deal... I just want some roving mobs for atmosphere for now). So everything I am discussing is from my mod and not anyone elses (unless it's a problem with textures/meshes/animations/sound files... which I am OK at dealing with).

 

Right now the mod is just for personal use. I might release it if it ever becomes something release-worthy as a vanilla drop add-on if I can get permission to use the resources.

Edited by jamochawoke
Link to comment
Share on other sites

  • Recently Browsing   0 members

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