Jump to content

DOWNLOAD MODS

Are you looking for something shiny for your load order? We have many exclusive mods and resources you won't find anywhere else. Start your search now...

LEARN MODDING

Ready to try your hand at making your own mod creations? Visit the Enclave, the original ES/FO modding school, and learn the tricks of the trade from veteran modders...

JOIN THE ALLIANCE

Membership is free and registering unlocks image galleries, project hosting, live chat, unlimited downloads, & more...

OBSE help


Critterman
 Share

Recommended Posts

First off I'm using OBSE v1800. I've been trying to add a dynamic stack gain to my Stackable Oblivion mod, but out of the blue the GetArmorAR function started giving me really weird values.

I posted this question on the CS forums over at beth but got no response so I guess I'll ask here, and in more detail so that the helpful people that browse these forums can help.

Here is entire first half of my script so that someone may spot something wrong:

ref Helmet

ref Cuirass

ref Boots

ref Greaves

ref Gauntlets

ref Shield

ref Weapon

ref NHelmet

ref NCuirass

ref NBoots

ref NGreaves

ref NGauntlets

ref NShield

ref NWeapon

ref NewObj

short Choosing

short Choice

float ItemNum

long ArmorAR

long OldAR

long WeapDMG

long OldDMG

float temp

float temp2

float fQuestDelayTime

short GamemodeCheck

short MenumodeRun


Begin Gamemode

    Set fQuestDelayTime to 0.01

    if GamemodeCheck == 1

        Set MenumodeRun to 1

    endif

End


Begin Menumode 1002

    if OnControlDown 7 == 1

        Set Choosing to -1

        Set Helmet to Player.GetEquippedObject 1

        Set Cuirass to Player.GetEquippedObject 2

        Set Greaves to Player.GetEquippedObject 3

        Set Gauntlets to Player.GetEquippedObject 4

        Set Boots to Player.GetEquippedObject 5

        Set Shield to Player.GetEquippedObject 13

        Set Weapon to Player.GetEquippedObject 16

        if Database.Full == 1

            Message "WARNING: You have used up the 30 slots in the stack database! Do not stack anymore items!"

        endif

    endif

    if Choosing == -1

        MessageBoxEx "Select which object to stack. (<no name> means you have no item equipped in that slot) |Helmet: %n|Cuirass: %n|Greaves: %n|Gauntlets: %n|Boots: %n|Shield: %n|Weapon: %n|Close" Helmet Cuirass Greaves Gauntlets Boots Shield Weapon

        Set Choosing to 1

        Set Choice to -1

    elseif Choosing == 1

        if Choice == -1

            Set Choice to GetButtonPressed

        elseif Choice == 0

            Set ItemNum to Player.GetItemCount Helmet

            if ItemNum > 1

                Let OldAR := GetArmorAR Helmet

                PrintC "CM: OldAR == %.2f" OldAR

                let temp := OldAR / 100

                PrintC "CM: 1. temp = %.2f" temp

                let temp := 1 - temp

                PrintC "CM: 2. temp = %.2f" temp

                let temp2 := 1.28

                PrintC "CM: 3. temp2 = %.2f" temp2

                let temp2 ^= temp

                PrintC "CM: 4. temp2 = %.2f" temp2

                let ArmorAR := 1 - temp2

                PrintC "CM: 5. ArmorAR = %.2f" ArmorAR

                let ArmorAR := 100 * ArmorAR

                PrintC "CM: 6. ArmorAR = %.2f" ArmorAR

                Player.UnequipItemNS Helmet

                Set NHelmet to CloneForm Helmet

                SetArmorAR ArmorAR NHelmet

                Player.AddItemNS NHelmet 1

                Player.RemoveItemNS Helmet 2

                Player.EquipItemNS NHelmet

                Call AddToDatabase NHelmet 1

                PrintC "CM: Save01 = %n" Database.Save01

                Set Choosing to 0

                return

Now, you'll see I added a bunch of debug text to the math part, I did this to begin with when my armor was getting set to odd values. But what I found was that the original GetArmorAR call was not working right. Here is the print out exactly though:

"CM: OldAR == 300.00"

"CM: 1. temp = 3.00"

"CM: 2. temp = -2.00"

"CM: 3. temp2 = 1.28"

"CM: 4. temp2 = 0.61"

"CM: 5. ArmorAR = 0.00"

"CM: 6. ArmorAR = 0.00"

I'm totally confused, why would it give me 300 instead of the 1 I should get (was testing with a Guard Helmet). I should also mention that when I later call GetArmorAR on the new cloned and set AR object it gives me a 0. :huh:

AND, what confuses me even more is that even the SetArmorAR line isn't working. I got 0 as my final ArmorAR right? So why didn't I have an Armor rating of 0 at the end (maybe not possible)? BUT, when I do this whole code again on my newly cloned object it sets the AR to 145 :poke: . (the final ArmorAR value after all of the math there is -100).

Ok complete chaos, am I right? And then something happened that really got me stumped. Once of my cloned object got a " (2)" appended on it's name. Ok I looked through the ENTIRE script and nowhere to I have an AppendName call. But I did put it in before, I had set a string_var to " (2)" and in the script I had put AppendName [string_var]. BUT I had deleted that! :lmao: I'm certain I don't have another script running in the background that I may have forgot, because I checked the details menu in the CS and only saw the scripts that I had.

So now I have some phantom code running on my mod :rofl: . Do I make a new script, and copy the code over or something? This has really got me :D , usually its some stupidness on my part that causes these problems, but now I'm convinced its some OBSE madness (I really hope it's some stupid mistake I made).

Any suggestions? I'm pretty sure I explained everything out, I can post the entire script if you want to look at it too.

Link to comment
Share on other sites

I haven't tested the script on an OBSE version previous to v1800, but I'm pretty sure it was working before. It only started to screw up once I added in all of the math.

And if you look at the script I call "Set Helmet to Player.GetEquippedObject 1" and then after that I do the "GetArmorAR Helmet" So I'm pretty sure I am, in fact, calling the GetArmorAR on the Helmet that is equipped.

I suppose I will have to bug the OBSE people about this as I have no where else to turn. I think I'll try removing the stuff that started all of this mess and see if that helps matters. If not I'll ask on the OBSE thread... aa_mellow.gif

Link to comment
Share on other sites

Ok, looks like it was a dumb mistake of mine again... well my ignorance at least. Apparently, according to the wiki (why oh why did I not look there before!?!?), GetArmorAR returns the armor's AR... multiplied by 100. I have no idea why they would do such a thing and not explain this in the OBSE command documentation :cookie: . Well, at least I know what the heck was going on (apparently the guard helmet's AR is 3 :wallbash: ), soo now I can continue on with my mod! Excellent! laugh.gif

EDIT: Though I still have yet to figure out that random appending " (2)"...

Link to comment
Share on other sites

that is a might bizarre, and I am curious why they would do such a thing as well.... I wonder if it is just not a function of the game engine being weird though. Not like that never happens..... :stare:

Glad ya got it figgered out though.

Your math looks kinda funny to me though....... but that may just be because I am tired...... How much do you want to raise the AR of an item when combining it with a like item?

Link to comment
Share on other sites

that is a might bizarre, and I am curious why they would do such a thing as well.... I wonder if it is just not a function of the game engine being weird though. Not like that never happens..... :woot:

Glad ya got it figgered out though.

Your math looks kinda funny to me though....... but that may just be because I am tired...... How much do you want to raise the AR of an item when combining it with a like item?

Yeah, I figured it was because some armor is set to values like 3.75 and stuff so the extra digits are there so you get to see that. :P

And you're probably right about that math being wrong. I started splitting it up once all this weirdness happened and I'm sure something got messed up in the process. I'm trying to raise the old armor's AR to an exponent of 1.28, or eh... I can't really explain but here is the math that I had to begin with, and should work...

let temp := 1 - (oldAR / 100)

let temp ^= 1.28

let newAR := 100 * (1 - temp)

Link to comment
Share on other sites

Why the exponent though? wouldn't just bumping it up some small percent be easier? (and less prone to odd errors?)

Also, it looks like you re-clone the object each time thru? That is going to introduce some save game bloat there, as so far as I know, there is no way to clean the clones out of the savegame. Same problem I am running into with CoC.... Might be better to put a check in there to see if the item already IS a cloned form, and if so, apply any changes to that.

Link to comment
Share on other sites

Why the exponent though? wouldn't just bumping it up some small percent be easier? (and less prone to odd errors?)

Also, it looks like you re-clone the object each time thru? That is going to introduce some save game bloat there, as so far as I know, there is no way to clean the clones out of the savegame. Same problem I am running into with CoC.... Might be better to put a check in there to see if the item already IS a cloned form, and if so, apply any changes to that.

Well, the exponent makes it so the item gain degrades over time. I'm fairly sure it's the same way Two Worlds did it. Tejon has provided the math so it should work laugh.gif, apparently hes the "Master of Exponents" around here :P .

And you've got a point with the cloned items. I did check around and it seems I wouldn't be making enough cloned items to cause a bloat, but I would rather do something to try to prevent it. For some reason I never thought of just changing the stats of the cloned item :P that should help prevent the bloat a lot, and I think it would prevent a few more bugs also. Thanks for the suggestion! :woot:

Link to comment
Share on other sites

I am not sure how berserk any one mod is going to have to get with cloned forms to start being a problem, but, what I was considering was that it is an extremely useful function, and my guess is that a fair number of folks will/are use(ing) it, so, cumulatively, it might become a problem, so, I do whatever I can to reduce the impact. :woot:

Ok, the rationale for the exponent seems perfectly reasonable. If it works, way cool.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...