Im trying to make a ranking system for my game where when the player reaches a certain lvl then their rank changes. This is part of what i have now:
if(scr.Level<=9)
scr.Rank = "Vagrant"
return
if(scr.Level>=10 & scr.Level<=19)
if(scr.Class = "Warrior"
scr.Rank = "Trainer"
return
if(scr.Class = "Magician"
scr.Rank = "Apprentice"
return
if(scr.Class = "Assist"
scr.Rank = "Protector"
return
if(scr.Class = "Archer"
scr.Rank = "Rogue"
return
The thing is when I compile it all it says
error: scr:missing comma ',' or right-paren ')'
and it always says that on the line where I have the Trainer and Apprentice rank. So i moved the if the class was warrior and magician and put it beneath the archer class. But it still said the same error for the same two lines. Not as in It said the Trainer and Apprentice ranks were wrong but now the Protector and Rogue ranks were wrong.
ID:164317
![]() Jun 27 2007, 3:42 am
|
|
Okay this is my Ranking System so far and my game says I have a missing expression on each line with the required class.(i.e.) if(src.Class = "Warrior)
mob/proc/LvlRankCheck() if(src.Level<=9) src.Rank = "Vagrant" if(src.Level>=10 && src.Level <=19) if(src.Class = "Warrior") src.Rank = "Trainer" return if(src.Class = "Magician") src.Rank = "Apprentice" return if(src.Class = "Assist") src.Rank = "Protector" return if(src.Class = "Archer") src.Rank = "Rogue" return if(src.Level>=20 && src.Level<=29) if(src.Class = "Warrior") src.Rank = "Fighter" return if(src.Class = "Magician") src.Rank = "Mage" return if(src.Class = "Assist") src.Rank = "Guardian" return if(src.Class = "Archer") src.Rank = "Outlaw" return |
mob/proc/LvlRankCheck() Read the DM Guide Please it will come in handy. - Miran |
You're trying to set Rank inside the if statement (=), what you want is to compare it (==). The snippet from Foomer will save you a lot of space, but you'll have to change the first switch statement to use Level instead of Rank.
If you plan on classes having a good bit of difference though, you should think about using different subtypes of /mob for them (instead of a text variable). |
Monkeykid0049 wrote:
Miran's code says theres no errors with it but it doesnt show the person rank in the stat tab. Well did You call the Stat() proc? If you did and it dosent show then you are calling the level up proc on the wrong mob. - Miran |
I've commented two of the obvious errors in your code. I'm also assuming that by 'scr' you means 'src' or, the source of the proc. Another issue is that you're using a big list of if statements and returns instead of a switch like you should be using. This is how it should be written: