ID:139194
 
Code:
mob/proc    
LevelCheck()
if(src.Exp>=src.Nexp)
src<<"<I><B><small>You gained a level!"
src.Level+=1
src.MaxHP+=rand(1,5)
src.MaxMP+=rand(1,5)
src.HP=src.MaxHP
src.MP=src.MaxMP
src.Exp=src.Exp-src.Nexp
src.Nexp=src.Level*10
for(var/obj/Skills/O in SkillList)
if(O.LearnedBy==src.Class)
if(O.Learned==1)
return
else if(src.Level>=O.LearnedOn)
src.contents+=new O.type
O.Learned++
src<<"<I><B><small>You learned [O]!"

Problem description:You Repeaditly learn the skill upon Relogging and killing a mob.

Your code is saying, if you've learned the skill ie: "O.Learned==1", then return, so you can't gain it anymore.
Then once you learn the skill it says, Add +1 to O.Learned. Which means every time you learn the skill it pluses one more. Hence it keeps adding to Learned. So it can go to any number above 1, and keep adding to it. Try changing it to: "O.Learned = 1"
In response to Gizhy
Gizhy wrote:
Your code is saying, if you've learned the skill ie: "O.Learned==1", then return, so you can't gain it anymore.
Then once you learn the skill it says, Add +1 to O.Learned. Which means every time you learn the skill it pluses one more. Hence it keeps adding to Learned. So it can go to any number above 1, and keep adding to it. Try changing it to: "O.Learned = 1"

change O.Learned++ to O.Learned = 1?
In response to XxLucifersJesterxX
Yes. Thats probably the reason why it kept giving you the skill over and over.
In response to Gizhy
Gizhy wrote:
Yes. Thats probably the reason why it kept giving you the skill over and over.

It Was Thank you. do you have time to help me with one more thing? its jsut little. im not getting the result i wished for.
In response to XxLucifersJesterxX
Sure, lay it on me.
In response to Gizhy
Gizhy wrote:
Sure, lay it on me.

Okay so my Str, Defense And a few other stats level via getting hit/Punching to make it more realistic. i however want the % you are to the next level to show up in ()s next to your current level. but the percentage doesnt come out right, i also wanted it to show you the Percentage of Health you have left, same with Mana, Etc. Any ideas?
In response to XxLucifersJesterxX
Well in order to get the percent of 2 variable ie: Health, and Max Health. You'd have to use some mathematics. The formula to create said percent would be: <code>x ÷ y * 100</code>, then round that off by 10. That's how you'd get what you want.

By using that you should be able to get the answers you're looking for. I made this a challenge so you could learn something from me helping you. Instead of me just telling you, or writing out the code for you to copy and paste.

Your Welcome ^^
In response to Gizhy
Gizhy wrote:
Well in order to get the percent of 2 variable ie: Health, and Max Health. You'd have to use some mathematics. The formula to create said percent would be: <code>x ÷ y * 100</code>, then round that off by 10. That's how you'd get what you want.

By using that you should be able to get the answers you're looking for. I made this a challenge so you could learn something from me helping you. Instead of me just telling you, or writing out the code for you to copy and paste.

Your Welcome ^^

soo?

stat("MP:","[src.MP]/[src.MaxMP] ((src.MP/src.MP)*100)")
In response to XxLucifersJesterxX
No it would look like this:

round(hp/mhp*100,10) // Use the formula I gave you..


The formula I gave you, makes the percent go by 10's.
In response to Gizhy
Alright, thanks, hopefully it works.
In response to XxLucifersJesterxX
No problem. ^_^
In response to Gizhy
Gizhy wrote:
No problem. ^_^

Okay, Im still relearning the skills for some reason. is their anyway to save the "O.Learned" Without manually Listing them?
In response to XxLucifersJesterxX
Only with a saving & loading system.
In response to Gizhy
Gizhy wrote:
Only with a saving & loading system.


I already have a saving&Loading system. Ive basicly got Quest, Combat, Skills, Areas, Icons, Death, Save, Load, Verbs, Toggleable Stat Panels, Etc. But i cant find out how to fix this bug. Any help?
In response to XxLucifersJesterxX
You're checking to see whether the obj's Learned variable is true, which it wouldn't be if it hasn't yet been learned. Try checking to see if the obj is in src.contents instead: if (O in src.contents) return
In response to Slipknight
Slipknight wrote:
You're checking to see whether the obj's Learned variable is true, which it wouldn't be if it hasn't yet been learned. Try checking to see if the obj is in src.contents instead: if (O in src.contents) return

already tried. didnt work.