Jump to content

Some scripted math help, please


Paliben

Recommended Posts

Okay, so I have a math formula. In a debug spell I use to get the value of the formula, it reads out 1240 (I believe it was, bad memory ftw). Now, I take that same math formula and put it inside another script, and it comes out -224. I don't know if it's just weird flow, how it's executed, if it's not doing the whole math problem before providing an answer or what. Any help in this would be appreciated, or even a better way to do the formula.

As a breakdown of it, it's basically "required amount to level". Where x is current level, and y is required amount to level. I'll provide scripts below.

The debug script, which gives an amount I am fine with.

  Reveal hidden contents



Then the leveling script, which for some reason comes out -224.xxxx. I'll add in the whole script to give a better picture.

 

Amount shown in level menu

https://drive.google.com/file/d/1hpm15tA2yDYJctlILk-Bm7-0hwBc8w6P/view


Debug amount
https://drive.google.com/file/d/1pYDYVFivcouZp-5ma97Xfx1pAtQiZI8Y/view

Link to comment
Share on other sites

your first script

Scriptname SSTestScript extends ActiveMagicEffect
Int x = SSPlayerLevel.GetValueInt()
Int y = (((x * 3) + (3 * x * 2)) + 105 * x) * 10 as Int

your second script

Scriptname SSBonfireScript extends ObjectReference
Int x = SSPlayerLevel.GetValueInt()
Float y = (((x * 3) + (3 * x * 2)) + 105 * x)

By using x, y or z (inside an ObjectReference or Actor script) it will be treated here as self.X, self.Y or self.Z, that means self.X is the same as self.GetPositionX()

 

Workaround use other variable names like fx, fy or fz for float, ix, iy or iz for int variables

 

  Reveal hidden contents

 

Edited by ReDragon2013
Link to comment
Share on other sites

Ugh if that's all it is. RIP. I forgot about .mod too, so used to adding/subtracting from variables using that method it's burned in to my brain. I'll give the variable name change a go. If you don't hear back from me, all is well and I appreciate your help. Many thanks, friend!

Link to comment
Share on other sites

  • Recently Browsing   0 members

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