ID:268670
 
if(src = /mob/pie)
?
You could just make a var and make it the mobs name like so
var/X
mob
Mob1
X = "Mob1"
Mob2
X = "Mob2"

And use an if like this
if(src.X == "Mob1")
In response to Artekia
Or, you know, use istype().
In response to Repiv
Bah, I like my way better.
In response to Artekia
Artekia wrote:
Bah, I like my way better.
I like "istype", less buggier. :o

[Edit]
Okay, istype doesn't work. I'll just post my problem. =/
        Levelup()
if(src.exp >= src.maxexp)

src.exp = 0
var/hpgain
var/mpgain
var/strgain
var/intgain
var/defgain
var/agigain
var/lckgain
if(src.class == "Soldier")
hpgain = round(src.def*1.3)
strgain = rand(0,3)
intgain = rand(0,1)
defgain = rand(0,3)
agigain = rand(0,1)
lckgain = rand(0,2)

else if(src.class == "Wizard")
hpgain = round(src.def*0.8)
mpgain = round(src.int*1.2)
strgain = rand(0,1)
intgain = rand(0,3)
defgain = rand(0,1)
agigain = rand(0,3)
lckgain = rand(0,2)

else if(src.class == "Thief")
hpgain = round(src.def*0.9)
mpgain = round(src.int*0.9)
strgain = rand(0,1)
intgain = rand(0,3)
defgain = rand(0,1)
agigain = rand(0,3)
lckgain = rand(0,3)


src.lvl += 1
src << ""
src << "You have been promoted to level <B>[src.lvl]</B>!"
src << "Your Hit Points have increased by <font color = #FF0000><B>[hpgain]</B></font>"
src << "Your Magic Points have increased by <font color = #0033FF><B>[mpgain]</B></font>"
if(!agigain)
return
if(agigain)
src << "Your Agility has increased by <font color = #00FFFF><B>[agigain]</B></font>"
if(!strgain)
return
if(strgain)
src << "Your Strength has increased by <font color = #CC0000><B>[strgain]</B></font>"
if(!intgain)
return
if(intgain)
src << "Your Intelligence has increased by <font color = #330099><B>[intgain]</B></font>"
if(!defgain)
return
if(defgain)
src << "Your Vitality has increased by <font color = #0066FF><B>[defgain]</B></font>"
if(!lckgain)
return
if(lckgain)
src << "Your Luck has increased by <font color = #FFFF00><B>[lckgain]</B></font>"
src << ""
src.maxexp += round(src.lvl*1.2)
exp = 0
src.maxhp += hpgain
src.maxmp += mpgain
src.agi += agigain
src.lck += lckgain
src.str += strgain
src.int += intgain
src.def += defgain
src.mp = src.maxmp
src.hp = src.maxhp


When the person levels up... nothing increases. :O
Well, it increases sometimes, but not all the time. :(
In response to Hell Ramen
                if(!agigain)
return
if(agigain)
var/statgain = Agility
if(!strgain)
return
if(strgain)
var/statgain = Strength
src << "Your [statgain] has increased by..."


I may be a newbie coder, but wouldn't this be more efficient?


In response to Kholint
But then it would be the same for all the classes.
x.x
Thanks for trying to help.
In response to Hell Ramen
Use your logic man!

                if(!agigain)
return
if(agigain)
src << "Your Agility has increased by <font color = #00FFFF><B>[agigain]</B></font>"
if(!strgain)
return
if(strgain)
src << "Your Strength has increased by <font color = #CC0000><B>[strgain]</B></font>"
if(!intgain)
return
if(intgain)
src << "Your Intelligence has increased by <font color = #330099><B>[intgain]</B></font>"
if(!defgain)
return
if(defgain)
src << "Your Vitality has increased by <font color = #0066FF><B>[defgain]</B></font>"
if(!lckgain)
return


All those lines with return are going to just stop the whole leveling proc, so stop doing it! Why would you want to stop the whole proc because of that? You do not need those checks for checking if they're null.
In response to Wanabe
:O
Thank you.