Combat Spell on Hit doesn't start: What's wrong?

Post » Sat Nov 17, 2012 7:31 am

Hi all,

I've made the following script and I've attached to a Perk Entry which would "cast" it with a Apply Combat Spell on Hit effect...

Scriptname VAoNAbsorbQuickeningScript extends activemagiceffect  import gameimport debugimport utilityimport soundimport globalvariableimport mathint function LearnThroughQuickening(Int iCount)int iCountB = 0intSkillGain = 0While (iCountB < flSkillRank.Length)If (flVictimStatistic[iCount] >= flSkillRank[iCountB])intRankWorth = (5 - iCountB)iCountB += 1EndIFEndWhileIf (flVictimStatistic[iCount]  > flImmortalStatistic[iCount])intSkillGain = floor((flVictimStatistic[iCount] - flImmortalStatistic[iCount]) * flConversionRatio)elseintSkillGain = 0EndIfint intCurrentKillSkillCount = (glKillStatisticCount[iCount].GetValue() as int) + intRankWorth + intKillWorthIf (intCurrentKillSkillCount >= 100)    intSkillGain += 1   intCurrentKillSkillCount -= 100EndIfglKillStatisticCount[iCount].SetValue(intCurrentKillSkillCount)Return intSkillGainendfunctionfunction AbsorbQuickening(Actor beheadedcorpseRef)bIsAbsorbing = trueForceThirdPerson()ESLightningAura.Play(beheadedcorpseRef, 10)beheadedcorpseRef.PlaySubGraphAnimation( "SkinFadeOut" )QuickeningPowerAbsorbISM.Apply()int soundInstanceFireID = NPCQuickeningDeathSequenceFireLPM.play(acImmortal)wait(0.20)    spReleaseQuickening.Cast(acVictim, acImmortal)acImmortal.PlayIdle(idTakeQuickening)acVictim.SetAttackActorOnSight()    wait(0.50)beheadEdcorpseRef.PlaySubGraphAnimation("BloodFade")    wait(0.75)spQuickeningExplosion.Cast(acVictim)QuickeningAbsorbEffect.Play(beheadedcorpseRef, 8, GetPlayer())QuickeningAbsorbManEffect.Play(GetPlayer(), 8, beheadedcorpseRef)NPCQuickeningDeathSequenceWind.play(acImmortal)NPCQuickeningDeathSequenceExplosion.play(acImmortal)wait(4)QuickeningPowerAbsorbFXS.Play(GetPlayer())wait(1)spPanick.Cast(acVictim)beheadedcorpseRef.SetGhost(true)beheadedcorpseRef.clearExtraArrows()QuickeningPowerAbsorbFXS.Stop(GetPlayer())StopInstance(soundInstanceFireID)QuickeningHolesSmokeFXS.Play(beheadedcorpseRef)    int soundInstanceSmolderID = NPCQuickeningDeathSequenceSmolderLPM.play(acImmortal)wait(2)acVictim.SetAttackActorOnSight(false)QuickeningAbsorbEffect.Stop(beheadedcorpseRef)QuickeningAbsorbManEffect.Stop(GetPlayer())ESLightningAura.Stop(beheadedcorpseRef)wait(0.5)    StopInstance(soundInstanceSmolderID)QuickeningHolesSmokeFXS.Stop(beheadedcorpseRef)    Debug.Notification("You have absorbed the Quickening from your enemy...")bIsAbsorbing = falseEndFunctionEvent OnEffectStart(Actor akTarget, Actor akCaster)acVictim = akTargetacImmortal = akCasterintImmortalLevel = acImmortal.GetLevel()intVictimLevel = acVictim.GetLevel()flConversionRatio = (intVictimLevel/intImmortalLevel) as floatint iCount = 0While (iCount < flSkillRank.Length)If ((flConversionRatio * 100) >= flSkillRank[iCount])intKillWorth = (5 - iCount)iCount += 1EndIFEndWhileiCount = 0While (iCount < strStatisticLabel.Length)flImmortalStatistic[iCount] = acImmortal.GetBaseActorValue(strStatisticLabel[iCount]) as floatflVictimStatistic[iCount] = acVictim.GetBaseActorValue(strStatisticLabel[iCount]) as floatiCount += 1EndWhileEndEventEvent OnDeath(Actor akKiller)  if (akKiller == Game.GetPlayer())	 int iCount = 0	 iChangeCount = 0	 string strAlternateText	 AbsorbQuickening(acVictim)	  While (iCount < strStatisticLabel.Length)	   intSkillGain = LearnThroughQuickening(iCount)    If (intSkillGain > 0)   	 IncrementSkillBy(strStatisticLabel[iCount], intSkillGain)   	 iChangeCount += 1   	      EndIf      if (strStatisticLabel[iCount] == "OneHanded")			  strAlternateText = "One Handed"		  elseif (strStatisticLabel[iCount]== "HeavyArmor")			   strAlternateText = "Heavy Armor"		  elseif (strStatisticLabel[iCount] == "TwoHanded")			    strAlternateText = "Two Handed"   		  elseif (strStatisticLabel[iCount] == "LightArmor")			    strAlternateText = "Light Armor"		  else			    strAlternateText = strStatisticLabel[iCount]		  endif    If (iChangeCount == 1)   	  strSummaryLabel = "Quickening granted you " + strAlternateText + " + " + intSkillGain	  elseif (iChangeCount > 1)   	  strSummaryLabel += ", " + strAlternateText + " + " + intSkillGain    EndIf    If ((iChangeCount > 0) && (iCount == (strStatisticLabel.Length - 1)))   	  strSummaryLabel += "."    EndIf    iCount += 1    EndWhile    If (iChangeCount > 0)    Debug.MessageBox(strSummaryLabel)        EndIf  endIfendEventActor Property acVictim AutoActor Property acImmortal AutoGlobalVariable Property QuickeningsAbsorbed  Auto  VisualEffect Property QuickeningAbsorbEffect AutoVisualEffect Property QuickeningAbsorbManEffect AutoEffectShader Property QuickeningPowerAbsorbFXS AutoEffectShader Property QuickeningHolesSmokeFXS AutoImageSpaceModifier Property QuickeningPowerAbsorbISM Autosound property NPCQuickeningDeathSequenceFireLPM autosound property NPCQuickeningDeathSequenceWind autosound property NPCQuickeningDeathSequenceExplosion autosound property NPCQuickeningDeathSequenceSmolderLPM autobool Property bIsAbsorbing  Auto  Conditional{true while the absorb sequence is running}SPELL Property spReleaseQuickening  Auto  SPELL Property spQuickeningExplosion  Auto  Explosion Property MAGQuickeningPowerAbsorbExplosion AutoEffectShader Property ESLightningAura  Auto  SPELL Property spPanick  Auto  Int Property intImmortalLevel  Auto  Int Property intVictimLevel  Auto  Float Property flConversionRatio  Auto  String[] Property strStatisticLabel  Auto  GlobalVariable[] Property glKillStatisticCount  Auto  Float[] Property flImmortalStatistic  Auto  Float[] Property flVictimStatistic  Auto  Float[] Property flSkillRank  Auto  Int Property intKillWorth  Auto  Int Property iChangeCount  Auto  Int Property intRankWorth  Auto  Int Property intSkillGain  Auto  String Property strSummaryLabel  Auto  Idle Property idTakeQuickening  Auto

The code is, in fact, attempting to grant skill points through Quickening absorption (like in Highlander) and make a nice "absorption scene"...

...the problem is...

...the script doesn't seem to kick off.

However...the only conditions set are that the weapon in hand is of appropriate type and the victim is a NPC...but it's not starting! :(

Please...help! :(

Thanks,
Jashkar
User avatar
Adam
 
Posts: 3446
Joined: Sat Jun 02, 2007 2:56 pm

Post » Fri Nov 16, 2012 10:12 pm

Apply Combat Hit Spell doesn't seem to work.

I've removed all Perk Owner conditions and left just the HasKeyword ActorTypeNPC...so it should apply the script each time the victim is hit...but doesn't work....

Updated: I've moved all script parts from the OnEffectStart to the OnDeath event and only left these on the former:

acVictim = akTarget
acImmortal = akCaster

However...the spell doesn't seem to be launched, because the script does nothing...


Please...anyone has any clue about why this could be happening?
User avatar
Nick Jase Mason
 
Posts: 3432
Joined: Sun Jul 29, 2007 1:23 am

Post » Sat Nov 17, 2012 3:53 am

Could be script lag, your script has so much going on at the moment of on hit that it could be taking up to 1 or 2 seconds to fire and by that time some conditions have changed to prevent it from working. This is just a guess (that the lag is at fault here) but Skyrim script lag is a fact, a fact that that prevents a lot of in depth (really cool) combat moding in Skyrim.

You could test this by reducing your script down to a TEST script with only a few commands and a result message box. Then slowy build up the script to what you have now until the script no longer works.


Apply Combat Hit Spell doesn't seem to work.

I've removed all Perk Owner conditions and left just the HasKeyword ActorTypeNPC...so it should apply the script each time the victim is hit...but doesn't work....

Updated: I've moved all script parts from the OnEffectStart to the OnDeath event and only left these on the former:

acVictim = akTarget
acImmortal = akCaster

However...the spell doesn't seem to be launched, because the script does nothing...


Please...anyone has any clue about why this could be happening?
User avatar
Brentleah Jeffs
 
Posts: 3341
Joined: Tue Feb 13, 2007 12:21 am

Post » Sat Nov 17, 2012 8:43 am

Could be script lag, your script has so much going on at the moment of on hit that it could be taking up to 1 or 2 seconds to fire and by that time some conditions have changed to prevent it from working. This is just a guess (that the lag is at fault here) but Skyrim script lag is a fact, a fact that that prevents a lot of in depth (really cool) combat moding in Skyrim.

You could test this by reducing your script down to a TEST script with only a few commands and a result message box. Then slowy build up the script to what you have now until the script no longer works.

You're right...however...I'll probably drop the whole "highlander-like immortal" idea...

After all my mod already has some artefacts and spells that do things like those I'd have implemented...and the script is probably too heavy to work properly.

Thanks anyway,
Jashkar
User avatar
Isaiah Burdeau
 
Posts: 3431
Joined: Mon Nov 26, 2007 9:58 am


Return to V - Skyrim