SphereCommunity
level system problem - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: level system problem (/Thread-level-system-problem)



level system problem - dabritmusic - 03-08-2014 10:21 AM

hi how ever time a player levels it keeps their exp saved so they can level again really quick. i want to set their exp back to 0 at every level up.
i tried TAG.LEVEL=0 but it doesnt seem to work. any suggestions?


TAG.LEVEL=<EVAL <TAG.LEVEL>> +1
SERV.ALLCLIENTS @07a1 SYSMESSAGE=<NAME> has gained a level!
SERV.ALLCLIENTS @07a1 SYSMESSAGE=<NAME> is at level <EVAL <TAG.LEVEL>>


RE: level system problem - pinku - 03-08-2014 11:24 AM

I suppose the TAG.LEVEL isn't the TAG for the EXP... Tongue

Do you have a TAG.EXP or something like that?


RE: level system problem - dabritmusic - 03-08-2014 11:48 AM

(03-08-2014 11:24 AM)pinku Wrote:  I suppose the TAG.LEVEL isn't the TAG for the EXP... Tongue

Do you have a TAG.EXP or something like that?

lol yea no that the level tag. that works fine. it adds the +1 level to their current one. but when they level it stored their exp which is tag.exp. say it takes 1500 exp to get to level 1 and 2000 for level 2, really they are only adding 500 to gain the next level. i want to make it so they have to gain all exp again. otherwise players level too fast and i have a cap at 100. i might consider adding tiers or something lateron.


RE: level system problem - Coruja - 03-08-2014 01:59 PM

EXP is directly linked to LEVEL, if you change EXP, the LEVEL will change too (based on the value you set on EXP)
so you need to use a function that doesnt change the EXP, but just calculate the min/max value for each level

probably it will take a long time and knowledge to make this, so here's a function I already made some months ago
Code:
[FUNCTION GetExpValue]
FOR 0 <LEVEL>
LOCAL.Amount += <eval <LOCAL._FOR>*<SERV.LevelNextAt>>
ENDFOR
ARGS=<LOCAL.Amount>,<eval <LOCAL.Amount>+((<LEVEL>+1)*<SERV.LevelNextAt>)>
return <eval <EXP>-<ARGV0>>,<eval <ARGV1>-<ARGV0>>

[FUNCTION MessageExample]
ARGS=<GetExpValue>
SYSMESSAGE You're on level <LEVEL> (EXP <ARGV0>/<ARGV1>)
this will return the min,max EXP value for the current level like this:
-Level 0: 0 ~ 2000 exp
-Level 1: 0 ~ 4000 exp
-Level 2: 0 ~ 6000 exp
-Level 3: 0 ~ 8000 exp

note that it wont change the char EXP value, but just visually show the same value using a more friendly number