Jump to content

Item Identity Switch Script Help


Recommended Posts

Hello, so i wanted to create an interesting script but i am an issue, and i cant see what is the issue, here is the script

ScriptName 0AXMItemDKRegaliaScript

Float Change
Float DefenceBonus01
Float DefenceBonus02
Ref Dark_King
Short Battle
Short Equipped
Short Level
Short LevelCheck
Short SpellSelf
Short SpellTarget
Short SpellTouch

Begin OnEquip
 Set Dark_King to GetContainer
 Set Equipped to 1
 Set Level to Dark_King.GetLevel
 if (Equipped == 1)
  SetQuestObject 0AXMDarkKingsRegalia 1
  Message " "
  Message " "
  if (SpellSelf != 1)
   Set SpellSelf to 1
   Dark_King.AddSpell 0AXMSetSelfLPFortitude00
   Dark_King.AddSpell 0AXMSetSelfLPFortify01
   Dark_King.AddSpell 0AXMSetSelfLPHealingVitalityC01
   Dark_King.AddSpell 0AXMSetSelfLPInvisiblity00
   Dark_King.AddSpell 0AXMSetSelfLPLight01
   Dark_King.AddSpell 0AXMSetSelfLPSpeed00
   Dark_King.AddSpell 0AXMSetSelfLPSummonFrostAtronach00
   Dark_King.AddSpell 0AXMSetSelfPowerAetherealTranscendence00
  endif
  if (SpellTarget != 1)
   Set SpellTarget to 1
   Dark_King.AddSpell 0AXMSetTargetLPAuraofDeath02
   Dark_King.AddSpell 0AXMSetTargetLPBlessingofHeros00
   Dark_King.AddSpell 0AXMSetTargetLPElementalStrike01
   Dark_King.AddSpell 0AXMSetTargetLPElementalPulse01
   Dark_King.AddSpell 0AXMSetTargetLPParashock01
   Dark_King.AddSpell 0AXMSetTargetLPUnlock00
  endif
  if (SpellTouch != 1)
   Set SpellTouch to 1
   Dark_King.AddSpell 0AXMSetTouchLPBolsterAlly01
   Dark_King.AddSpell 0AXMSetTouchLPCharm01
   Dark_King.AddSpell 0AXMSetTouchLPCure00
   Dark_King.AddSpell 0AXMSetTouchLPCursedHand03
   Dark_King.AddSpell 0AXMSetTouchLPElementalGrasp01
   Dark_King.AddSpell 0AXMSetTouchLPEssenceofLife01
  endif
  if (Change != 2)
   Set Change to 0
   if (Change == 0)
    Set AXMStatisticsQuest.PlayerBounty to Dark_King.GetCrimeGold
    Set AXMStatisticsQuest.PlayerFame to GetPCFame
    Set AXMStatisticsQuest.PlayerInfamy to GetPCInfamy
    Set Change to (Change + 1)
   endif
   if (Change == 1)
    Set Dark_King.SetCrimeGold to AXMTheDarkKingQuest.DarkKingsBounty
    Set Dark_King.SetPCFame to AXMTheDarkKingQuest.DarkKingsFame
    Set Dark_King.SetPCInfamy to AXMTheDarkKingQuest.DarkKingsInfamy
    Set Change to (Change + 1)
   endif
  endif
 endif
End

Begin OnUnEquip
 if (Equipped == 1)
  if (SpellSelf != 0)
   Dark_King.RemoveSpell 0AXMSetSelfLPFortitude00
   Dark_King.RemoveSpell 0AXMSetSelfLPFortify01
   Dark_King.RemoveSpell 0AXMSetSelfLPHealingVitalityC01
   Dark_King.RemoveSpell 0AXMSetSelfLPInvisiblity00
   Dark_King.RemoveSpell 0AXMSetSelfLPLight01
   Dark_King.RemoveSpell 0AXMSetSelfLPSpeed00
   Dark_King.RemoveSpell 0AXMSetSelfLPSummonFrostAtronach00
   Dark_King.RemoveSpell 0AXMSetSelfPowerAetherealTranscendence00
   Set SpellSelf to 0
  endif
  if (SpellTarget != 0)
   Dark_King.RemoveSpell 0AXMSetTargetLPAuraofDeath02
   Dark_King.RemoveSpell 0AXMSetTargetLPBlessingofHeros00
   Dark_King.RemoveSpell 0AXMSetTargetLPElementalStrike01
   Dark_King.RemoveSpell 0AXMSetTargetLPElementalPulse01
   Dark_King.RemoveSpell 0AXMSetTargetLPParashock01
   Dark_King.RemoveSpell 0AXMSetTargetLPUnlock00
   Set SpellTarget to 0
  endif
  if (SpellTouch != 0)
   Dark_King.RemoveSpell 0AXMSetTouchLPBolsterAlly01
   Dark_King.RemoveSpell 0AXMSetTouchLPCharm01
   Dark_King.RemoveSpell 0AXMSetTouchLPCure00
   Dark_King.RemoveSpell 0AXMSetTouchLPCursedHand03
   Dark_King.RemoveSpell 0AXMSetTouchLPEssenceofLife01
   Dark_King.RemoveSpell 0AXMSetTouchLPHelpingHand00
   Dark_King.RemoveSpell 0AXMSetTouchLPReanimation00
   Set SpellTouch to 0
  endif
  SetQuestObject 0AXMDarkKingsRegalia 0
 endif
 if (Change != 0)
  if (Change == 2)
   Set AXMTheDarkKingQuest.DarkKingsBounty to Dark_King.GetCrimeGold
   Set AXMTheDarkKingQuest.DarkKingsFame to Dark_King.GetPCFame
   Set AXMTheDarkKingQuest.DarkKingsInfamy to Dark_King.GetPCInfamy
   Set Change to (Change - 1)
  endif
  if (Change == 1)
   Set Dark_King.SetCrimeGold to AXMStatisticsQuest.PlayerBounty
   Set Dark_King.SetPCFame to AXMStatisticsQuest.PlayerFame
   Set Dark_King.SetPCInfamy to AXMStatisticsQuest.PlayerInfamy
   Set Change to (Change - 1)
  endif
 endif
 if (Battle == 1)
  Set DefenceBonus01 to 0 - DefenceBonus01
  Set DefenceBonus02 to 0 - DefenceBonus02
  Dark_King.ModAV DefendBonus DefenceBonus01
  Dark_King.ModAV ResistDisease DefenceBonus02
  Dark_King.ModAV ResistFire DefenceBonus02
  Dark_King.ModAV ResistFrost DefenceBonus02
  Dark_King.ModAV ResistShock DefenceBonus02
  Dark_King.ModAV ResistMagic DefenceBonus02
  Dark_King.ModAV ResistParalysis DefenceBonus02
  Dark_King.ModAV ResistPoison DefenceBonus02
  Set Battle to 0
 endif
 Set Equipped to 0
 Set Level to 0
 Set Dark_King to 0
End

Begin Menumode
 if (Menumode 1027 == 1)
  Set LevelCheck to 1
 endif
End

Begin Gamemode
 if (LevelCheck == 1)
  Set Level to Dark_King.GetLevel
  Set LevelCheck to 0
 endif
 if (Equipped == 1)
  if (Dark_King.IsInCombat == 1) && (Battle == 0)
   Set DefenceBonus01 to Level * 2
   Set DefenceBonus02 to Level * 2
   if (DefenceBonus01 > 85) || (DefenceBonus02 > 30)
    if (DefenceBonus01 > 85)
     Set DefenceBonus01 to 85
    endif
    if (DefenceBonus02 > 30)
     Set DefenceBonus02 to 30
    endif
   endif
   Set Battle to 1
   Dark_King.ModAV DefendBonus DefenceBonus01
   Dark_King.ModAV ResistDisease DefenceBonus02
   Dark_King.ModAV ResistFire DefenceBonus02
   Dark_King.ModAV ResistFrost DefenceBonus02
   Dark_King.ModAV ResistShock DefenceBonus02
   Dark_King.ModAV ResistMagic DefenceBonus02
   Dark_King.ModAV ResistParalysis DefenceBonus02
   Dark_King.ModAV ResistPoison DefenceBonus02
  elseif (Dark_King.IsInCombat == 0) && (Battle == 1)
   Set DefenceBonus01 to 0 - DefenceBonus01
   Set DefenceBonus02 to 0 - DefenceBonus02
   Dark_King.ModAV DefendBonus DefenceBonus01
   Dark_King.ModAV ResistDisease DefenceBonus02
   Dark_King.ModAV ResistFire DefenceBonus02
   Dark_King.ModAV ResistFrost DefenceBonus02
   Dark_King.ModAV ResistShock DefenceBonus02
   Dark_King.ModAV ResistMagic DefenceBonus02
   Dark_King.ModAV ResistParalysis DefenceBonus02
   Dark_King.ModAV ResistPoison DefenceBonus02
   Set DefenceBonus01 to 0
   Set DefenceBonus02 to 0
   Set Battle to 0
  endif
 endif
End

so the idea is that when you equip the item, it grabs your bounty, fame, and infamy, then replaces it to another stored one.

both are in isolated quests by choice, since the equipped i use that quest universally, where as the other i use it for a local set of equipment.

With that out of the way, the issue that i have is this part

  if (Change != 2)
   Set Change to 0
   if (Change == 0)
    Set AXMStatisticsQuest.PlayerBounty to Dark_King.GetCrimeGold
    Set AXMStatisticsQuest.PlayerFame to GetPCFame
    Set AXMStatisticsQuest.PlayerInfamy to GetPCInfamy
    Set Change to (Change + 1)
   endif
   if (Change == 1)
    Set Dark_King.SetCrimeGold to AXMTheDarkKingQuest.DarkKingsBounty
    Set Dark_King.SetPCFame to AXMTheDarkKingQuest.DarkKingsFame
    Set Dark_King.SetPCInfamy to AXMTheDarkKingQuest.DarkKingsInfamy
    Set Change to (Change + 1)
   endif
  endif

so here is what it is currently doing, it grabs the numbers for the players stuff, but yet it doesnt change it to the the other, but i cant see why it isnt changing, unless it is a timing issue, like i am not giving it time to change

or is it the quest priority?

AXMStatisticsQuest has 0 Quest Priority

AXMTheDarkKingQuest has 60 Quest Priority

 

Edit: just found something rather interesting, so appearently despite it being in OnEquip, it keeps changing the playerfame, i just checked through the arena, equipped the item, then beat the first combatant, gained 1 fame, player fame is 1, and dark kings fame is 0, after beating 2nd combatant, player fame is 2, and dark kings fame is 0, but they both should have been 0, not one changing at all

Edited by bomo99
Update
Link to comment
Share on other sites

First, script names can't start with a number. If you use the Construction Set Extender, it will catch that error for you. Yes, I know some of the vanilla scripts have digits at the start. They won't compile now.

Second, look carefully at what you're doing here:

 Set Change to 0
   if (Change == 0)

That's not going to work too well. You want the reset your change variable after processing all the changes.

Link to comment
Share on other sites

9 minutes ago, AndalayBay said:

First, script names can't start with a number. If you use the Construction Set Extender, it will catch that error for you. Yes, I know some of the vanilla scripts have digits at the start. They won't compile now.

Not true... It is a setting in the CSE that can be turned off. They compile just fine. The CS accepts them without any settings. But it is a better practice not to start a name with a number.

Link to comment
Share on other sites

I already made a point about these three lines:

    Set Dark_King.SetCrimeGold to AXMTheDarkKingQuest.DarkKingsBounty
    Set Dark_King.SetPCFame to AXMTheDarkKingQuest.DarkKingsFame
    Set Dark_King.SetPCInfamy to AXMTheDarkKingQuest.DarkKingsInfamy

All looks like mismatch - all calls function within set command in strange way, not to mention that SetPCFame and SetPCInfamy commands are already working with player only and don't need to assign any reference to them.  It should be this way:

    Dark_King.SetCrimeGold AXMTheDarkKingQuest.DarkKingsBounty
    SetPCFame AXMTheDarkKingQuest.DarkKingsFame
    SetPCInfamy AXMTheDarkKingQuest.DarkKingsInfamy

Or if they don't want accept quest variables, fill them through some temp variable:

....
    int temp
....
    Set temp to AXMTheDarkKingQuest.DarkKingsBounty
    Dark_King.SetCrimeGold temp
    Set temp to AXMTheDarkKingQuest.DarkKingsFame
    SetPCFame temp
    Set temp to AXMTheDarkKingsQuest.DarkKingsInfamy
    SetPCInfamy temp

 

 

 

Link to comment
Share on other sites

On 9/17/2024 at 4:53 PM, AndalayBay said:

First, script names can't start with a number. If you use the Construction Set Extender, it will catch that error for you. Yes, I know some of the vanilla scripts have digits at the start. They won't compile now.

Second, look carefully at what you're doing here:

 Set Change to 0
   if (Change == 0)

That's not going to work too well. You want the reset your change variable after processing all the changes.

never had an issue with numbers in my scripts at all, using CS, only certain thing is has caused issues

and about the Check thing, i dont see a problem, and it was mostly for debugging purposes, since i thought it was a timing issue i made it go up by 1 each stage, going up to 6 at the end, so in case it lingered or something, i added the change to 0 so that the rest will work

 

19 hours ago, RomanR said:

I already made a point about these three lines:

    Set Dark_King.SetCrimeGold to AXMTheDarkKingQuest.DarkKingsBounty
    Set Dark_King.SetPCFame to AXMTheDarkKingQuest.DarkKingsFame
    Set Dark_King.SetPCInfamy to AXMTheDarkKingQuest.DarkKingsInfamy

All looks like mismatch - all calls function within set command in strange way, not to mention that SetPCFame and SetPCInfamy commands are already working with player only and don't need to assign any reference to them.  It should be this way:

    Dark_King.SetCrimeGold AXMTheDarkKingQuest.DarkKingsBounty
    SetPCFame AXMTheDarkKingQuest.DarkKingsFame
    SetPCInfamy AXMTheDarkKingQuest.DarkKingsInfamy

Or if they don't want accept quest variables, fill them through some temp variable:

....
    int temp
....
    Set temp to AXMTheDarkKingQuest.DarkKingsBounty
    Dark_King.SetCrimeGold temp
    Set temp to AXMTheDarkKingQuest.DarkKingsFame
    SetPCFame temp
    Set temp to AXMTheDarkKingsQuest.DarkKingsInfamy
    SetPCInfamy temp

 

 

 

i have already found the problem and resovled it, by using what is written in the Gray Cowl, to help with it, and found the issue, and it is as you say i didnt need to add the Set and to in there, removing made it work

but now i have it working fine, i just made a silly mistake on my part about this

Link to comment
Share on other sites

  • Recently Browsing   0 members

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