EvanHolt
|
  |
| Joined: 06 Sep 2008 |
| Total Posts: 1264 |
|
|
| 10 Mar 2017 09:56 PM |
| What does the error "Attempt to call a number value" mean? This is the code causing it: damage = { max = 30, min = ## # ######## = { max = 80, min = 120 } dist = ([character1].Head.Position - [character2].Head.Position).magnitude dmg = -((damage.max-damage.min)/(dmgRange.max-dmgRange.min))(dist-dmgRange.min) + damage.max [character1] and [character2] are placeholders for the hierarchies of two arbitrary characters. The error refers back to the line in which I define the variable "dmg." |
|
|
| Report Abuse |
|
|
EvanHolt
|
  |
| Joined: 06 Sep 2008 |
| Total Posts: 1264 |
|
|
| 10 Mar 2017 09:57 PM |
Filters... Let me try again.
What does the error "Attempt to call a number value" mean? This is the code causing it:
damage = { max = number1, min = number2 } dmgRange = { max = number3, min = number4 } dist = ([character1].Head.Position - [character2].Head.Position).magnitude
dmg = -((damage.max-damage.min)/(dmgRange.max-dmgRange.min))(dist-dmgRange.min) + damage.max
[character1] and [character2] are placeholders for the hierarchies of two arbitrary characters.
The error refers back to the line in which I define the variable "dmg."
[ George Orwell taught me math! 2 + 2 = 5 ] |
|
|
| Report Abuse |
|
|
EvanHolt
|
  |
| Joined: 06 Sep 2008 |
| Total Posts: 1264 |
|
|
| 10 Mar 2017 09:58 PM |
Make up whatever numbers you want for number1, number2, number3, and number4. The error occurs regardless.
[ George Orwell taught me math! 2 + 2 = 5 ] |
|
|
| Report Abuse |
|
|
EvanHolt
|
  |
| Joined: 06 Sep 2008 |
| Total Posts: 1264 |
|
|
| 10 Mar 2017 10:38 PM |
Bump
[ George Orwell taught me math! 2 + 2 = 5 ] |
|
|
| Report Abuse |
|
|
BlupoV2
|
  |
| Joined: 12 Nov 2012 |
| Total Posts: 543 |
|
|
| 10 Mar 2017 10:41 PM |
"dmg = -((damage.max-damage.min)/(dmgRange.max-dmgRange.min))(dist-dmgRange.min) + damage.max"
Lua interprets "-((damage.max-damage.min)/(dmgRange.max-dmgRange.min))(dist-dmgRange.min)" as a function call because of the way it's written.
It should be "-((damage.max-damage.min)/(dmgRange.max-dmgRange.min)) * (dist-dmgRange.min)" if you're trying to multiply it. |
|
|
| Report Abuse |
|
|
EvanHolt
|
  |
| Joined: 06 Sep 2008 |
| Total Posts: 1264 |
|
|
| 10 Mar 2017 11:13 PM |
Oh whoops. Thanks!
[ George Orwell taught me math! 2 + 2 = 5 ] |
|
|
| Report Abuse |
|
|