Jump to content

Item Script issues


Recommended Posts

Hello, so i combined 9 items scripts into one to make it easier to access the effects, and it worked but now i am running into another issue, i created a replica of a set of armor that this item was initially for and made it work with the replica but it seems that since i added the replica part the item isnt working as it was before, here is the script

ScriptName 00AXMItemDKNebulaRiftRingScript

Float Fame
Float Infamy
Float OldDay
Float CurrentDay
Float Modifier
Float ACrime
Float DarkKingsCrime

Float CFatigue
Float PFatigue
Float CHealth
Float PHealth
Float CMagicka
Float PMagicka
Float HourTimer
Float CurrentDay
Float DayCheck
Float Timer

Int Battle
Ref Dark_King

Short Button
Short Choice
Short NightEyeToggle
Short Equipped
Short DoOnce
Short Replica
Short Switch
Short Transfer
Short SlowFRegen
Short MediumFRegen
Short FastFRegen
Short Effect
Short StartDay
Short DaysPassed
Short Update
Short SlowHRegen
Short MediumHRegen
Short FastHRegen
Short EmergencyRegen
Short Owner
Short SlowMRegen
Short MediumMRegen
Short FastMRegen
Short NRegen

Begin OnEquip
 Set Dark_King to GetContainer
 Set Owner to 1
 if (GetStage AXMTheDarkKingQuest != 10)
  Dark_King.SetStage AXMTheDarkKingQuest 10
 endif
 if (DarkKingsCrime > 0)
  Set DarkKingsCrime to 0
 endif
 Dark_King.SetFactionRank 00AXMDarkKingsFaction 1
 Set AXMTheDarkKingQuest.InFa to 1
 Set Equipped to 1
 Set OldDay to 0
 Set DoOnce to 0
 Set Switch to 0
 if (DoOnce == 0)
  if (AXMRunSpeed == 0); && (Dark_King.IsRunning == 1)
   Set AXMRunSpeed to AXMRunSpeed + Dark_King.GetBaseAV Speed
   if (Dark_King.IsRunning == 0)
    Set Transfer to 1
    Set DoOnce to 1
   endif
  endif
 endif
End

Begin OnUnEquip
 Set Owner to 0
 Set Replica to 0
 if (Dark_King.IsRunning == 0)
  if (AXMRunSpeed > 0)
   Dark_King.SetAV Speed AXMRunSpeed
   Dark_King.ModAV Speed 55
  endif
 endif
 Set AXMTheDarkKingQuest.InFa to 0
 Set AXMTheDarkKingQuest.IFFlow to 0
 Dark_King.SetCrimeGold 0
 Set AXMRunSpeed to 0
 Set AXMSoulLink to 0
 Set AXMTheDarkKingQuest.DoOnce to 0
 SetFactionRank 00AXMDarkKingsFaction -1
End

Begin OnDrop
 Set Owner to 0
 Set Replica to 0
 if (Dark_King.IsRunning == 0)
  if (AXMRunSpeed > 0)
   Dark_King.SetAV Speed AXMRunSpeed
   Dark_King.ModAV Speed 55
  endif
 endif
 Set AXMTheDarkKingQuest.InFa to 0
 Set AXMTheDarkKingQuest.IFFlow to 0
 Dark_King.SetCrimeGold 0
 Set AXMRunSpeed to 0
 Set AXMSoulLink to 0
 Set AXMTheDarkKingQuest.DoOnce to 0
 SetFactionRank 00AXMDarkKingsFaction -1
End

Begin OnStartCombat
 Set SlowHRegen to 0
 Set SlowMRegen to 0
 Set SlowFRegen to 0

 Set MediumHRegen to 0
 Set MediumMRegen to 0
 Set MediumFRegen to 0

 Set FastHRegen to 0
 Set FastMRegen to 0
 Set FastFRegen to 0
End

Begin Gamemode
 if (AXMSummonArmor == 1) || ((AXMTheDarkKingQuest.ReplicaA == 1) && (AXMTheDarkKingQuest.ReplicaH == 1))
  if (Owner == 1)
;-------------------Combat-------------------
   if (Dark_King.IsInCombat == 1)
    Set CHealth to Dark_King.GetAV Health
    Set PHealth to ((CHealth / AXMMaxHealth) * 100)
    Set CMagicka to Dark_King.GetAV Magicka
    Set PMagicka to ((CMagicka / AXMMaxMagicka) * 100)
    Set CFatigue to Dark_King.GetAV Fatigue
    Set PFatigue to ((CFatigue / AXMMaxFatigue) * 100)
    if (Effect == 0)
     Set AXMEffect to GetRandomPercent
      if AXMEffect == 0
       Set Effect to 1
       Message "Increased Resistances"
       Dark_King.ModAV ResistDisease 50
       Dark_King.ModAV ResistFire 10
       Dark_King.ModAV ResistFrost 10
       Dark_King.ModAV ResistShock 10
       Dark_King.ModAV ResistMagic 10
       Dark_King.ModAV ResistNormalWeapons 30
       Dark_King.ModAV ResistParalysis 30
       Dark_King.ModAV ResistPoison 30
       Dark_King.ModAV ReflectDamage 20
       Dark_King.ModAV SpellReflectChance 20

      elseif AXMEffect > 1 && AXMEffect <= 10
       Set Effect to 2
       Message "Increased Resistance to Disease"
       Dark_King.ModAV ResistDisease 50

      elseif AXMEffect > 11 && AXMEffect <= 20
       Set Effect to 3
       Message "Increased Resistance to Fire"
       Dark_King.ModAV ResistFire 20

      elseif AXMEffect > 21 && AXMEffect <= 30
       Set Effect to 4
       Message "Increased Resistance to Frost"
       Dark_King.ModAV ResistFrost 20

      elseif AXMEffect > 31 && AXMEffect <= 40
       Set Effect to 5
       Message "Increased Resistance to Shock"
       Dark_King.ModAV ResistShock 20

      elseif AXMEffect > 41 && AXMEffect <= 50
       Set Effect to 6
       Message "Increased Resistance to Normal Weapons"
       Dark_King.ModAV ResistNormalWeapons 30

      elseif AXMEffect > 51 && AXMEffect <= 60
       Set Effect to 7
       Message "Increased Resistance to Paralysis"
       Dark_King.ModAV ResistParalysis 30

      elseif AXMEffect > 61 && AXMEffect <= 70
       Set Effect to 8
       Message "Increased Resistance to Poison"
       Dark_King.ModAV ResistPoison 30

      elseif AXMEffect > 71 && AXMEffect <= 80
       Set Effect to 9
       Message "Reflecting some Physical Damage"
       Dark_King.ModAV  ReflectDamage 30

      elseif AXMEffect > 81 && AXMEffect <= 90
       Set Effect to 10
       Message "Reflecting some Magical Damage"
       Dark_King.ModAV  SpellReflectChance 30

      elseif AXMEffect > 91 && AXMEffect <= 99
       Set Effect to 11
       Message "Increased Resistance to Magic"
       Dark_King.ModAV ResistMagic 20
      endif
    endif

    if (Battle == 0)
     Message " "
     Message " "
     Dark_King.AddSpell 00AXMSpatialAwareness
     Dark_King.ModAV DetectLifeRange 30
     Set Battle to 1
    endif

    if (PHealth >= 90)
     if SlowHRegen != 0
        Dark_King.RemoveSpell 00AXMSlowHRegen
        Set SlowHRegen to 0
     endif
     if MediumHRegen != 0
        Dark_King.RemoveSpell 00AXMMediumHRegen
        Set MediumHRegen to 0
     endif
     if FastHRegen != 0
        Dark_King.RemoveSpell 00AXMFastHRegen
        Set FastHRegen to 0
     endif

    elseif (PHealth < 90) && (PHealth >= 60)
     if FastHRegen != 0 
      Dark_King.RemoveSpell 00AXMFastHRegen
      Set FastHRegen to 0
     endif
     if MediumHRegen != 0
      Dark_King.RemoveSpell 00AXMMediumHRegen
      Set MediumHRegen to 0
     endif
     if SlowHRegen == 0
      Message " "
      Message " "
      Dark_King.AddSpell 00AXMSlowHRegen
      Set SlowHRegen to 1
     endif
     
    elseif (PHealth < 60) && (PHealth >= 30)
     if FastHRegen != 0 
      Dark_King.RemoveSpell 00AXMFastHRegen
      Set FastHRegen to 0
     endif
     if SlowHRegen != 0
      Dark_King.RemoveSpell 00AXMSlowHRegen
      Set SlowHRegen to 0
     endif
     if MediumHRegen == 0
      Message " "
      Message " "
      Dark_King.AddSpell 00AXMMediumHRegen
      Set MediumHRegen to 1
     endif

    elseif (PHealth < 30)
     if SlowHRegen != 0 
      Dark_King.RemoveSpell 00AXMSlowHRegen
      Set SlowHRegen to 0
     endif
     if MediumHRegen != 0
      Dark_King.RemoveSpell 00AXMMediumHRegen
      Set MediumHRegen to 0
     endif
     if FastHRegen == 0
      Message " "
      Message " "
      Dark_King.AddSpell 00AXMFastHRegen
      Set FastHRegen to 1
     endif
    endif

    if (PHealth <= 10)
     if ( AXMRegenTimer.AXMRegenEmer == 0 )
      Message " "
      Message " "
      Dark_King.AddSpell 00AXMDarkKingsLastStand
      Set AXMRegenTimer.AXMRegenEmer to 1
     endif
    endif

   if AXMRegenTimer.AXMRegenEmer != 0
    if AXMRegenTimer.AXMRegenEmer == 1
     Set AXMRegenTimer.AXMRegenEmer to 2
    endif
    if AXMRegenTimer.AXMRegenEmer == 2
     Set Timer to 10
     Set AXMRegenTimer.Update to 0
     Set AXMRegenTimer.CurrentDay to GameDaysPassed
     Set AXMRegenTimer.DayCheck to GameDaysPassed
     Set AXMRegenTimer.AXMRegenEmer to 3
    endif
    if AXMRegenTimer.AXMRegenEmer == 3
     if Timer <= 0
      Dark_King.RemoveSpell 00AXMDarkKingsLastStand
      Set AXMRegenTimer.AXMRegenEmer to 4
     else
      Set Timer to Timer - GetSecondsPassed
     endif
    endif
    if AXMRegenTimer.AXMRegenEmer == 4
     if AXMRegenTimer.DaysPassed >= 7
      Set AXMRegenTimer.AXMRegenEmer to 0
      Set AXMRegenTimer.DaysPassed to 0
      Set AXMRegenTimer.CurrentDay to 0
      Set AXMRegenTimer.DayCheck to 0
      Set AXMRegenTimer.Update to 0
     else
      if AXMRegenTimer.Update == 0
       Set AXMRegenTimer.CurrentDay to GameDaysPassed
       Set AXMRegenTimer.Update to 1
      endif
     endif
    endif
   endif

    if NRegen == 1
     Dark_King.RemoveSpell 00AXMOffBattleMRegen
     Set NRegen to 0
    endif

    if (PMagicka == 100)
     if SlowMRegen != 0
        Dark_King.RemoveSpell 00AXMSlowMRegen
        Set SlowMRegen to 0
     endif
     if MediumMRegen != 0
        Dark_King.RemoveSpell 00AXMMediumMRegen
        Set MediumMRegen to 0
     endif
     if FastMRegen != 0
        Dark_King.RemoveSpell 00AXMFastMRegen
        Set FastMRegen to 0
     endif

    elseif (PMagicka < 100) && (PMagicka >= 67)
     if FastMRegen != 0 
      Dark_King.RemoveSpell 00AXMFastMRegen
      Set FastMRegen to 0
     endif
     if MediumMRegen != 0
      Dark_King.RemoveSpell 00AXMMediumMRegen
      Set MediumMRegen to 0
     endif
     if SlowMRegen == 0
      Message " "
      Message " "
      Dark_King.AddSpell 00AXMSlowMRegen
      Set SlowMRegen to 1
     endif
      
    elseif (PMagicka < 67) && (PMagicka >= 33)
     if FastMRegen != 0 
      Dark_King.RemoveSpell 00AXMFastMRegen
      Set FastMRegen to 0
     endif
     if SlowMRegen != 0
      Dark_King.RemoveSpell 00AXMSlowMRegen
      Set SlowMRegen to 0
     endif
     if MediumMRegen == 0
      Message " "
      Message " "
      Dark_King.AddSpell 00AXMMediumMRegen
      Set MediumMRegen to 1
     endif

    elseif (PMagicka < 33)
     if SlowMRegen != 0 
      Dark_King.RemoveSpell 00AXMSlowMRegen
      Set SlowMRegen to 0
     endif
     if MediumMRegen != 0
      Dark_King.RemoveSpell 00AXMMediumMRegen
      Set MediumMRegen to 0
     endif
     if FastMRegen == 0
      Message " "
      Message " "
      Dark_King.AddSpell 00AXMFastMRegen
      Set FastMRegen to 1
     endif
    endif

    if (PFatigue == 100)
     if SlowFRegen != 0
        Dark_King.RemoveSpell 00AXMSlowFRegen
        Set SlowFRegen to 0
     endif
     if MediumFRegen != 0
        Dark_King.RemoveSpell 00AXMMediumFRegen
        Set MediumFRegen to 0
     endif
     if FastFRegen != 0
        Dark_King.RemoveSpell 00AXMFastFRegen
        Set FastFRegen to 0
     endif

    elseif (PFatigue < 100) && (PFatigue >= 75)
     if FastFRegen != 0 
      Dark_King.RemoveSpell 00AXMFastFRegen
      Set FastFRegen to 0
     endif
     if MediumFRegen != 0
      Dark_King.RemoveSpell 00AXMMediumFRegen
      Set MediumFRegen to 0
     endif
     if SlowFRegen == 0
      Message " "
      Message " "
      Dark_King.AddSpell 00AXMSlowFRegen
      Set SlowFRegen to 1
     endif
      
    elseif (PFatigue < 75) && (PFatigue >= 50)
     if FastFRegen != 0 
      Dark_King.RemoveSpell 00AXMFastFRegen
      Set FastFRegen to 0
     endif
     if SlowFRegen != 0
      Dark_King.RemoveSpell 00AXMSlowFRegen
      Set SlowFRegen to 0
     endif
     if MediumFRegen == 0
      Message " "
      Message " "
      Dark_King.AddSpell 00AXMMediumFRegen
      Set MediumFRegen to 1
     endif

    elseif (PFatigue < 50)
     if SlowFRegen != 0 
        Dark_King.RemoveSpell 00AXMSlowFRegen
        Set SlowFRegen to 0
     endif
     if MediumFRegen != 0
      Dark_King.RemoveSpell 00AXMMediumFRegen
      Set MediumFRegen to 0
     endif
     if FastFRegen == 0
      Message " "
      Message " "
      Dark_King.AddSpell 00AXMFastFRegen
      Set FastFRegen to 1
     endif
    endif

   elseif (Dark_King.IsInCombat == 0)
    Set CMagicka to Dark_King.GetAV Magicka
    if (Effect !=0)
     if (Effect == 1)
      Dark_King.ModAV ResistDisease -50
      Dark_King.ModAV ResistFire -10
      Dark_King.ModAV ResistFrost -10
      Dark_King.ModAV ResistShock -10
      Dark_King.ModAV ResistMagic -10
      Dark_King.ModAV ResistNormalWeapons -30
      Dark_King.ModAV ResistParalysis -30
      Dark_King.ModAV ResistPoison -30
      Dark_King.ModAV ReflectDamage -20
      Dark_King.ModAV SpellReflectChance -20
      Set Effect to 0
     elseif (Effect == 2)
      Dark_King.ModAV ResistDisease -50
      Set Effect to 0
     elseif (Effect == 3)
      Dark_King.ModAV ResistFire -20
      Set Effect to 0
     elseif (Effect == 4)
      Dark_King.ModAV ResistFrost -20
      Set Effect to 0
     elseif (Effect == 5)
      Dark_King.ModAV ResistShock -20
      Set Effect to 0
     elseif (Effect == 6)
      Dark_King.ModAV ResistNormalWeapons -30
      Set Effect to 0
     elseif (Effect == 7)
      Dark_King.ModAV ResistParalysis -30
      Set Effect to 0
     elseif (Effect == 8)
      Dark_King.ModAV ResistPoison -30
      Set Effect to 0
     elseif (Effect == 9)
      Dark_King.ModAV ReflectDamage -30
      Set Effect to 0
     elseif (Effect == 10)
      Dark_King.ModAV SpellReflectChance -30
      Set Effect to 0
     elseif (Effect == 11)
      Dark_King.ModAV ResistMagic -20
      Set Effect to 0
     endif
    endif

    if (Battle == 1)
     Dark_King.RemoveSpell 00AXMSpatialAwareness
     Dark_King.ModAV DetectLifeRange -30
     Set Battle to 0
    endif

    if SlowHRegen == 1
     Dark_King.RemoveSpell 00AXMSlowHRegen
     Set SlowHRegen to 0
    endif
    if MediumHRegen == 1
     Dark_King.RemoveSpell 00AXMMediumHRegen
     Set MediumHRegen to 0
    endif
    if FastHRegen == 1
     Dark_King.RemoveSpell 00AXMFastHRegen
     Set FastHRegen to 0
    endif

    if SlowMRegen != 0
     Dark_King.RemoveSpell 00AXMSlowMRegen
     Set SlowMRegen to 0
    endif
    if MediumMRegen != 0
     Dark_King.RemoveSpell 00AXMMediumMRegen
     Set MediumMRegen to 0
    endif
    if FastMRegen != 0
     Dark_King.RemoveSpell 00AXMFastMRegen
     Set FastMRegen to 0
    endif
    if NRegen == 0 && CMagicka < 100
     Message " "
     Message " "
     Dark_King.AddSpell 00AXMOffBattleMRegen
     Set NRegen to 1
    endif
    if NRegen != 0 && CMagicka >= 100
     Dark_King.RemoveSpell 00AXMOffBattleMRegen
     Set NRegen to 0
    endif

    if SlowFRegen != 0
     Dark_King.RemoveSpell 00AXMSlowFRegen
     Set SlowFRegen to 0
    endif
    if MediumFRegen != 0
     Dark_King.RemoveSpell 00AXMMediumFRegen
     Set MediumFRegen to 0
    endif
    if FastFRegen != 0
     Dark_King.RemoveSpell 00AXMFastFRegen
     Set FastFRegen to 0
    endif
   endif

;-------------------Passive-------------------
   if (Dark_King.IsRunning == 0) && (AXMRunSpeed > 0)
    if (Switch == 0)
     Dark_King.SetAV Speed 50
     if (AXMModPlay == 1)
      Dark_King.ModAV Speed -205
     else (AXMModPlay == 0)
      Dark_King.ModAV Speed -55
     endif
     Set Switch to 1
    endif
   elseif (Dark_King.IsRunning == 1) && (AXMRunSpeed > 0)
    if (AXMRunSpeed > 0)
     if (Switch == 1)
      Dark_King.SetAV Speed AXMRunSpeed
      if (AXMModPlay == 1)
       Dark_King.ModAV Speed 205
      else (AXMModPlay == 0)
       Dark_King.ModAV Speed 55
      endif
      Set Switch to 0
     endif
    endif
   endif

   if (Dark_King.IsInInterior == 1) && (AXMTheDarkKingQuest.LightItem == 0)
    if Choice == 0
    MessageBox "Which Light would you like?", "Light", "Night Eye", "None"
     Set Button to -1
     Set Choice to 1
    endif

    if Choice == 1
     Set Button to GetButtonPressed
     if (Button == 0) && (AXMTheDarkKingQuest.LightItem == 0)
      if AXMTheDarkKingQuest.MagicToken == 0
       Message " "
       Message " "
       Dark_King.AddItem 00AXMMagicalLightToken 1
       Set AXMTheDarkKingQuest.MagicToken to 1
      endif
      if NightEyeToggle != 0
       Dark_King.ModAV NightEyeBonus -1
       Dark_King.RemoveSpell 00AXMNightEyeEff
       Set NightEyeToggle to 0
      endif
      Set AXMTheDarkKingQuest.LightItem to 1
      Set Choice to 0
     endif

     if (Button == 1) && (AXMTheDarkKingQuest.LightItem == 0)
      if NightEyeToggle == 0
       Message " "
       Message " "
       Dark_King.AddSpell 00AXMNightEyeEff
       Dark_King.ModAV NightEyeBonus 1
       Set NightEyeToggle to 1
      endif
      Set AXMTheDarkKingQuest.MagicToken to 0
      Set AXMTheDarkKingQuest.LightItem to 1
      Set Choice to 0
     endif

     if (Button == 2) && (AXMTheDarkKingQuest.LightItem == 0)
      if NightEyeToggle != 0
       Dark_King.ModAV NightEyeBonus -1
       Dark_King.RemoveSpell 00AXMNightEyeEff
       Set NightEyeToggle to 0
      endif
      Set AXMTheDarkKingQuest.MagicToken to 0
      Set AXMTheDarkKingQuest.LightItem to 1
      Set Choice to 0
     endif
    endif

   Elseif (Dark_King.IsInInterior == 0)
    if NightEyeToggle != 0
     Dark_King.ModAV NightEyeBonus -1
     Dark_King.RemoveSpell 00AXMNightEyeEff
     Set NightEyeToggle to 0
    endif
    if AXMTheDarkKingQuest.LightSpell!= 1
     Set AXMTheDarkKingQuest.LightItem to 0
     Set AXMTheDarkKingQuest.MagicToken to 0
    endif
    Set Choice to 0
   endif

   Set ACrime to Dark_King.GetCrimeGold
   if ( ACrime > 0 )
    if (AXMThievesGuildChestRef.GetDisabled == 0)
     Dark_King.SetCrimeGold 0
    elseif (AXMThievesGuildChestRef.GetDisabled == 1)
     Set DarkKingsCrime to Dark_King.GetCrimeGold
    endif
   endif

   if Equipped != AXMTheDarkKingQuest.InFa
    Set Equipped to AXMTheDarkKingQuest.InFa
   endif
   if Equipped != 0
    if OldDay == 0
     Set OldDay to GameDaysPassed
    endif
    Set CurrentDay to GameDaysPassed
    Set Modifier to 1
    if OldDay != CurrentDay
     Set Fame to GetPCFame
     Set Infamy to GetPCinFamy
     if AXMTheDarkKingQuest.IFFlow == 0
      if Fame > 0 && Infamy > 0
       if Infamy > Fame
        Set AXMTheDarkKingQuest.IFFlow to 1
       endif
       if Infamy < Fame 
        Set AXMTheDarkKingQuest.IFFlow to 2
       endif
      endif
     endif
     if Infamy == Fame
      Set Modifier to 0
     endif
     if AXMTheDarkKingQuest.IFFlow == 1 && Infamy == 0
      Set Modifier to 0
     endif
     if AXMTheDarkKingQuest.IFFlow == 2 && Fame == 0
      Set Modifier to 0
     endif
      if AXMTheDarkKingQuest.IFFlow != 0
       if Modifier != 0
        if AXMTheDarkKingQuest.IFFlow == 1
         Set AXMTheDarkKingQuest.IFFlow to 0
         ModPCInfamy Modifier
         Set Modifier to 0 - Modifier
         ModPCFame Modifier
        endif
       if AXMTheDarkKingQuest.IFFlow == 2
        Set AXMTheDarkKingQuest.IFFlow to 0
        ModPCFame Modifier
        Set Modifier to 0 - Modifier
        ModPCInfamy Modifier
       endif
      else
       Set AXMTheDarkKingQuest.IFFlow to 0
      endif
      Set OldDay to CurrentDay
     endif
     if OldDay != CurrentDay && AXMTheDarkKingQuest.IFFlow == 0
      Set OldDay to CurrentDay
     endif
   endif
  endif
  endif
 endif; Armor Summoned
End

so i originally had it using a variable within called replica and set it up like this

 Set Replica to AXMTheDarkKingQuest.ReplicaA + AXMTheDarkKingQuest.ReplicaH 
 if (AXMSummonArmor == 1) || (Replica == 2)

of course this broke the script after a while, so i thought changing the requirement to this

 if (AXMSummonArmor == 1) || ((AXMTheDarkKingQuest.ReplicaA == 1) && (AXMTheDarkKingQuest.ReplicaH == 1))

thinking that it would crash because of this

((AXMTheDarkKingQuest.ReplicaA == 1) && (AXMTheDarkKingQuest.ReplicaH == 1))

but instead it works, but while testing them out, i found out that it might be breaking when the player is in combat, and even when they get out of combat, if i can get any help with is, i would be grateful

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

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