Bobb1118
|
  |
| Joined: 03 Oct 2008 |
| Total Posts: 476 |
|
|
| 05 May 2013 12:28 PM |
Stats.Remainder.Text = tostring((75.5 * Attack.Level.Value + (75.5 * Attack.Level.Value * 0.105)) - Attack.Xp.Value)
for level 1 this returns 83.475. is there any way in the equation that i can make it round to a whole number? |
|
|
| Report Abuse |
|
|
Cupkle
|
  |
| Joined: 18 Jun 2012 |
| Total Posts: 180 |
|
|
| 05 May 2013 12:29 PM |
| Yeah, use math.floor. It rounds it to the lowest integer. |
|
|
| Report Abuse |
|
|
Bobb1118
|
  |
| Joined: 03 Oct 2008 |
| Total Posts: 476 |
|
|
| 05 May 2013 12:45 PM |
| could you possibly show where to put that in the line? |
|
|
| Report Abuse |
|
|
|
| 05 May 2013 12:46 PM |
| Stats.Remainder.Text = tostring(math.floor((75.5 * Attack.Level.Value + (75.5 * Attack.Level.Value * 0.105)) - Attack.Xp.Value)) |
|
|
| Report Abuse |
|
|
Bobb1118
|
  |
| Joined: 03 Oct 2008 |
| Total Posts: 476 |
|
| |
|
| |
|
pwnedu46
|
  |
| Joined: 23 May 2009 |
| Total Posts: 7534 |
|
|
| 05 May 2013 01:04 PM |
There are a few ways to round things.
local num = 1.234 math.floor(num) -- always rounds down math.ceil(num) -- always rounds up math.floor(num + 0.5) -- rounds to the nearest integer |
|
|
| Report Abuse |
|
|
|
| 05 May 2013 01:07 PM |
Re: (math.floor((75.5 * Attack.Level.Value + (75.5 * Attack.Level.Value * 0.105)) - Attack.Xp.Value))
if math.floor does not accept a V# as an argument (I thought that it didn't) then Math.floor each x,y,z value.
--Bri
|
|
|
| Report Abuse |
|
|
Bobb1118
|
  |
| Joined: 03 Oct 2008 |
| Total Posts: 476 |
|
|
| 05 May 2013 01:15 PM |
I need some help with math actually ._.
exp required per level needs to increase by 10% starting from 83 exp,
Level 1 - 83xp Level 2 - 91xp more Level 3 - 102xp more
Level 10 - 185xp more
Level 50 - 9,612xp more
Level 90 - 504,037xp more
basically, an equation that will take the amount of xp require to get from one level to the next, add 10% of itself onto that and be the amount required to get to the next level
or a way that i can reference a table that i put in exact exp values for each level and it will be used in the equation
1 = 0 2 = 83 3 = 174 4 = 276 5 = 388 6 = 512 7 = 650 8 = 801 9 = 969 10 = 1,154
halp screw D: i wanna do this table way instead |
|
|
| Report Abuse |
|
|
|
| 05 May 2013 01:31 PM |
Like this?
function expneed(lvl,exp) if lvl > 1 then if not exp then exp=83/11*10 end expneed(lvl-1,exp+exp/10) elseif lvl == 1 then if not exp then exp = 0 end return exp end end |
|
|
| Report Abuse |
|
|
Bobb1118
|
  |
| Joined: 03 Oct 2008 |
| Total Posts: 476 |
|
|
| 05 May 2013 01:39 PM |
i want it to reference a table instead, so i can set the exp more to my liking, like
table stuff with exp per level 5 = 1000
stuff is now easy
Stats.Current.Text = Attack.Xp.Value Stats.Next.Text = Attack.Level.Value that will be a number between 1-99, that with refence a number 1-99 in the table above to show how much exp is needed for the next level
ex. Stats.Next.Text = Attack.Level.Value (5) so the text will be "1000" |
|
|
| Report Abuse |
|
|
|
| 05 May 2013 01:45 PM |
exptable={[1]=1,[2]=3,[3]=100} print(exptable[1],exptable[3],exptable[2]) |
|
|
| Report Abuse |
|
|
Bobb1118
|
  |
| Joined: 03 Oct 2008 |
| Total Posts: 476 |
|
|
| 05 May 2013 01:52 PM |
| and how can i make it so when a value for level comes up in a function, it will call the value in the table with the same number? |
|
|
| Report Abuse |
|
|
|
| 05 May 2013 01:55 PM |
exptable={[30]=32321} level = 30 return exptable[level]
o-o |
|
|
| Report Abuse |
|
|
doneyes
|
  |
| Joined: 21 Mar 2008 |
| Total Posts: 3466 |
|
|
| 05 May 2013 02:12 PM |
screw where did your profile picture go?
|
|
|
| Report Abuse |
|
|
Bobb1118
|
  |
| Joined: 03 Oct 2008 |
| Total Posts: 476 |
|
|
| 05 May 2013 02:22 PM |
exptable = {[1]=0, [2]=83, [3]=174, [4]=276, [5]=388}
atklevel = Attack.Level.Value print exptable[atklevel] << how do i write this the right way to make it print the table value |
|
|
| Report Abuse |
|
|
Bobb1118
|
  |
| Joined: 03 Oct 2008 |
| Total Posts: 476 |
|
|
| 05 May 2013 02:32 PM |
return exptable[level]
whats this mean i dont understand :x |
|
|
| Report Abuse |
|
|
|
| 05 May 2013 02:32 PM |
| print (exptable[atklevel]) |
|
|
| Report Abuse |
|
|
Bobb1118
|
  |
| Joined: 03 Oct 2008 |
| Total Posts: 476 |
|
|
| 05 May 2013 02:47 PM |
i wish i didnt suck so much at this
118 atklevel = Attack.Level.Value 119 conlevel = Constitution.Level.Value 120 print 'Attack Level = '(exptable[atklevel]) 121 print 'Constitution Level = '(exptable[conlevel])
Attack Level = 15:43:37.163 - Players.Player1.PlayerGui.Bobb1118RPG.StatsFrame.Frame.Scri:120: attempt to call a nil value 15:43:37.164 - Script "Players.Player1.PlayerGui.Bobb1118RPG.StatsFrame.Frame.Scri", Line 120 15:43:37.165 - stack end |
|
|
| Report Abuse |
|
|
|
| 05 May 2013 02:50 PM |
exptable={[1]=50,[2]=100}--etc atklevel = Attack.Level.Value conlevel = Constitution.Level.Value print ('Attack Level = '..(exptable[atklevel])) print ('Constitution Level = '..(exptable[conlevel])) |
|
|
| Report Abuse |
|
|
Bobb1118
|
  |
| Joined: 03 Oct 2008 |
| Total Posts: 476 |
|
|
| 05 May 2013 03:06 PM |
thanks! now i know how to use that right. I just dont understand why its printing twice
atklevel = Attack.Level.Value conlevel = Constitution.Level.Value print ('Attack Level = '..Attack.Level.Value) print ('Exp for next Attack Level = '..(exptable[atklevel])) print ('Constitution Level = '..Constitution.Level.Value) print ('Exp for next Constitution Level = '..(exptable[conlevel]))
Output
Attack Level = 1 Exp for next Attack Level = 0 Constitution Level = 10 Exp for next Constitution Level = 1154 Attack Level = 1 Exp for next Attack Level = 0 Constitution Level = 10 Exp for next Constitution Level = 1154 |
|
|
| Report Abuse |
|
|
|
| 05 May 2013 03:08 PM |
| With the given script, it shouldn't be doing that because it's only calling print 4 times...o-o |
|
|
| Report Abuse |
|
|
Bobb1118
|
  |
| Joined: 03 Oct 2008 |
| Total Posts: 476 |
|
|
| 05 May 2013 03:12 PM |
heres the whole one, minus variables and the table..
atklevel = Attack.Level.Value conlevel = Constitution.Level.Value print ('Attack Level = '..Attack.Level.Value) print ('Exp for next Attack Level = '..(exptable[atklevel])) print ('Constitution Level = '..Constitution.Level.Value) print ('Exp for next Constitution Level = '..(exptable[conlevel]))
--Script
function AttackEnter() Stats.Level.Text = "Attack: "..Attack.MinLevel.Value.."/"..Attack.Level.Value Stats.Current.Text = Attack.Xp.Value Stats.Next.Text = exptable[atklevel + 1] Stats.Remainder.Text = tostring(exptable[atklevel + 1] - Attack.Xp.Value) Stats.Visible = true end Attack.MouseEnter:connect(AttackEnter)
function ConstitutionEnter() Stats.Level.Text = "Constitution: "..Constitution.MinLevel.Value.."/"..Constitution.Level.Value Stats.Current.Text = Constitution.Xp.Value Stats.Next.Text = exptable[conlevel + 1] Stats.Remainder.Text = tostring(exptable[conlevel + 1] - Constitution.Xp.Value) Stats.Visible = true end Constitution.MouseEnter:connect(ConstitutionEnter)
function Leave() Stats.Visible = false end Attack.MouseLeave:connect(Leave) Constitution.MouseLeave:connect(Leave) |
|
|
| Report Abuse |
|
|