mob
proc
Levelup()
if(usr.exp>=src.maxexp)
usr.level++
usr.exp=0
usr.maxexp*=2
usr<<"You gained a level!"
usr.Statup()
else
..()//defaults if the if() doesn't return it's arguments
mob
proc
Statup()
usr.maxhealth+=20//adds to your health
usr.STR += 2
usr.DEF += 1
usr.health=src.maxhealth
usr<<"Your stats increase!"
mob
proc
Die()
if(src.dead)
return 0
src.dead = 1
Respawn()
Respawn()
src.loc = locate(1,1,1)
src.dead = 0
mob
var
monster = 0
wizard
icon = 'wizards.dmi'
icon_state = "1"
STR = 100
DEF = 75
monster = 1
health = 100
New()
. = ..()
spawn(1)
//Spawn(1)ing out means that this will happen one tick after the spawn() is activated (with the rest of the New() proc continuing like normal).
//It's like sleep(), but waits and does the indented stuff when the time is up, without stopping the rest of the proc.
Look() //This means that by the time the following indented stuff is activated New() will have finished, and the monster will be on the map.
src.rLocX = src.x
src.rLocY = src.y
src.rLocZ = src.z
//Now we've got a copy of the current x, y and z co-ordinates stored on the monster, so it knows where to respawn.
Die()
if(src.dead)
//If they're already dead we don't want this happening again (otherwise it could lead to several monsters respawning everytime a monster is killed, which would flood the world).
//We'll return which will stop the proc without doing the rest.
return
Levelup()
src.dead = 1 //Set their dead flag so that from now on everything knows it's dead.
src.loc = null //This will make them dissapear from the map by setting their location to nothing.
usr.exp += 100
usr.master1 = 1
usr.gold += 5000//Do normal stuff like adding exp to the person who killed it.
Respawn()
del(src) //Now we're done with the monster we can delete it.
Respawn()
//By the time we respawn src will be deleted, so we need to store the type and respawn co-ordinates elsewhere.
var/newMonsterType = src.type
var/X = src.rLocX
var/Y = src.rLocY
var/Z = src.rLocZ
var/rSpeed = src.respawnSpeed
src = null //This will make it so that even after the monster (src) is deleted the proc will continue.
//Make sure to do this AFTER you've got all the info you need from src, because if you try to access src's vars after you've set it to null you'll get run-time errors.
spawn(rSpeed) //Wait however many ticks respawnSpeed is set to, then do the following indented code.
//While waiting, the rest of the non-indented code will continue like normal.
//Because there's nothing after it, the Respawn() proc will return and back in the Die() proc src will be deleted.
new newMonsterType (locate(X, Y, Z))
//Create a new monster of the same type at the rLocs.
badguy
icon = 'icons2.dmi'
icon_state = "bandit"
STR = 15
DEF = 2
monster = 1
health = 20 //badguys hp
New()
. = ..()
spawn(1)
//Spawn(1)ing out means that this will happen one tick after the spawn() is activated (with the rest of the New() proc continuing like normal).
//It's like sleep(), but waits and does the indented stuff when the time is up, without stopping the rest of the proc.
Look() //This means that by the time the following indented stuff is activated New() will have finished, and the monster will be on the map.
src.rLocX = src.x
src.rLocY = src.y
src.rLocZ = src.z
//Now we've got a copy of the current x, y and z co-ordinates stored on the monster, so it knows where to respawn.
Die()
if(src.dead)
//If they're already dead we don't want this happening again (otherwise it could lead to several monsters respawning everytime a monster is killed, which would flood the world).
//We'll return which will stop the proc without doing the rest.
return
Levelup()
src.dead = 1 //Set their dead flag so that from now on everything knows it's dead.
src.loc = null //This will make them dissapear from the map by setting their location to nothing.
usr.exp += 20
usr.gold += 20//Do normal stuff like adding exp to the person who killed it.
Respawn()
del(src) //Now we're done with the monster we can delete it.
Respawn()
//By the time we respawn src will be deleted, so we need to store the type and respawn co-ordinates elsewhere.
var/newMonsterType = src.type
var/X = src.rLocX
var/Y = src.rLocY
var/Z = src.rLocZ
var/rSpeed = src.respawnSpeed
src = null //This will make it so that even after the monster (src) is deleted the proc will continue.
//Make sure to do this AFTER you've got all the info you need from src, because if you try to access src's vars after you've set it to null you'll get run-time errors.
spawn(rSpeed) //Wait however many ticks respawnSpeed is set to, then do the following indented code.
//While waiting, the rest of the non-indented code will continue like normal.
//Because there's nothing after it, the Respawn() proc will return and back in the Die() proc src will be deleted.
new newMonsterType (locate(X, Y, Z))
//Create a new monster of the same type at the rLocs.
shadow
icon = 'icons.dmi'
icon_state = "shadow"
STR = 25
DEF = 12
monster = 1
health = 100 //badguys hp
New()
. = ..()
spawn(1)
//Spawn(1)ing out means that this will happen one tick after the spawn() is activated (with the rest of the New() proc continuing like normal).
//It's like sleep(), but waits and does the indented stuff when the time is up, without stopping the rest of the proc.
Look() //This means that by the time the following indented stuff is activated New() will have finished, and the monster will be on the map.
src.rLocX = src.x
src.rLocY = src.y
src.rLocZ = src.z
//Now we've got a copy of the current x, y and z co-ordinates stored on the monster, so it knows where to respawn.
Die()
if(src.dead)
//If they're already dead we don't want this happening again (otherwise it could lead to several monsters respawning everytime a monster is killed, which would flood the world).
//We'll return which will stop the proc without doing the rest.
return
Levelup()
src.dead = 1 //Set their dead flag so that from now on everything knows it's dead.
src.loc = null //This will make them dissapear from the map by setting their location to nothing.
usr.exp += 150
usr.gold += 150//Do normal stuff like adding exp to the person who killed it.
Respawn()
del(src) //Now we're done with the monster we can delete it.
Respawn()
//By the time we respawn src will be deleted, so we need to store the type and respawn co-ordinates elsewhere.
var/newMonsterType = src.type
var/X = src.rLocX
var/Y = src.rLocY
var/Z = src.rLocZ
var/rSpeed = src.respawnSpeed
src = null //This will make it so that even after the monster (src) is deleted the proc will continue.
//Make sure to do this AFTER you've got all the info you need from src, because if you try to access src's vars after you've set it to null you'll get run-time errors.
spawn(rSpeed) //Wait however many ticks respawnSpeed is set to, then do the following indented code.
//While waiting, the rest of the non-indented code will continue like normal.
//Because there's nothing after it, the Respawn() proc will return and back in the Die() proc src will be deleted.
new newMonsterType (locate(X, Y, Z))
obj
sword //the pic of the sword that appears when you attack
icon = 'wepons.dmi'
icon_state = "sword"
mob
verb
Attack() //the verb name
if(usr.attacking == 0) //if 0 it attacks if 1 it doesnt
var/obj/K = new/obj/sword //assigns the sword to K
src.attacking = 1 //makes it so you cant attack while it equals 1
K.dir = src.dir //make the direction of K(sword) the direction of the src
K.loc = src.loc //gives the loc of K(sword) the same as the src
step(K, dir) //K(sword) take a step in the direction of src
var/turf/X = K.loc //the turf the sword is on
for(var/mob/M as mob in X) //the mob (if any) that is in the loc of the sword
if(M == src) //if that mob is the src, it continues out of the loop
continue
var/damage = src.STR - M.DEF //assigns a random number between 1 and 5 to damage
var/hit = 1 //assigns a random number between 1 and 100 to hit
M.killlist += src.name //adds src.name to M.killlist
if(hit <= 50) //if hit is less than or equal to 50
src<<"You attack [M] for [damage] damage!" //says you attack
M<<"[src] attacks you for [damage] damage!" //tells the mob (in case that mob is another player) you attacked them
if(damage > 0)
M.health -= damage //the mobs hp is subtracted by the number in damage
if(M.health <= 0) //if the mobs hp is less than or equal to 0
M.Die() //goes to the proc death and sends M to the proc
else //if hit is greater than 50
src<<"You attempt to attack [M] but miss!" //says you miss
M<<"[src] attempts to attack you but misses!" //tells the M you missed
sleep(7) //code sleeps for 7/10 of a second
src.attacking = 0 //attacking goes to 0, now the src can attack again
del(K) //deletes the sword pic
mob
proc
Look() //name of the proc
var/mob/usr/M //makes the variable M which has to be mob/usr
while(src) //while src is still alive
if(M in oview(5)) //looks for a mob/usr in oview(5)
walk_to(src,M,1,4) //src walks to M until it is within 1 block away, moving 4/10th of a second
if(M in oview(1)) //checks if M is in oview(1), if true it continues
step_towards(src,M) //src step towards M which cause the bump()
MonsterAttack(M)
else //if M isnt in oview(1)
step_rand(src) //steps randomly on the field
break //breaks out of while loop
else //if M isnt in oview(5)
for(M in view(src)) //for every M that is in view of src
break //breaks out of while loop
sleep(5) //sleeps half a sec before re-doing loop
spawn(2) //waits 2/10 a second before continue to do Look() again
Look() //redoes loop
mob
proc
MonsterAttack(mob/M) //the proc name for the monster attacking, defines M as usr
var/dodamage = M.DEF - src.STR //assigns dodamage random number 1 out of src's damage (3)
var/hit = rand(1,100) //assigns a random numer of 1 though 100 to hit
if(hit <= 50)
if(dodamage < 0) //if hit is less than or equal to 50, it continues
M.health += dodamage //minuses usr hp by dodamage
M<<"[src] hit you for [dodamage] damage!" //says how much
else
usr<< "[src] couldn't even scratch you "
else //if hit is greater than 50
M<<"[src] attempted to hit you but misses!" //says src missed
if(M.health <= 0) //if M.hp less than or equal to 0
death(M) //sends M to death proc
mob
proc
death(mob/M) //death proc with M as usr or as the creature you killed
if(M.client) //if M is a client (player)
Levelup()
M.loc = locate(16,15,1) //sends M to 1,1,1 on map
M.health = M.maxhealth
else //if M isnt a client
src.exp += 50
Levelup()
src.health = src.maxhealth
if(src.dead)
//If they're already dead we don't want this happening again (otherwise it could lead to several monsters respawning everytime a monster is killed, which would flood the world).
//We'll return which will stop the proc without doing the rest.
return
src.dead = 1 //Set their dead flag so that from now on everything knows it's dead.
src.loc = null //This will make them dissapear from the map by setting their location to nothing.
Respawn()
del(M)
mob/var
mondamage = 3 //monsters damage
killlist = list("") //the peaceful's monster kill list, if you attack you name gets in here
attacking = 0
Problem description:The monster does everything I want it to do but I can't attack it.
~~> Unknown Person