Rizalgar Posted April 13, 2019 Share Posted April 13, 2019 (edited) Okay, here's what's not working - Global value is not setting on level up- The boolean is not returning true to prevent stacking Scriptname Wow_StatDistribution extends Quest {Handles stat distribution for leveling} ;Globals GlobalVariable Property Wow_Att_Agility Auto GlobalVariable Property Wow_Att_Intellect Auto GlobalVariable Property Wow_Att_Spirit Auto GlobalVariable Property Wow_Att_Stamina Auto GlobalVariable Property Wow_Att_Strength Auto GlobalVariable Property Wow_Var_Level Auto GlobalVariable Property Wow_Var_Class Auto Function Stats() If Wow_Var_Class.GetValueInt() == 1 Warrior() EndIf EndFunction Function Warrior() Debug.Notification("Got warrior stats") Bool StatLock2 Int Agility = Math.Ceiling(Wow_Var_Level.GetValueInt() * 1.87) If Wow_Var_Level.GetValueInt() == 1 ;Ignore ElseIf Wow_Var_Level.GetValueInt() == 2 If StatLock2 == False Wow_Att_Agility.SetValue((Wow_Att_Agility.GetValueInt()) + Agility) Debug.Notification("Agility set") StatLock2 == True EndIf EndIf EndFunction - Note - I am getting all the debugs Edited April 13, 2019 by Rizalgar Link to comment Share on other sites More sharing options...
IsharaMeradin Posted April 13, 2019 Share Posted April 13, 2019 You declared the StatLock2 bool within the Warrior() function. This means each time the Warrior function is called the value gets reset. If this is not intended, declare the bool outside of the function. When you want to take the value of something, add an amount to it and then apply that to the same thing, it is better to modify rather than getting and setting. See Mod.Instead of: Wow_Att_Agility.SetValue((Wow_Att_Agility.GetValueInt()) + Agility)You can use: Wow_Att_Agility.Mod(Agility)Hope this helps, good luck with your modding. Link to comment Share on other sites More sharing options...
Rizalgar Posted April 13, 2019 Author Share Posted April 13, 2019 (edited) Oh derp I never even noticed I stuck the bool in the function. I am using the Get after the Set to prevent resetting stats attained via weapons/armor etc. I've seen it done before, but for some reason cannot recreate it. Edit - Still not setting the value using Mod(Agility) and the boolean is not returning true despite being set true and placed outside the function.Modified script - Float Agility = Math.Ceiling(Wow_Var_Level.GetValue() * 1.87) If Wow_Var_Level.GetValue() == 1 ;Ignore ElseIf Wow_Var_Level.GetValue() == 2 If StatLock2 == False Wow_Att_Agility.Mod(Agility) Debug.Notification("Agility set") StatLock2 == True EndIf EndIf I may end up just using statics to make this easier, it will take a lot longer but at least it will work. Edited April 13, 2019 by Rizalgar Link to comment Share on other sites More sharing options...
IsharaMeradin Posted April 13, 2019 Share Posted April 13, 2019 The question is: What is the value of Wow_Var_Level? As it stands, it will only do the stuff if the value is EXACTLY 2. Do you have control over what this value may be? Furthermore, the original script was attached to a quest. I am assuming that the modified snippet is as well. Are you testing on a new game or a save that has not seen this mod before? Not always but many times script data can get baked into the save and the game will use what is there rather than any new changes. Link to comment Share on other sites More sharing options...
Rizalgar Posted April 14, 2019 Author Share Posted April 14, 2019 New save every test. The value of Wow_Var_Level is set by Wow_Var_Experience which is gained via quests/slaying monsters. For the sake of testing, I've been doing Set Wow_Var_level_2 and Set Wow_Var_Class to 1, then using a custom spell I made to gain XP for testing. I've done this so many times, the properties are set in the quest, so I'm at a literal loss as to why it won't work this time. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted April 14, 2019 Share Posted April 14, 2019 Are you getting the notification that Agility has been set?The global variable Wow_Att_Agility is not getting updated at all?Is the function that all this agility stuff resides in getting called? Unless the function is not getting called, the only reason I could see for the global variable not updating would be an issue with the property assignment. Currently stumped as much as you... Link to comment Share on other sites More sharing options...
Evangela Posted April 14, 2019 Share Posted April 14, 2019 (edited) Im taking a guess here: Float WowLevel = Wow_Var_Level.GetValue() Float Agility = Math.Ceiling(WowLevel * 1.87) If WowLevel == 1.0 ;Ignore ElseIf WowLevel == 2.0 If StatLock2 == False Wow_Att_Agility.Mod(Agility) Debug.Notification("Agility set") StatLock2 == True EndIf EndIf Obviously 1 and 2 will be auto cast, but I feel like the multi calls to GetValue() is causing some issues. Edited April 14, 2019 by Rasikko Link to comment Share on other sites More sharing options...
Rizalgar Posted April 14, 2019 Author Share Posted April 14, 2019 (edited) Yeah I'm getting all the debugs for each function call, so I don't know. I'm stumped. I'm sure I'll come back in six months and figure it out. Until then, thanks guys, I appreciate it. I'm getting the debugs, but no global variable updates. Properties are set, so I don't know what else it would be. Here's the MCM script setting the level 1 stats, and here's stats script to set level 2 stats. MCM works, stats script does not. I'll throw the leveling script in there as well as the test spell script. Maybe if all of it is up here we can figure it out. MCM Script Scriptname Wow_MCM Extends SKI_ConfigBase Actor Property PlayerRef Auto Message Property Wow_M_ClassSelect Auto Message Property Wow_M_ClassSelect_2 Auto GlobalVariable Property Wow_Att_Agility Auto GlobalVariable Property Wow_Att_Intellect Auto GlobalVariable Property Wow_Att_Spirit Auto GlobalVariable Property Wow_Att_Stamina Auto GlobalVariable Property Wow_Att_Strength Auto GlobalVariable Property Wow_Skill_Bow Auto GlobalVariable Property Wow_Skill_Defense Auto GlobalVariable Property Wow_Skill_OH_Axe Auto GlobalVariable Property Wow_Skill_OH_Mace Auto GlobalVariable Property Wow_Skill_OH_Sword Auto GlobalVariable Property Wow_Skill_TH_Axe Auto GlobalVariable Property Wow_Skill_TH_Mace Auto GlobalVariable Property Wow_Skill_TH_Sword Auto GlobalVariable Property Wow_Stat_Armor Auto GlobalVariable Property Wow_Stat_AttackPower Auto GlobalVariable Property Wow_Stat_Block Auto GlobalVariable Property Wow_Stat_Crit Auto GlobalVariable Property Wow_Stat_Energy Auto GlobalVariable Property Wow_Stat_Haste Auto GlobalVariable Property Wow_Stat_Health Auto GlobalVariable Property Wow_Stat_Hit Auto GlobalVariable Property Wow_Stat_Mana Auto GlobalVariable Property Wow_Stat_MP5 Auto GlobalVariable Property Wow_Stat_Parry Auto GlobalVariable Property Wow_Stat_Rage Auto GlobalVariable Property Wow_Stat_Spellpower Auto GlobalVariable Property Wow_Var_Experience Auto GlobalVariable Property Wow_Var_Level Auto GlobalVariable Property Wow_Var_Class Auto GlobalVariable Property Wow_Var_Initialize Auto GlobalVariable Property Wow_P_Alchemy Auto GlobalVariable Property Wow_P_Blacksmithing Auto GlobalVariable Property Wow_P_Cooking Auto GlobalVariable Property Wow_P_Enchanting Auto GlobalVariable Property Wow_P_Engineering Auto GlobalVariable Property Wow_P_FirstAid Auto GlobalVariable Property Wow_P_Fishing Auto GlobalVariable Property Wow_P_Herbalism Auto GlobalVariable Property Wow_P_Leatherworking Auto GlobalVariable Property Wow_P_Mining Auto GlobalVariable Property Wow_P_Skinning Auto GlobalVariable Property Wow_P_Tailoring Auto String aVal String sPlayerName String sClass Int tPlayerName Int tClass Int tLevel Int tExp Int cExp Int tAgility Int tIntellect Int tSpirit Int tStamina Int tStrength Int tArmor Int tAttackPower Int tBlock Int tCrit Int tEnergy Int tHaste Int tHealth Int tHit Int tMana Int tMP5 Int tParry Int tRage Int tSpellPower Int tBow Int tDefense Int tOHAxe Int tOHMace Int tOHSword Int tTHAxe Int tTHMace Int tTHSword Int tAlchemy Int tBlacksmithing Int tCooking Int tEnchanting Int tEngineering Int tFirstAid Int tFishing Int tHerbalism Int tLeatherworking Int tMining Int tSkinning Int tTailoring Event OnPageReset(String Page) If (Page == "") Getallstats() ElseIf (Page == "Player Stats") SetCursorFillMode(TOP_TO_BOTTOM) SetCursorPosition(0) AddHeaderOption("") tPlayerName = AddTextOption(Game.GetPlayer().GetBaseObject().GetName(), aVal) tClass = AddTextOption("Class: " + sClass, aVal) tLevel = AddTextOption("Level " + Wow_Var_Level.GetValueInt(), aVal) tExp = AddTextOption("Experience: " + Wow_Var_Experience.GetValueInt(), aVal) tAgility = AddTextOption("Agility: " + Wow_Att_Agility.GetValueInt(), aVal) tIntellect = AddTextOption("Intellect: " + Wow_Att_Intellect.GetValueInt(), aVal) tSpirit = AddTextOption("Spirit: " + Wow_Att_Spirit.GetValueInt(), aVal) tStamina = AddTextOption("Stamina: " + Wow_Att_Stamina.GetValueInt(), aVal) tStrength = AddTextOption("Strength: " + Wow_Att_Strength.GetValueInt(), aVal) ;; SetCursorPosition(1) AddHeaderOption("") tArmor = AddTextOption("Armor: " + Wow_Stat_Armor.GetValueInt(), aVal) tAttackPower = AddTextOption("Attack Power: " + Wow_Stat_AttackPower.GetValueInt(), aVal) tBlock = AddTextOption("Block Chance: " + Wow_Stat_Block.GetValueInt(), aVal) tCrit = AddTextOption("Crit Chance: " + Wow_Stat_Crit.GetValueInt(), aVal) tHaste = AddTextOption("Haste: " + Wow_Stat_Haste.GetValueInt(), aVal) tHit = AddTextOption("Hit: " + Wow_Stat_Hit.GetValueInt(), aVal) tMP5 = AddTextOption("Mana Per 5 Seconds: " + Wow_Stat_MP5.GetValueInt(), aVal) tParry = AddTextOption("Parry Rating: " + Wow_Stat_Parry.GetValueInt(), aVal) tSpellPower = AddTextOption("Spell Power: " + Wow_Stat_Spellpower.GetValueInt(), aVal) SetCursorFillMode(LEFT_TO_RIGHT) SetCursorPosition(20) AddHeaderOption("") AddHeaderOption("") ElseIf (Page == "Initialize") If Wow_Var_Initialize.GetValueInt() == 0 Int Class1 = Wow_M_ClassSelect.Show() If Class1 == 0 Wow_Var_Class.SetValue(1) ;Warrior ElseIf Class1 == 1 Wow_Var_Class.SetValue(2) ;Warlock ElseIf Class1 == 2 Wow_Var_Class.SetValue(3) ;Shaman ElseIf Class1 == 3 Wow_Var_Class.SetValue(4) ;Rogue ElseIf Class1 == 4 Int Class2 = Wow_M_ClassSelect_2.Show() If Class2 == 0 Wow_Var_Class.SetValue(5) ;Priest ElseIf Class2 == 1 Wow_Var_Class.SetValue(6) ;Paladin ElseIf Class2 == 2 Wow_Var_Class.SetValue(7) ;Mage ElseIf Class2 == 3 Wow_Var_Class.SetValue(8) ;Hunter ElseIf Class2 == 4 Wow_Var_Class.SetValue(9) ;Druid ElseIf Class2 == 5 Int Class3 = Wow_M_ClassSelect.Show() If Class3 == 0 Wow_Var_Class.SetValue(1) ;Warrior ElseIf Class3 == 1 Wow_Var_Class.SetValue(2) ;Warlock ElseIf Class3 == 2 Wow_Var_Class.SetValue(3) ;Shaman ElseIf Class3 == 3 Wow_Var_Class.SetValue(4) ;Rogue ElseIf Class3 == 4 Int Class4 = Wow_M_ClassSelect_2.Show() If Class4 == 0 Wow_Var_Class.SetValue(5) ;Priest ElseIf Class4 == 1 Wow_Var_Class.SetValue(6) ;Paladin ElseIf Class4 == 2 Wow_Var_Class.SetValue(7) ;Mage ElseIf Class4 == 3 Wow_Var_Class.SetValue(8) ;Hunter ElseIf Class4 == 4 Wow_Var_Class.SetValue(9) ;Druid EndIf EndIf EndIf EndIf EndIf If Wow_Var_Class.GetValueInt() != 0 Wow_Var_Initialize.SetValue(1) EndIf EndIf EndEvent Function Getallstats() Int pClass = Wow_Var_Class.GetValueInt() If pClass == 0 sClass = "None" ElseIf pClass == 1 sClass = "Warrior" ElseIf pClass == 2 sClass = "Warlock" ElseIf pClass == 3 sClass = "Shaman" ElseIf pClass == 4 sClass = "Rogue" ElseIf pClass == 5 sClass = "Priest" ElseIf pClass == 6 sClass = "Paladin" ElseIf pClass == 7 sClass = "Mage" ElseIf pClass == 8 sClass = "Hunter" ElseIf pClass == 9 sClass = "Druid" EndIf If Wow_Var_Class.GetValueInt() == 1 Wow_Att_Agility.SetValue(10) Wow_Att_Intellect.SetValue(8) Wow_Att_Spirit.SetValue(8) Wow_Att_Stamina.SetValue(11) Wow_Att_Strength.SetValue(17) EndIf EndFunction Stats Script Scriptname Wow_StatDistribution extends Quest {Handles stat distribution for leveling} ;Globals GlobalVariable Property Wow_Att_Agility Auto GlobalVariable Property Wow_Att_Intellect Auto GlobalVariable Property Wow_Att_Spirit Auto GlobalVariable Property Wow_Att_Stamina Auto GlobalVariable Property Wow_Att_Strength Auto GlobalVariable Property Wow_Var_Level Auto GlobalVariable Property Wow_Var_Class Auto Bool StatLock2 = False Bool StatLock3 Bool StatLock4 Bool StatLock5 Bool StatLock6 Bool StatLock7 Bool StatLock8 Bool StatLock9 Bool StatLock10 Bool StatLock11 Bool StatLock12 Bool StatLock13 Bool StatLock14 Bool StatLock15 Bool StatLock16 Bool StatLock17 Bool StatLock18 Bool StatLock19 Bool StatLock20 Bool StatLock21 Bool StatLock22 Bool StatLock23 Bool StatLock24 Bool StatLock25 Bool StatLock26 Bool StatLock27 Bool StatLock28 Bool StatLock29 Bool StatLock30 Bool StatLock31 Bool StatLock32 Bool StatLock33 Bool StatLock34 Bool StatLock35 Bool StatLock36 Bool StatLock37 Bool StatLock38 Bool StatLock39 Bool StatLock40 Bool StatLock41 Bool StatLock42 Bool StatLock43 Bool StatLock44 Bool StatLock45 Bool StatLock46 Bool StatLock47 Bool StatLock48 Bool StatLock49 Bool StatLock50 Bool StatLock51 Bool StatLock52 Bool StatLock53 Bool StatLock54 Bool StatLock55 Bool StatLock56 Bool StatLock57 Bool StatLock58 Bool StatLock59 Bool StatLock60 Function Stats() If Wow_Var_Class.GetValue() == 1 Warrior() EndIf EndFunction Function Warrior() Debug.Notification("Got warrior stats") Int Level = Wow_Var_Level.GetValue() as Int If Level == 1 ;Ignore ElseIf Level == 2 If StatLock2 == False Wow_Att_Agility.SetValue(12) Wow_Att_Intellect.SetValue(9) Wow_Att_Spirit.SetValue(9) Wow_Att_Stamina.SetValue(12) Wow_Att_Strength.SetValue(19) Debug.Notification("Stats set") StatLock2 == True EndIf EndIf EndFunction - Note - In the stat distribution script, none of the global variables are setting on level up. Leveling script Scriptname Wow_LevelBase extends Quest GlobalVariable Property Wow_Var_Class Auto GlobalVariable Property Wow_Var_Level Auto GlobalVariable Property Wow_Var_Experience Auto GlobalVariable Property Wow_Att_Agility Auto GlobalVariable Property Wow_Att_Intellect Auto GlobalVariable Property Wow_Att_Spirit Auto GlobalVariable Property Wow_Att_Stamina Auto GlobalVariable Property Wow_Att_Strength Auto Wow_StatDistribution Property Stats Auto Function XPCheck(String Level, Float XP) If Level == "Player" Wow_Var_Experience.SetValue(Wow_Var_Experience.GetValue() + XP) EndIf LevelUp() EndFunction Function LevelUp() Int XP = Wow_Var_Experience.GetValue() as Int Int Level = Wow_Var_Level.GetValue() as Int Bool[] DoOnce = New Bool[60] Int[] Warrior = New Int[60] Int[] Warlock = New Int[60] Int[] Shaman = New Int[60] Int[] Rogue = New Int[60] Int[] Priest = New Int[60] Int[] Paladin = New Int[60] Int[] Mage = New Int[60] Int[] Hunter = New Int[60] Int[] Druid = New Int[60] If Wow_Var_Class.GetValueInt() == 1 Warrior[1] Wow_Att_Agility.SetValue(10) Wow_Att_Intellect.SetValue(8) Wow_Att_Strength.SetValue(17) Wow_Att_Stamina.SetValue(11) Wow_Att_Spirit.SetValue(8) EndIf If XP > 0 && XP < 400 If DoOnce[0] == False Wow_Var_Level.SetValue(1) If Wow_Var_Class.GetValueInt() == 1 Warrior[1] EndIf DoOnce[0] == True EndIf ElseIf XP > 400 && XP < 1300 Wow_Var_Level.SetValue(2) ElseIf XP > 1300 && XP < 2700 Wow_Var_Level.SetValue(3) ElseIf XP > 2700 && XP < 4800 Wow_Var_Level.SetValue(4) ElseIf XP > 4800 && XP < 7600 Wow_Var_Level.SetValue(5) ElseIf XP > 7600 && XP < 11200 Wow_Var_Level.SetValue(6) ElseIf XP > 11200 && XP < 15700 Wow_Var_Level.SetValue(7) ElseIf XP > 15700 && XP < 21100 Wow_Var_Level.SetValue(8) ElseIf XP > 21100 && XP < 27600 Wow_Var_Level.SetValue(9) ElseIf XP > 27600 && XP < 34100 Wow_Var_Level.SetValue(10) ElseIf XP > 34100 && XP < 41700 Wow_Var_Level.SetValue(11) ElseIf XP > 41700 && XP < 50400 Wow_Var_Level.SetValue(12) ElseIf XP > 50400 && XP < 60200 Wow_Var_Level.SetValue(13) ElseIf XP > 60200 && XP < 71200 Wow_Var_Level.SetValue(14) ElseIf XP > 71200 && XP < 83500 Wow_Var_Level.SetValue(15) ElseIf XP > 83500 && XP < 97100 Wow_Var_Level.SetValue(16) ElseIf XP > 97100 && XP < 112100 Wow_Var_Level.SetValue(17) ElseIf XP > 112100 && XP < 128500 Wow_Var_Level.SetValue(18) ElseIf XP > 128500 && XP < 146300 Wow_Var_Level.SetValue(19) ElseIf XP > 146300 && XP < 163300 Wow_Var_Level.SetValue(20) ElseIf XP > 163300 && XP < 181100 Wow_Var_Level.SetValue(21) ElseIf XP > 181100 && XP < 203500 Wow_Var_Level.SetValue(22) ElseIf XP > 203500 && XP < 227500 Wow_Var_Level.SetValue(23) ElseIf XP > 227500 && XP < 253000 Wow_Var_Level.SetValue(24) ElseIf XP > 253000 && XP < 280200 Wow_Var_Level.SetValue(25) ElseIf XP > 280200 && XP < 309100 Wow_Var_Level.SetValue(26) ElseIf XP > 309100 && XP < 339600 Wow_Var_Level.SetValue(27) ElseIf XP > 339600 && XP < 371800 Wow_Var_Level.SetValue(28) ElseIf XP > 371800 && XP < 405700 Wow_Var_Level.SetValue(29) ElseIf XP > 405700 && XP < 442000 Wow_Var_Level.SetValue(30) ElseIf XP > 442000 && XP < 480800 Wow_Var_Level.SetValue(31) ElseIf XP > 480800 && XP < 522400 Wow_Var_Level.SetValue(32) ElseIf XP > 522400 && XP < 567000 Wow_Var_Level.SetValue(33) ElseIf XP > 567000 && XP < 615000 Wow_Var_Level.SetValue(34) ElseIf XP > 615000 && XP < 666400 Wow_Var_Level.SetValue(35) ElseIf XP > 666400 && XP < 721400 Wow_Var_Level.SetValue(36) ElseIf XP > 721400 && XP < 780100 Wow_Var_Level.SetValue(37) ElseIf XP > 780100 && XP < 842500 Wow_Var_Level.SetValue(38) ElseIf XP > 842500 && XP < 908700 Wow_Var_Level.SetValue(39) ElseIf XP > 908700 && XP < 978900 Wow_Var_Level.SetValue(40) ElseIf XP > 978900 && XP < 1053200 Wow_Var_Level.SetValue(41) ElseIf XP > 1053200 && XP < 1131700 Wow_Var_Level.SetValue(42) ElseIf XP > 1131700 && XP < 1214500 Wow_Var_Level.SetValue(43) ElseIf XP > 1214500 && XP < 1301600 Wow_Var_Level.SetValue(44) ElseIf XP > 1301600 && XP < 1393200 Wow_Var_Level.SetValue(45) ElseIf XP > 1393200 && XP < 1489500 Wow_Var_Level.SetValue(46) ElseIf XP > 1489500 && XP < 1590500 Wow_Var_Level.SetValue(47) ElseIf XP > 1590500 && XP < 1696300 Wow_Var_Level.SetValue(48) ElseIf XP > 1696300 && XP < 1807000 Wow_Var_Level.SetValue(49) ElseIf XP > 1807000 && XP < 1922700 Wow_Var_Level.SetValue(50) ElseIf XP > 1922700 && XP < 2043600 Wow_Var_Level.SetValue(51) ElseIf XP > 2043600 && XP < 2169700 Wow_Var_Level.SetValue(52) ElseIf XP > 2169700 && XP < 2301200 Wow_Var_Level.SetValue(53) ElseIf XP > 2301200 && XP < 2438200 Wow_Var_Level.SetValue(54) ElseIf XP > 2438200 && XP < 2580700 Wow_Var_Level.SetValue(55) ElseIf XP > 2580700 && XP < 2728900 Wow_Var_Level.SetValue(56) ElseIf XP > 2728900 && XP < 2882900 Wow_Var_Level.SetValue(57) ElseIf XP > 2882900 && XP < 3042800 Wow_Var_Level.SetValue(58) ElseIf XP > 3042800 && XP < 3208600 Wow_Var_Level.SetValue(59) ElseIf XP > 3208600 Wow_Var_Level.SetValue(60) EndIf Stats.Stats() EndFunction The XP test script Scriptname Wow_XP_Test extends activemagiceffect Wow_LevelBase Property Give Auto Event OnEffectStart(Actor caster, Actor Target) Give.XPCheck("Player", 40) EndEvent - Edit, after posting all this I realized I left some old untested code in there that I forgot about due to drinking and coding, let me remove it and see what happens. Edited April 14, 2019 by Rizalgar Link to comment Share on other sites More sharing options...
IsharaMeradin Posted April 14, 2019 Share Posted April 14, 2019 Maybe papyrus is getting confused between a property variable referencing another script called Stats and a function on that script called Stats. For the heck of it, try giving one of them a different name. What is the worst that can happen, still not work? Link to comment Share on other sites More sharing options...
Rizalgar Posted April 14, 2019 Author Share Posted April 14, 2019 (edited) lol touche Ishara, I'll give it a go. Thanks for the fast reply. - Edit - After changing the function call name, still nothing. It boggles my mind why it won't work. - Edit 2 - I removed the static variables set by the MCM class selection and moved it into the leveling function. Now, the stats properly add on level up. How odd, why would the MCM lock the variables like that? However, the StatLock boolean still isn't working, so it stacks, which is not intended. Edited April 14, 2019 by Rizalgar Link to comment Share on other sites More sharing options...
Recommended Posts