generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Help on leveling up script

Previous Thread :: Next Thread 
Flash77 is not online. Flash77
Joined: 14 Jun 2008
Total Posts: 550
30 May 2012 02:45 PM
I need help figuring out how to tell the level of a thing from its xp. im trying to make each level as a power of ten, with out having to use a table. such as if the thing has 10 xp, then it would be level 2, if it had 110 xp then it would be level 3. level 4 would be 1110. How would i do this?
Report Abuse
1pie23 is not online. 1pie23
Joined: 11 Jul 2010
Total Posts: 1865
30 May 2012 02:46 PM
^
Report Abuse
1pie23 is not online. 1pie23
Joined: 11 Jul 2010
Total Posts: 1865
30 May 2012 02:47 PM
I'll be more specific. ^ = exponent.
Report Abuse
Flash77 is not online. Flash77
Joined: 14 Jun 2008
Total Posts: 550
30 May 2012 02:47 PM
ya, ive been using that... my current leveling up line doesnt work...
Report Abuse
TheMyrco is not online. TheMyrco
Joined: 13 Aug 2011
Total Posts: 15105
30 May 2012 02:48 PM
Do u mean like in a way to make a calculation for the xp of the next level?

I was thinking about:
local experience = Level/2 * 3

There are multiple ways toug, if this is not desired oen I can think about anotyher one.
If that's not what u meant, please tell me what u mean :P
Report Abuse
1pie23 is not online. 1pie23
Joined: 11 Jul 2010
Total Posts: 1865
30 May 2012 02:48 PM
if xp.Value == 10^10 then
level.Value = 2
end
Report Abuse
1pie23 is not online. 1pie23
Joined: 11 Jul 2010
Total Posts: 1865
30 May 2012 02:50 PM
0.1^10 I meant
Report Abuse
TheMyrco is not online. TheMyrco
Joined: 13 Aug 2011
Total Posts: 15105
30 May 2012 02:50 PM
How about:

local Experience = math.floor(math.sqrt(level) ^ 2)
Report Abuse
TheMyrco is not online. TheMyrco
Joined: 13 Aug 2011
Total Posts: 15105
30 May 2012 02:51 PM
nvm, if u mean to increase each time like that then u could do:

local Experience = level ^ 10
Report Abuse
Flash77 is not online. Flash77
Joined: 14 Jun 2008
Total Posts: 550
30 May 2012 02:52 PM
@ 1pie i wanted more of a solid conversion like themycro did

@themycro any way to convert that to use powers of ten?
Report Abuse
1pie23 is not online. 1pie23
Joined: 11 Jul 2010
Total Posts: 1865
30 May 2012 02:52 PM
Why exactly does it need to be by power of 10? Just curious.
Report Abuse
TheMyrco is not online. TheMyrco
Joined: 13 Aug 2011
Total Posts: 15105
30 May 2012 02:53 PM
@flash: U mean this:
local Experience = math.floor(math.sqrt(level) ^ 2)

To:
local Experience = math.floor(math.sqrt(level) ^ 10)

?
Report Abuse
Flash77 is not online. Flash77
Joined: 14 Jun 2008
Total Posts: 550
30 May 2012 02:53 PM
btw i know the xp, im trying to convert that to the level
Report Abuse
Flash77 is not online. Flash77
Joined: 14 Jun 2008
Total Posts: 550
30 May 2012 02:54 PM
if it helps at all, this was my attempt

level = math.floor((xp-extra)/10^level)
extra = 10^level+extra
Report Abuse
1pie23 is not online. 1pie23
Joined: 11 Jul 2010
Total Posts: 1865
30 May 2012 02:55 PM
To convert it to level just make 2 values, the xp and the xp needed. That's what I use for my RPG's, then I just do:

local leftovers = xp - xpNeeded

xp.Value = xp.Value + leftovers.
Report Abuse
Flash77 is not online. Flash77
Joined: 14 Jun 2008
Total Posts: 550
30 May 2012 02:57 PM
@1pie i wanted it to be powers of 10 because its a simple number to change to another power, and also beacuse i want it harder to go from level 100 to level 101 then level 0 to level 1
Report Abuse
TheMyrco is not online. TheMyrco
Joined: 13 Aug 2011
Total Posts: 15105
30 May 2012 02:58 PM
local XP = math.floor(level ^ 10 + (xp - extra * 1.3))
Report Abuse
1pie23 is not online. 1pie23
Joined: 11 Jul 2010
Total Posts: 1865
30 May 2012 02:58 PM
The full thing is:


lvl = player.Config.Level
xp = player.Config.Experience
xpn = player.Config.ExperienceNeeded

xp.Changed:connect(function()
if xp.Value >= xpn.Value then
local left = xp.Value - xpn.Value
lvl.Value = lvl.Value + 1
xpn.Value = xpn.Value + 2
xp.Value = xp.Value + left
end)
Report Abuse
1pie23 is not online. 1pie23
Joined: 11 Jul 2010
Total Posts: 1865
30 May 2012 03:00 PM
Oh you want to make it harder? This is a simpler version of my level script:

if lvl.Value >= 50 and <100 then
xpn.Value = xpn.Value + 50
elseif lvl.Value >= 100 and <500
xpn.Value = xpn.Value + 100
end


etc. ect.
Report Abuse
1pie23 is not online. 1pie23
Joined: 11 Jul 2010
Total Posts: 1865
30 May 2012 03:00 PM
Forgot a then, you know where it would go though.
Report Abuse
shadownukepie is not online. shadownukepie
Joined: 03 Nov 2011
Total Posts: 390
30 May 2012 03:01 PM
If you use AV1 or AV2 tables use ()O=####/%/%/10() for either
Report Abuse
Flash77 is not online. Flash77
Joined: 14 Jun 2008
Total Posts: 550
30 May 2012 03:01 PM
thanks 1pie, that fixxed it
Report Abuse
1pie23 is not online. 1pie23
Joined: 11 Jul 2010
Total Posts: 1865
30 May 2012 03:02 PM
Np ;)
Report Abuse
Flash77 is not online. Flash77
Joined: 14 Jun 2008
Total Posts: 550
30 May 2012 03:03 PM
i just used this...


if distance >= 10^level then
distance = distance - 10^level
level = level + 1
end
Report Abuse
1pie23 is not online. 1pie23
Joined: 11 Jul 2010
Total Posts: 1865
30 May 2012 03:05 PM
But using powers of 10 would make it near impossible to gain level's at a high level...
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image