ID:139755
 
Code:
mob/Monster/Goblin
icon = 'monster.dmi'
icon_state = ""
HP = 25
Strength = 7
expplus = 7
var/mob/player/P
New()
. = ..()
spawn()
Wander()
proc/Wander()
while(src)
var/Found = FALSE
for(P in oview(5,src))
step_towards(src,P)
Found = TRUE
break
if(Found != TRUE)
step_rand(src)
sleep(10)
sleep(5)
Bump(mob/M)
if(istype(M,/mob/player))
Attack(M)
proc/Attack(mob/M)
flick("attack",src)
sleep(2)
var/damage = rand(1,Strength)
M.HP -= damage
view(src) << "[src] attacks [M]!"
view(src) << "[damage] damage!"
M.Death()


Problem description:My problem is when I kill the mob is doesn't give any EXP at all any suggestions?

You're missing basically the only part necessary to show us, and that is the Death() proc being called on the Goblin mob.
In response to OrangeWeapons
I don't think I made a death proc...how would I go about making one for it?

EDIT: Actually I did I'm a little tired and slow ._. I found the problem out myself but thanks I just needed to add the var in the Death Pro xDDDDD I'm a newb
In response to Tajiri
I gain EXP now but the thing is I don't gain the exp after the goblin is dead I gain the exp anytime I attack the monster..thats not what I want... I need to die then gain the exp this is what I did.... As you can see I added the 'expplus' var to the Death proc so the EXP= to the type of mob I kill

mob
proc
Death(mob/M
usr.Exp += expplus
Check()
if(usr.Exp>=usr.ExpNeed)
usr.LevelUp()
if(src.type == /mob/player
PlayerDie()
else
if(src.HP <= 0)
range() << "[src] has been killed by [usr]!!"
del(src)
PlayerDie(mob/M)
if(src.HP <= 0)
view() << "[src] died!"
src.loc = locate(5,5,1)
src.HP = MaxHP
src.SP = MaxSP<dm>
In response to Tajiri
Move the exp calc and add.

not to mention your way of coding it is weird at best. why are you giving goblins there very own attack verb AND your using usr in procs. never ever do that.

mob/verb/attack()
for(mob/m in oview(1))
m.health-damage //define that yourself
m.dc(src)


mob/proc/dc(mob/attacker)
if(/*check player*/)
//do player
else
attacker.exp+=explus
del(src)
In response to Midgetbuster
Nope didn't work..Didn't really understand...If I can't use usr. In procs where do I put the expplus?
In response to Tajiri
Since I can't mix usr. and procs I fixed all of that now I can't gain EXP at all from my mobs... T~T is is fustrating.
In response to Tajiri
This is how you can go about doing it. Define a variable to reference your mob:

obj/Rocket
proc/Ride(mob/M)
icon_state = "blast_off"
M.Ride()

mob/proc/Ride()
src << "FWOOSH!"
/*
Of course in this situation you CAN use USR
to send a message under an obj's proc
but this is just an example to show how you would run
a mob's proc.
*/
In response to Tajiri
Ok first up you dont want your goblin to be able to level. well technically he wont but anyways thats not the point.

ill try break it down for you.
and btw i think your goblin thing is right im a bit tired so i cant be certain.
but yeah ill do something up for you below.
mob/Monster/Goblin
icon = 'monster.dmi'
icon_state = ""
HP = 25
Strength = 7
expplus = 7
var/mob/player/P
New()
. = ..()
spawn()
Wander()
proc/Wander()
while(src)
var/Found = FALSE
for(P in oview(5,src))
step_towards(src,P)
Found = TRUE
break
if(Found != TRUE)
step_rand(src)
sleep(10)
sleep(5)
Bump(mob/M)
if(istype(M,/mob/player))
Attack(M)
proc/Attack(mob/M)
flick("attack",src)
sleep(2)
var/damage = rand(1,Strength)
M.HP -= damage
view(src) << "[src] attacks [M]!"
view(src) << "[damage] damage!"
M.Death(src) //edit here added src (being goblin) to a proc argument this is so it carries over to the below proc.

mob/proc/Death(mob/attacker)
if(istype(src,mob/player))

Levelup()
if(src.stam <= 0)die()
else //not a human
src.exp += attacker.expgain //src being the mob who got hit and attacker being the goblin.
del(src)
In response to Tajiri
First off:
Death(mob/M


Should be:
Death(mob/M)
Are you using that horrible RPG kit by Dark_Prince101? I love it. But you really shouldn't.
In response to Toadfish
Thanks guys I'm still training but no dice.
In response to Tajiri
Tajiri wrote:
Thanks guys I'm still training but no dice.

Here is an example of how I would do it:

Monsters
mob/monster
var
hp
mhp
gexp
gold
proc
death_chk(var/mob/player/killer)
if(src.hp >= 0)//make sure hp is less than 0.
killer.exp+=src.gexp //give exp
killer.level_chk() //check the level of the one that got exp.
drop() //create drops
del src // kill the monster.
drop()
var/gold/G = new(src.loc)//create a new pile of gold at the monster location
G.amount = src.gold //set the amount of gold.
goblin //create the goblin.
hp = 10
mhp = 10
gexp = 7
gold = 10


Then the player:
mob/player
var
exp = 0
mexp = 100
proc
level_chk()
if(exp>=mexp)
src << "levelup here"
exp = 0
verb/attack()
var/mob/monster/target
for(var/mob/monster/M in get_step(src,src.dir))
target = M
break
if(target) // make sure we got something
target.hp-=rand(1,4) //take damage
target.death_chk(src)
In response to Pirion
Pirion, would you mind explaining why you put if(src.hp >= 0) instead of if(src.hp <= 0)
gaining exp is so easily done. And you should be able to do it if you coded in that much