ID:166175
 
I've just started creating my first RPG (and my first game, for that matter), and I've been working on the level up system. However, I cannot quite seem to get it to work. This is my stats, GainEXP and LevelUP procs:


-----------------------------------------------------------
mob
icon = 'player.dmi'
var
HP = 30 //define a new variable called HP, with a value of 30
MaxHP=30
Level = 1
EXP = 0
EXPNeeded = 15
Strength = 2
wealth = 10
proc/GainExp(n) // gain n experience points
EXP+=n
if(EXP>=EXPNeeded) LevelUp()
proc/LevelUp()
++Level
src << "You levelled up! (Level [Level])."
MaxHP=26+4*Level // 26+(4*1) = 30, the original value
HP=MaxHP
Strength = Level*2
EXPNeeded=15*Level
-----------------------------------------------------------



And this is my DeathCheck proc:

---------------------------------------------------------
proc
DeathCheck() //checks to see if an attack is deadly
if (HP <= 0) //if the defender's HP is low enough...
world << "[usr] killed [src]!" //do the death messaging
del(src) //delete whatever just died
----------------------------------------------------------


I believe I am supposed to have a GainEXP line at the end of my DeathCheck, but I'm not sure what the exact code is. Any advice?
Mainly, the DeathCheck proc doesn't have any way to tell who the killer is. To do that you have to send the attacker as an arg to the DeathCheck proc. Plus that also solves the problem of who to award the XP to.
mob
icon = 'player.dmi'
var
HP = 30
MaxHP=30
Level = 1
EXP = 0
EXPNeeded = 15
Strength = 2
wealth = 10
proc/GainExp(n)
src.EXP+=n
if(src.EXP>=src.EXPNeeded) LevelUp(src)
proc/LevelUp(mob/M)
M.Level++
M << "You levelled up! (Level [M.Level])."
M.MaxHP=26+4*M.Level
M.HP=M.MaxHP
M.Strength = M.Level*2
M.EXPNeeded=15*M.Level

proc
DeathCheck(mob/Victim,mob/Attacker)
if (Victim.HP <= 0)
world << "[Attacker] killed [Victim]!"//This is really annoying, you shouldn't really have this here.
del(Victim)
Attacker.GainExp(10)//Put the number here, probably something like "Victim.expgive."

From a few things I've looked at this will probably work.
In response to Abel Night
Well, I tried editing the code as you've shown me, and the program runs. However, when I attack the enemy, I get the following error:

runtime error: Cannot read null.HP
proc name: DeathCheck (/mob/proc/DeathCheck)
usr: RoadToDawn (/mob)
src: the wolf (/mob/wolf)
call stack:
the wolf (/mob/wolf): DeathCheck(null, null)
RoadToDawn (/mob): attack(the wolf (/mob/wolf))

How do I fix this? The enemy will not die so I don't know if the EXP will work yet either.

My entire code: (Except for turf settings)


mob
icon = 'player.dmi'
var
HP = 30 //define a new variable called HP, with a value of 30
MaxHP=30
Level=1
EXP=0
EXPNeeded=15
Strength=2
wealth=10
proc/GainEXP(n) // gain n experience points //start
EXP+=n
if(EXP>=EXPNeeded) LevelUp()
proc/LevelUp(mob/M)
M.Level++
M << "You levelled up! (Level [Level])."
M.MaxHP=26+4*M.Level // 26+(4*1) = 30, the original value
M.HP=M.MaxHP
M.Strength = M.Level*2
M.EXPNeeded=15*M.Level //end

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
DeathCheck(mob/Victim,mob/Attacker) //checks to see if an attack is deadly
if (Victim.HP <= 0) //if the defender's HP is low enough...
world << "[usr] killed [src]!" //do the death messaging
del(Victim) //delete whatever just died
Attacker.GainEXP(10)

verb
say(msg as text) //what the usr says is passed into "msg" as text
world << "[usr]: [msg]" //the world sees chatroom-like output
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() //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 << "[wealth] gold."
usr << "-----------------------------------------"


wolf //new prototype
icon = 'wolf.dmi' //override the parent's icon, which was 'person.dmi'

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.wealth += amount //add to usr.wealth
del(src) //delete the gold
In response to RoadToDawn
Your DeathCheck() is screwed.

proc
DeathCheck(mob/Attacker) //You already have src, no need for the victim variable //checks to see if an attack is deadly
if (HP <= 0) //if the defender's HP is low enough...
world << "[usr] killed [src]!" //do the death messaging
Attacker.GainEXP(10)
del(Victim) //delete whatever just died


You also need to add arguments to your DeathCheck() call.

M.DeathCheck(src)
In response to Jp
    proc
DeathCheck(mob/Victim) //checks to see if an attack is deadly
if (HP <= 0) //if the defender's HP is low enough...
world << "[usr] killed [src]!" //do the death messaging
Attacker.GainEXP(10)
del(Victim) //delete whatever just died


I just changed my DeathCheck proc to look like you've said, and now I'm recieving this error:

fantasy.dm:50:error:Attacker.GainEXP:undefined var


It looks like this is because the term 'Attacker' hasn't been used anywhere else?

About other line you posted, where exactly does that go? I'm totally new to Byond so I'm pretty clueless.
In response to RoadToDawn
Not quite, matey. Look closely at what I posted. See how I took out mob/Victim, not mob/Attacker? Change mob/Victim to mob/Attacker.

As for the 'other piece of code', look through your code to see where you call DeathCheck(). Notice that you've got a variable declared for the DeathCheck() proc, but you don't pass one to it in the call? That's what I'm talking about. You need to throw a variable representing the attacker in there.
In response to Jp
mob
icon = 'player.dmi'
var
HP = 30 //define a new variable called HP, with a value of 30
MaxHP=30
Level=1
EXP=0
EXPNeeded=15
Strength=2
wealth=10
proc/GainEXP(n) // gain n experience points //start
EXP+=n
if(EXP>=EXPNeeded) LevelUp()
proc/LevelUp(mob/M)
M.Level++
M << "You levelled up! (Level [Level])."
M.MaxHP=26+4*M.Level // 26+(4*1) = 30, the original value
M.HP=M.MaxHP
M.Strength = M.Level*2
M.EXPNeeded=15*M.Level //end

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
DeathCheck(mob/Attacker) //checks to see if an attack is deadly
if (HP <= 0) //if the defender's HP is low enough...
world << "[usr] killed [src]!" //do the death messaging
Attacker.GainEXP(10)
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
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(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 << "[wealth] gold."
usr << "-----------------------------------------"


wolf //new prototype
icon = 'wolf.dmi' //override the parent's icon, which was 'person.dmi'

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.wealth += amount //add to usr.wealth
del(src) //delete the gold


I have updated it like this. However, I get the error:

fantasy.dm:51:error:Victim:undefined var


I assume this is because Victim is now an undefined term, and as Victim hasn't been used anywhere else I don't think it is the right term. If I replace Victim with src (So del(src)) the program runs fine, I can kill enemies, but I still don't gain any EXP (as far as my stats tell me)

Thanks
In response to RoadToDawn
It should be del(src). You should also switch 'usr' for 'Attacker' in the DeathCheck() proc - usr is unsafe in procs.

Are you sure you don't get EXP? I can't see why you wouldn't...
In response to Jp
Well, I've changed it as you have said. When I kill my second wolf (therefore netting enough EXP to level up) I recieve the following error:

runtime error: Cannot read null.Level
proc name: LevelUp (/mob/proc/LevelUp)
usr: RoadToDawn (/mob)
src: RoadToDawn (/mob)
call stack:
RoadToDawn (/mob): LevelUp(null)
RoadToDawn (/mob): GainEXP(10)
the wolf (/mob/wolf): DeathCheck(RoadToDawn (/mob))
RoadToDawn (/mob): attack(the wolf (/mob/wolf))


Can you make any sense of this?
In response to RoadToDawn
proc
DeathCheck(mob/Victim,mob/A) //checks to see if an attack is deadly
if (Victim.HP <= 0) //if the defender's HP is low enough...
world << "[A] killed [Victim]!" //do the death messaging
A.GainEXP()
del(Victim)

mob/proc/GainEXP() // gain n experience points //start
EXP+=rand(1,10)
if(EXP>=EXPNeeded) LevelUp()
mob/proc/LevelUp(mob/M)
M.Level++
M << "You levelled up! (Level [Level])."
M.MaxHP=26+4*M.Level // 26+(4*1) = 30, the original value
M.HP=M.MaxHP
M.Strength = M.Level*2
M.EXPNeeded=15*M.Level


Your GainEXP() proc etc were meant to be mob/proc not just proc/
In response to Rickoshay
I have altered it like you said. My code now looks like this:

mob
icon = 'player.dmi'
var
HP = 30 //define a new variable called HP, with a value of 30
MaxHP=30
Level=1
EXP=0
EXPNeeded=15
Strength=2
wealth=10
mob/proc/GainEXP() // gain n experience points //start
EXP+=rand(1,10)
if(EXP>=EXPNeeded) LevelUp()
mob/proc/LevelUp(mob/M)
M.Level++
M << "You levelled up! (Level [Level])."
M.MaxHP=26+4*M.Level // 26+(4*1) = 30, the original value
M.HP=M.MaxHP
M.Strength = M.Level*2
M.EXPNeeded=15*M.Level //end

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
DeathCheck(mob/Victim,mob/A) //checks to see if an attack is deadly
if (Victim.HP <= 0) //if the defender's HP is low enough...
world << "[A] killed [Victim]!" //do the death messaging
A.GainEXP(10)
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
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(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 << "[wealth] gold."
usr << "-----------------------------------------"


wolf //new prototype
icon = 'wolf.dmi' //override the parent's icon, which was 'person.dmi'

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.wealth += amount //add to usr.wealth
del(src) //delete the gold



Now, when I try and Run, I reieve this error:

fantasy.dm:50:error:A.GainEXP:undefined proc


Do you know why?
In response to RoadToDawn
proc
DeathCheck(mob/Victim,mob/A) //checks to see if an attack is deadly
if (Victim.HP <= 0) //if the defender's HP is low enough...
world << "[A] killed [Victim]!" //do the death messaging
A.GainEXP()//There was no need for 10 here
del(Victim)
In response to Rickoshay
I have removed the 10, and still, the same error-

fantasy.dm:50:error:A.GainEXP:undefined proc


If the 10 isn't supposed to be there, how do I define how much EXP is supposed to be recieved when an enemy is defeated?
In response to RoadToDawn
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
M.GainEXP()//There was no need for 10 here
del(Victim)
In response to Rickoshay

fantasy.dm:50:error:M.GainEXP:undefined proc

Same error.

My entire code once more:

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
mob/proc/GainEXP() // gain n experience points //start
EXP+=rand(1,10)
if(EXP>=EXPNeeded) LevelUp()
mob/proc/LevelUp(mob/M)
M.Level++
M << "You levelled up! (Level [Level])."
M.MaxHP=26+4*M.Level // 26+(4*1) = 30, the original value
M.HP=M.MaxHP
M.Strength = M.Level*2
M.EXPNeeded=15*M.Level //end

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
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
M.GainEXP()
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
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(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 think the problem is that the code doesn't know what to do when it gets to GainEXP. What's going on? I don't think the Deathcheck is the problem, I think I am missing code elsewhere... or something.

Thanks again
In response to RoadToDawn
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
mob/proc/LevelUp(mob/M)
M.Level++
M << "You levelled up! (Level [Level])."
M.MaxHP=26+4*M.Level // 26+(4*1) = 30, the original value
M.HP=M.MaxHP
M.Strength = M.Level*2
M.EXPNeeded=15*M.Level //end

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() // gain n experience points //start
EXP+=rand(1,10)
if(EXP>=EXPNeeded) LevelUp()
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
M.GainEXP()
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
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(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
In response to Rickoshay
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() // gain n experience points //start
EXP+=rand(1,10)
if(EXP>=EXPNeeded) LevelUp()

proc/LevelUp(mob/M)
M.Level++
M << "You levelled up! (Level [Level])."
M.MaxHP=26+4*M.Level // 26+(4*1) = 30, the original value
M.HP=M.MaxHP
M.Strength = M.Level*2
M.EXPNeeded=15*M.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
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(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
<dm>

I see what you've done there, moving the proc so that the code can see it. When I tried it that way, I got a different error:

fantasy.dm:38:error:LevelUp:undefined proc

but this was the same idea, so I moved the LevelUp proc in the same way. That code is how my coding appears now.

However, I do not know if my EXP is now working, as I now have a different problem!

My game runs with no errors, but now the 'wolf' enemies will not die. When attack is pressed, it will say 'You attack the wolf! (12 or whatever) damage!'

However, this will go on indefinitely, and the wolf will no longer die, which was working beforehand.

Do you know whats wrong?

Ps if you update the code could write a few words to tell me what you've changed? I don't want to miss any little details.

Thanks
In response to Abel Night
Good gads no. If you don't know what you're doing, please don't offer to help people.

Two major and very very obvious things you did wrong: You added the mob/M argument to the LevelUp() proc which needs no argument at all, thereby massively complicating the proc, and you added two arguments to DeathCheck() which only needs one--the killer.

A LevelUp() proc only needs one piece of information: src, the mob leveling up. That's it.

A DeathCheck() proc normally needs two pieces of information: src, which must always always always be the vctim, and an argument for the killer. Some very simple death checks don't need to know the killer, so it can be left out of those; some complex ones want to know about the weapon used and other info.

Lummox JR
In response to RoadToDawn
To an extent you need to trash the code you were given in this thread and go back to what you had before. Only Jp and Top player have steered you right. I'm sad to say Rickoshay has yet to offer good code advice (though one hopes he'll eventually be able to), and Abel Night's advice was horrendously flawed.

Go back to your original LevelUp(), which was correct. Then go back to your original DeathCheck() proc, add a var for the killer, use that to replace usr in the proc, and then call the proc accordingly.

Lummox JR
Page: 1 2