ID:147426
 
um i kinda have a problem here i whant to have a overlay icon which appears only when the charecter levels up (like a icon going on the charecter saying level up) what should i add to this
mob/proc/LevelUp() //In this proc, usr called it so now usr is the src.

if(src.client) //Check to see if it is a player...
if(src.Level < 99) //Can't go past level 99!
if(src.Class == "Belmont Blooded")
src.Strength += rand(2,3) * src.Level //Strength will come by greater amounts if the player is a higher level.
src.Defense += rand(1,3) * src.Level
src.AGI += rand(1,2) * src.Level
src.DEX += rand(1,3) * src.Level
src.MAX_HP += rand(4,8) * src.Level
src.MAX_MP += rand(2,3) * src.Level
else
src.Strength += rand(1,2) * src.Level
src.Defense += rand(1,2) * src.Level
src.AGI += rand(1,2) * src.Level
src.DEX += rand(1,2) * src.Level
src.MAX_HP += rand(3,7) * src.Level
src.MAX_MP += rand(4,6) * src.Level
src.HP = src.MAX_HP //Reset their HP stats back to full... In other words, completely heal them.
src.MP = src.MAX_MP
src.Level += 1
src.EXP_To_Next += src.Level * 150
if(src.Level == 99) //This will only be done once right here because a level only comes once.
src << "You have reached level 99! The largest level possible!"
else
src << "You have gained a level!"
src.Save_Character()
thanks Brongle</99>
Best way is to have an "overlay" image set over the character's icon.

Here's a small example:

Put this inside of a proc / verb / whatever:
src.overlays += 'levelup.dmi' // Replace this with the icon for levelup
sleep(30) // Sleep for 3 seconds
src.overlays -= 'levelup.dmi' // Remove the icon


And for future posts, I believe this type of thing wouldgo into Newbie Central (Not sure though, but I think Code Problems is specifically for code problems, not how-tos ^.^)

Anyway, hope this helps.
-- Griswald
In response to Griswald
this sounds quite noobish well i am new to coding where exactly should i put it ?
P.S Thanks for your time



-Brongle-
In response to Brongle
Can someone tell me what the word level means in RPG therms?

Aint that a indication of the player his overall strenght from 0 to 100? (not 99 :P)
In response to Fint
:O i don't think that helped my problem :O
In response to Brongle
It may be easier for you to understand if I just give an example:

mob/proc/Level_Check()
if(src.exp>=src.exp_needed)
src.exp=0
src.exp_needed=round(src.exp_needed*1.3)
src.level+=1
src.overlays+='level.dmi'
spawn(5) if(src) src.overlays-='level.dmi'
In response to Fint
The term "level" can be defined as a multitude of things, but I personally define it as the character "growing up" so to speak, since it's done to show the characters progression in a game.
In response to Xallius
Xallius wrote:
It may be easier for you to understand if I just give an example:

mob/proc/Level_Check()
> if(src.exp>=src.exp_needed)
> src.exp=0
> src.exp_needed=round(src.exp_needed*1.3)
> src.level+=1
> src.overlays+='level.dmi'
> spawn(5) if(src) src.overlays-='level.dmi'


src.level+=1 == wrong


You should be using:

src.level++
In response to SSJ4_Gohan_Majin
> src.level+=1 == wrong
>


Uhh I don't see anything wrong with that.

You should be using:

> src.level++
>


Actually generally you would want to use preincrement ++src.level even though in this case it doesn't make much difference(if any) it's good to get into the habit of using it since in most complex statments you want the preincrement operator not the post. Though understanding the difference between the two and selecting the one appropriate for the algorithm is always best.
In response to Theodis
where abouts in the coding shall i put it though thanks
Brongle
In response to Brongle
Where should you put the Level_Check() procedure? Anywhere you want to...
In response to Brongle
Anywhere after your class if-else-check, but before the check to see what type of levelup message the player gets is a good place to start ;P
In response to SSJ4_Gohan_Majin
SSJ4_Gohan_Majin wrote:
"src.level+=1 == <FONT COLOR=red>wrong</FONT>"

Please consider what you are saying before you post...

mob/proc/Level_Check()
if(src.exp>=src.exp_needed)
src.exp=0
src.exp_needed=round(src.exp_needed*1.3)
src.level+=1
src.overlays+='level.dmi'
spawn(5) if(src) src.overlays-='level.dmi'

If that is wrong, than the procedure would not work, or it would not work as well, yet for that application it works in the exact same way as the post-increment operator.

if A+=1 = (A=A+1) and A++ = (A+1=A), then by the symetric property of equality, they are the same.