Ergh I'm very confused. Could you spare me a little time to sort out my code?
I've been toying with it and I've got the level up system to work. However, now the enemies simply won't die.
Can you see if you can change this code so that it will work? Otherwise I have a backup of my code from last night (although I think I've worked on it a lot since)
> mob
>
> var
> HP = 30 //define a new variable called HP, with a value of 30
> MaxHP=30
> Level=1
> EXP=0
> EXPNeeded=15
> Strength=2
> GP=10
>
> Del()
> var/obj/gold/G = new(loc) //create a new obj from the gold blueprint
> G.amount = rand(1,100) //set its amount variable randomly
> ..() //call the parent
>
> Login()
> switch(input("Which race would you like to be?") in list ("Human","Elf","Vampire","Lycan","Demon","Angel"))
> if("Human")
> src.icon = 'human.dmi'
> if("Elf")
> src.icon = 'elf.dmi'
> if("Vampire")
> src.icon = 'vampire.dmi'
> if("Lycan")
> src.icon = 'lycan.dmi'
> if("Demon")
> src.icon = 'demon.dmi'
> if("Angel")
> src.icon = 'angel.dmi'
>
> ..() //the gender of their key. Then call the parent!
> world << "[usr] has entered!"
>
> proc/GainEXP(n) // gain n experience points //start
> EXP=(EXP+n)
> if(EXP>=EXPNeeded) LevelUp()
>
> proc/LevelUp(mob/M)
> src.Level++
> src << "You levelled up! (Level [Level])."
> src.MaxHP=26+4*src.Level // 26+(4*1) = 30, the original value
> src.HP=src.MaxHP
> src.Strength = src.Level*2
> src.EXPNeeded=(30+Level)*src.Level //end
>
> proc
> DeathCheck(mob/Victim,mob/M) //checks to see if an attack is deadly
> if (Victim.HP <= 0) //if the defender's HP is low enough...
> world << "[M] killed [Victim]!" //do the death messaging
> del(Victim) //delete whatever just died
>
> verb
> say(msg as text) //what the usr says is passed into "msg" as text
> world << "[usr]: [msg]" //the world sees chatroom-like output
> EXPboost(mob/M)
> usr.GainEXP(20)
> attack(mob/M as mob in oview(1)) //attack a mob within 1 tile of you
> usr << "You attack [M]!" //send this message to the usr
> oview() << "[usr] attacks [M]!" //send this message to everybody else
> var/damage = rand(1,10)+Strength //assign a random # to a new variable and add strength
> world << "[damage] damage!" //tell the damage to the world
> M.HP -= damage //take away the damage from M
> M.DeathCheck(M,src) //check for death with a proc
> status(mob/M) //stats
> usr << "-----------------------------------------"
> usr << "LEVEL [Level]"
> usr << "Max HP = [MaxHP]"
> usr << "Strength = [Strength]"
> usr << "EXP = [EXP]"
> usr << "[EXPNeeded] EXP to level [Level+1]"
> usr << "[GP] gold."
> usr << "-----------------------------------------"
>
>
>
> wolf //new prototype
> icon = 'wolf.dmi' //override the parent's icon, which was 'person.dmi'
> EXP = 10
>
> obj
> gold //define a "gold" prototype, which is a kind of obj
> icon = 'gold.dmi' //set the default icon
> var
> amount //declare a new variable called "amount"
> verb
> get() //obj/gold/verb/get()
> set src in view(1) //src must be close
> usr << "You pick up [amount] gold."
> usr.GP += amount //add to usr.GP
> del(src) //delete the gold
>
I'd appreciate your help, Lummox JR
Try that... When attack verb was running through you had M.DeathCheck(src) when it should be M.DeathCheck(M,src)simple mistake really quite easy to do.
I've been toying with it and I've got the level up system to work. However, now the enemies simply won't die.
Can you see if you can change this code so that it will work? Otherwise I have a backup of my code from last night (although I think I've worked on it a lot since)
I'd appreciate your help, Lummox JR