Jump to content

What's wrong with this script?


Rizalgar

Recommended Posts

Okay, here's what's not working

 

- Global value is not setting on level up

- The boolean is not returning true to prevent stacking

 

 

  Reveal hidden contents

 

 

- Note - I am getting all the debugs

Edited by Rizalgar
Link to comment
Share on other sites

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

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 -

 

  Reveal hidden contents

 

 

I may end up just using statics to make this easier, it will take a lot longer but at least it will work.

Edited by Rizalgar
Link to comment
Share on other sites

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

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

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

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 by Rasikko
Link to comment
Share on other sites

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

 

  Reveal hidden contents

 

 

 

Stats Script

 

  Reveal hidden contents

 

 

- Note - In the stat distribution script, none of the global variables are setting on level up.

 

Leveling script

 

  Reveal hidden contents

 

 

The XP test script

 

  Reveal hidden contents

 

 

 

- 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 by Rizalgar
Link to comment
Share on other sites

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

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 by Rizalgar
Link to comment
Share on other sites

  • Recently Browsing   0 members

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