ID:270175
 
I was wander how i would make this enemy drop gold and a item randomly and alos a corpes. thx in advance
    Enemy3
YellowSlime
hp = 17
str = 4
def = 3
experience = 2
maxexp = 10
density = 1
NPC = 1
icon = 'Slimes.dmi'
icon_state = "Yellow Slime"
New()
..()
proc/MAttack(mob/M)
if(istype(M,/mob/Character))
var/D = usr.str - (M.def + 1)
var/C = rand(1,D)
if(D >= 1)
M.hp -= C
M << "<b>[usr.name] hits you for [D] points of damage!"
oview() << "<b>[usr.name] hits [M] for [D] points of damage!"
else
return
else
return
Click()
if(usr.pet == 1)//if you have a pet
if(usr.target == src)//and this monster is already your target
usr.target = ""//make your target blank
usr << "[src] is no longer your target."//get rid of that target
else//or if you don't have a target
usr.target = src//make it your target
usr << "[src] is now your target!"
No put usr in proc. Ungh.

Lummox JR
In response to Lummox JR
iam not too sure what you r saying ?? instead of

            proc/MAttack(mob/M)
if(istype(M,/mob/Character))
var/D = usr.str - (M.def + 1)
var/C = rand(1,D)
if(D >= 1)
M.hp -= C
M << "<b>[usr.name] hits you for [D] points of damage!"
oview() << "<b>[usr.name] hits [M] for [D] points of damage!"
else
return
else
return

put this
            proc/MAttack(usr/M)
if(istype(M,/usr/Character))
var/D = usr.str - (M.def + 1)
var/C = rand(1,D)
if(D >= 1)
M.hp -= C
M << "<b>[usr.name] hits you for [D] points of damage!"
oview() << "<b>[usr.name] hits [M] for [D] points of damage!"
else
return
else
return

that has errors in it >.>
and alos how would i make the mob drop an item ex:a sword ever 10 kills and 4 gold ever kill but a coarps ever kill?
In response to Zog 200
No you replaced mob with usr, you should be replacing usr with src.
In response to Jester619
ok i see that but how do i get it to drop stuff >.< when it dies
You would make a procedure for checking when it dies, then make a new object under it.


You probally want to look up new and you should be able to figure it out. Basically just do what I said above, make a procedure to check it's health after being attacked, if it's dead, use new to make a new corspe, use rand() to pick an amount of gold and set that number to a new gold atom and then use pick() to pick which type of item it drops.


-Doh