ID:175415
 
i keep retryng and retrying new games, and every time, when i goto run my map that i mad does not come up, some one plz help me, i have had this problem for days.


Thanks in advanced
Nave
ok heres my code if you need it

i got alot of help from RPG tutorial:




turf/grasses
name = "Grass"
icon = 'grass.dmi' //Notice the time saver here: grasses is the "parent type" for grass1 and grass2, and by defining the name and icon in grasses, grass1 and grass2 will by default have that unless defined otherwise.
grass1
icon_state = "grass1"
grass2
icon_state = "grass2"
crop
icon_state = "crop"
stairs
icon_state = "stairs"
topstairs
icon_state = "stairs top"

//The reason there is 2 icon_states for grasses is for a visual effect. Some grass will look different from other grass.


//Now that we have some turfs defined, lets set the first one as the default turf:

world/turf = /turf/grasses/grass1 //Again notice the use of the "parent type", grasses.

//Now, lets define walls, and a stone floor as set in the icon files:


turf/walls //Define this similar to the grasses definition...
name = "Wall"
icon = 'Wall.dmi'
density = 1
wall
icon_state = "top"
opacity = 1 //We want the player to see only through the front of the wall to see the back of the wall, but the player can't see through the back of the wall.
wallfront
icon_state = "front"


turf/water
name = "Water"
icon = 'water.dmi'
density = 1
fall
icon_state = "fall"
tl
icon_state = "tl"
tr
icon_state = "tr"
left
icon_state = "left"
right
icon_state = "right"
bl
icon_state = "bl"
br
icon_state = "br"
falltl
icon_state = "fall tl"
fallbl
icon_state = "fall bl"
fallbr
icon_state = "fall br"
falltr
icon_state = "fall tr"
falltop
icon_state = "fall top"
fallbottom
icon_state = "fall bottom"
waterdirt1
icon_state = "water-dirt1"
waterdirt2
icon_state = "water-dirt2"
waterdirt3
icon_state = "water-dirt3"
waterdirt4
icon_state = "water-dirt4"
up
icon_state = "up"
down
icon_state = "down"
fallleft
icon_state = "fall left"
fallright
icon_state = "fall right"

turf/tree
name = "tree"
icon = 'tree.dmi'
density = 1
tl
icon_state = "tl"
tr
icon_state = "tr"
br
icon_state = "br"
bl
icon_state = "bl"

mob
icon = 'Adventurer_f1.dmi'
var //We want all mobs to have this in common.
Level = 1
HP = 0
MAX_HP = 0
MP = 0
MAX_MP = 0
Attack_Delay = 0
Min_Damage = 0
Max_Damage = 0
Strength = 0 //Your natural strength
Defense = 0 //Your natural defense
AC = 0 //This stands for "Armor Class"
AGI = 0 //This is how easily the mob can avoid an attack.
DEX = 0 //This is how easily you can hit another mob.
Gold = 0 //The mob's wealth.
EXP = 0
EXP_To_Next = 0
EXP_Give = 0
Resistance_Fire = 0 //Magic Resistances
Resistance_Ice = 0
Resistance_Lightning = 0
Resistance_Earth = 0
Resistance_Holy = 0
Resistance_Gravity = 0
Class = ""
attacking = 0 //This is used to tell if the mob is attacking already or not.

PC //Now lets define some stuff only PCs have in common:
luminosity = 3 //This is how far the light goes in dark areas.
verb //Some verbs...
say(txt as text) //Let's build on the old 'say' verb, and make it more interesting:
set category = "Communication" //This will set which verb panel it is inside.
//First, lets put it through some filters:
if(length(txt) > 300) //The length() proc checks to see how long something is, and "returns" the value that it found. In this case, we are checking how many characters (letters, symbols, numbers, etc.) are in the text string you typed. Example: After entering "Hi, George", after it went through the length proc like this: length("Hi, George") would "return" or "come back as" 10, which is how many letter were in the text string.
usr << "\blue Your message was too long.\black Message: \"[txt]\"" //This displays the text back to only the usr, or the one who said it, and warns him that it was too long. The \" on each side of the brackets [], will come up as the actual text " when it shows up.
return //return has many different uses, but in this case, it stops the current proc so anything after this return statement won't happen.
if(findtext(txt,"biotch")) //Oh my! That person had the nerve to say biotch to everything in his view! Punish him by not letting the text go through. The findtext() proc looks for the text in argument2, and looks for it in argument1. if it doesn't finds it, it will return 0, or in other words, false.
usr << "Shame on you! No cussing aloud in this game!"
return
//Now, if it passes the filters...
view() << "\blue [usr] says, \"[txt]\""
//Now a special feature... The ability to talk to NPCs! When you say something of interest to an NPC, it will do something
for(var/mob/NPC/N in oview(2)) //For all the NPCs in oview(2)...
N.Respond(txt) //If there is anything in their respond code, they will respond. We put txt in the arguments to carry it over there.
shout(txt as text) //Now lets make a global version of say as well:
set category = "Communication"
if(length(txt) > 250) //The player cannot put as much text in shout for the fact that everyone will see it...
usr << "\blue Your message was too long.\black Message: \"[txt]\""
return
if(findtext(txt,"biotch")) //Once again, no cursing :)
usr << "Shame on you! No cussing aloud in this game!"
return
view() << "\red [usr] shouts, \"[txt]\""
examine(mob/M as mob in oview(5)) //This will search through all the mobs in oview(5) and let the player select one. Like the say and shout verbs, the "txt as text" in those allow the player to type a message. It is basically mini input() procs which we will learn about later on. oview(5) means all the mobs in view 5 tiles (not invisible) of the user, but this list of mobs does not include the user, so you could have something said to the user, but something else said to everyone else near him, but he doesn't hear that part. The mob/M is a variable that only this proc will use.
set category = "Communication"
var/T = "" //Define T as null. In this case, T means what is going to be displayed by the browse() command.
T += "<title>[M]'s Description:</title><FONT size = +3 color = red><center>Info:</center></FONT>" //The <blah> things in this text string are called "HTML"... You can define how a section of text looks with these. For a full list of almost all the HTML tags you can put in, look up in the help file, "tags (text)"
if(istype(M,/mob/PC)) //Use the istype() in this format to check what type a mob is.
T += "
<FONT color = blue size = +1>(Level [M.Level] [M.Class]) </FONT><FONT color = red size = +1>[M.name]</FONT>" //Notice here I put M.name instead of just M. This is because if the player's name starts with a lower case letter, it will display his/her name with a "the" before it. If I put it as M.name, it won't do that because I am displaying THE variable.
if(M.desc) //This is the same as saying "If M.desc is not that of null, "", or 0."
T += "
[M]'s description: [M.desc]" //Display that character's description.
else
if(istype(M,/mob/Enemies))
T += "<FONT color = red size = +1>Enemy Name: [M.name]</FONT>"
T += "
<FONT color = blue size = +1>Enemy Level: [M.Level]</FONT>"
else
T += "<FONT size = +1>Name: [M.name]</FONT>" //As you saw in all the T += "Blah blah blah"s, you can add text to other text to make a bigger line of text which is a combination of the 2.
usr << browse(T,"window=[M]'s Description;display=1;border=5;size=400x200;can_close=1") //This will bring up a window in which you will see the mob's information in. If you

Enemies //Define one that only Enemies have in common:
var
Drops = list()
Gold_Give = 0
verb
spit() //You can only spit on mobs that are near you...
set category = "Communication"
set src in oview(1) //So the set src needs to be in oview(1) of the usr (the src is NOT the usr.).
view(usr) << "[usr] spit on [src]!"
NPC //We will define this now for use, but we will not put anything but 1 thing here till later on.
proc //New proc this time instead of verb...
Respond(txt) //We will not put anything here because this is the parent type for NPCs. But when we start defining NPCs, we will define this for ones that do respond as explained later on, but if a respond isn't defined for that mob, it will call this instead, which does nothing :)


//Now, Lets get to the battle system...

mob/PC/verb/Auto_Attack(mob/M as mob in oview(1)) //If we have Auto_Attack be the only verb capitalized, it will always be the first verb in the battle panel.
set category = "Battle"
//In this auto attacking proc, we will need to check if the mob is still next to you, and check if the mob has not been deleted yet many times before the proc is over due to the different things that can constantly happen during an RPG.
if(istype(M,/mob/PC)||istype(M,/mob/Enemies)) //We only want these two types to be able to be attacked.
if(usr.attacking == 0) //Don't want them to attack more than once.
while(M in oview(1)) //This is the while statement. It checks to see if M is in oview 1, and if M is, and if it successfully got to the end of the last time it ran through the while statement (if it was already executed) it will repeat whatever is in front of the while() statement.
usr.dir = get_dir(usr,M) //This gets the direction from usr to M.
flick("[usr.icon_state] attack",src) //This is explained in the Login() proc below.
usr.attacking = 1
usr.Preattacking(M) //This will do anything defined in the proc to M before everything else. This is most useful when lots of mobs are defined.
//Now comes the math part...
var/str = round(usr.Strength / 4) //The usr's strength will be divided by 4 so he can still have high numbers of strength, but still need a good weapon. The round proc is used to round what ever is in its parentheses. That is usually needed only after dividing like here.
var/mindamage1 = usr.Min_Damage + str //The usr's minimum damage adds a big plus to the strength, thus making the total minimum damage higher.
var/resist = M.Defense + M.AC //Add the opponent's defense to its AC
var/resist2 = round(resist / 2) //Don't want the opponent's defense to get too high.
var/mindamage2 = mindamage1 - resist2 //Subtract the damage
var/maxdamage1 = usr.Max_Damage + str //Do the same here...
var/maxdamage2 = maxdamage1 - resist2
var/chance = usr.DEX + M.AGI //Add the usr's DEX to the opponent's AGI... You will see why in a moment.
var/chance2 = rand(1,chance) //Select a random number between 1 and how ever many chance came up to be after DEX and the opponent's AGI were added.
var/damage = rand(mindamage2,maxdamage2) //Find a random number of damage...
if(chance2 <= usr.DEX) //If the random number chance came up with was less than the usr's DEX, then you get to attack. Why? When you add the usr's DEX and the opponent's AGI, that makes an imaginary range, with the last number of usr.DEX being the middle number. If the random number was selected in your range, which can grow larger and larger, you can attack, but if it was selected in the opponent's AGI range, you cannot attack.
if(damage <= 0) //Don't want to add HP to the mob, do we?
damage = 1
usr << "\red You hit [M] for \blue[damage]\red points of damage."
oview(usr) << "[usr] hit [M] for \red[damage]\black points of damage."
M.HP -= damage
usr.Postattacking(M)
M.DeathCheck()
else
usr << "You attacked [M], but you missed."
oview() << "[usr] attacked [M], but missed."
usr.Postattacking(M)
sleep(Attack_Delay) //The sleep proc is used to delay it by how ever many tenths of a second is defined in the usr's attack delay. Since the while statement doesn't need to be called again, we don't need to use spawn(), which is only used to keep out infinite-loops and delay before executing a new (or the same) proc again.
usr.attacking = 0 //this will only happen after the while() statement is through, which means the mob is somewhere else.



//Now, to define the some of the stuff that was put in above:

mob/proc/Preattacking(mob/M) //This will be used if say, the mob has thorns. In the mob's coding, you set it's Preattacking setting to damage usr.

mob/proc/Postattacking(mob/M) //Same, but this time it will do it after damage was dealt and the damage messages are sent.



mob/proc/DeathCheck() //We are going to use src in this because it was called like this: "M.DeathCheck()" well, now M is src because M is the one that called it.
if(!src.client) //Check to see if this is not controlled by a person. Only actual players have the client var not set at null.
//If not...
if(src.HP <= 0)
oview(src) << "[src] was slain by [usr]!" //usr is the person who used the Auto_Attack verb so usr will stay that person.
if(usr.client) //Some enemies might attack each other, and you don't want to level them up, right?
if(usr.groups == null) //This is explained in the grouping section. This means "if the usr does not have a group."
usr.EXP += src.EXP_Give //Give the amount of EXP the enemy had to give.
if(usr.EXP >= usr.EXP_To_Next)
usr.EXP -= usr.EXP_To_Next
usr.LevelUp()
while(usr.EXP >= usr.EXP_To_Next) //Say if you kill a huge mob when your level 1, and the mob's EXP_Give is enough to level you 12 times... Well, this is where it works.
usr.EXP -= usr.EXP_To_Next //It takes it down the amount of EXP that was needed.
usr.LevelUp() //Wow! You leveled up again!
sleep(1)
else
var/Groupies = list() //This will be a list of your group members.
for(var/mob/PC/Pc in world) //This will check all the PCs in the world.
if(Pc.groups == usr.groups) //If both their groups vars are the same (it only is if they are in each other's group..."
Groupies += Pc //Add that group member to the Groupies list.
var/newexp = round(src.EXP_Give / length(Groupies)) //This will define a new var called "newexp." It is the mobs given experience divided by how ever many group members you have.
for(var/mob/PC/Pc in Groupies) //For everyone in your group, give them experience like you did when it was just you:
Pc.EXP += newexp
if(Pc.EXP >= Pc.EXP_To_Next)
Pc.EXP -= Pc.EXP_To_Next
Pc.LevelUp()
while(Pc.EXP >= Pc.EXP_To_Next) //Say if you kill a huge mob when your level 1, and the mob's EXP_Give is enough to level you 12 times... Well, this is where it works.
Pc.EXP -= Pc.EXP_To_Next //It takes it down the amount of EXP that was needed.
Pc.LevelUp() //Wow! You leveled up again!
//We want everyone to get their levels quickly so we won't sleep here.
if(src.Spawned_By != null) //If the mob was spawned by something
src.Spawned_By:My_Spawned = null //Make their spawn point's var null as defined in RPGTutorial.
usr.Postdeath(src)
del(src)
else //If the mob is a player character...
if(src.HP <= 0)
world << "[src] was slain by [usr]!" //We want a lot more people to hear this.
//Killing a PC won't give you any EXP...

//The PC needs to be penalized for dieing... Do this by getting rid of some of his/her EXP... But only do this if it was an enemy that killed him/her.
if(istype(usr,/mob/Enemies))
src.EXP -= round(src.EXP_To_Next * 0.20) //Subtract 20% of the victim's needed EXP.
if(src.EXP < 0)
src.EXP = 0 //If it is at a number that it shouldn't be (negative) reset it.
src << "You lost some experience!" //EXP can get annoying to lose, so if your game is a game that the player is going to die a lot, it's best to lower the amount of EXP lost, or else use gold instead if gold isn't as important.
//Reset the PC.
src.HP = src.MAX_HP
src.loc = locate(3,4,1)




mob/proc/LevelUp() //In this proc, usr called it so now usr is the src.
if(src.client) //Check to see if it is a player...
if(src.Level < 99) //Can't go past level 99!
if(src.Class == "Warrior")
src.Strength += rand(2,3) * src.Level //Strength will come by greater amounts if the player is a higher level.
src.Defense += rand(1,3) * src.Level
src.AGI += rand(1,2) * src.Level
src.DEX += rand(1,3) * src.Level
src.MAX_HP += rand(4,8) * src.Level
src.MAX_MP += rand(2,3) * src.Level
else
src.Strength += rand(1,2) * src.Level
src.Defense += rand(1,2) * src.Level
src.AGI += rand(1,2) * src.Level
src.DEX += rand(1,2) * src.Level
src.MAX_HP += rand(3,7) * src.Level
src.MAX_MP += rand(4,6) * src.Level
src.HP = src.MAX_HP //Reset their HP stats back to full... In other words, completely heal them.
src.MP = src.MAX_MP
src.Level += 1
src.EXP_To_Next += src.Level * 150
if(src.Level == 99) //This will only be done once right here because a level only comes once.
src << "<FONT color = blue size = +1>You have reached level 99! The largest level possible!</FONT>"
else
src << "<FONT color = red size = +1>You have gained a level!</FONT>"
src.Save_Character()







/*
We have now gotten through the first part of it all. Now lets define some of the more basic procedures for a mob.
First, lets start with the Login() command:
*/


world/mob = /mob/PC //This makes the default mob to login to a PC.


mob/PC/Login() //Let's get started:
var/I = input("What would you like to do?","Logging in:","Continue") in list("Continue","Create New Character") //The input command is made so you can get information from whoever is defined and make the variable defined before the input() that value.
if(I == "Continue") //If the player selected continue...
var/savefile/F = new(client.Import()) //Ok, this is an advanced concept so if you get confused by this, skip it because all you really need to know is the format: savefile is a type like mob, obj, turf, area, atom, and so on are. When you create a new savefile, it is saved in the area specified (in this I do not specify a file path because client.Import does it for me.). client.Import will save it in your \BYOND\users\[Your name here]\Keyinfo\ folder... When I get to client.Export (the second part of this, the actual saving of it in other words) I will explain this some more...
if(F) //If there was a file there...
Read(F) //Read the mob specified in the file. The Read() proc reads all vars in the mob in the savefile (tmp vars are not saved, which I will show you a little later in the grouping procedures section.).
else
usr << "You don't have a character saved!"
I = "Create New Character" //Turn I back to "Create New Character" so when it gets to that part of the proc below, it will make the person create a new one.
if(I == "Create New Character") //If they selected to create a new character or if it couldn't find a savefile which is defined above...
Name_Character() //Call this proc which is defined below the Login() proc. This is the same as calling src.Name_Character().
var/C = input("What would you like your class to be?","Class:") in list("Male Warrior with pike","Wizard") //Ditto but with class.
if(C == "Male Warrior with pike") //Now, to set stats... Because I defined icon_state in a special way above, I wont need to do anymore defining of it.
icon = 'warrior_f1.dmi'
Min_Damage = 1 //A warrior's stats:
Max_Damage = 3
Attack_Delay = 4
HP = 30
MAX_HP = 30
MP = 10
MAX_MP = 10
Strength = 2
Defense = 2
AGI = 3
DEX = 4
EXP_To_Next = 100
else
Class = 'wizard.dmi'
Min_Damage = 1 //A wizard's stats:
Max_Damage = 3
Attack_Delay = 4
HP = 25
MAX_HP = 25
MP = 20
MAX_MP = 20
Strength = 1
Defense = 1
AGI = 2
DEX = 3
EXP_To_Next = 100
loc = locate(3,4,1) //Puts the player at the starting position.

..() //This will call another Login() proc if it is defined somewhere... Which it is down above grouping which we will get to later.

mob/proc/Name_Character() //This is a proc we called above in Login().
var/N = input("What would you like your name to be?","Name:",key) as text //The input() proc can also be used to get text form the player, or number, type, or whatever!
if(N == ""||N == null) //If the player did not put anything...
alert("You need to enter a name!") //Tell him this...
spawn() //This is used to make loops that could or do go on forever not crash. You can also put a delay in 1/10s of a second in the arguments to make it wait before calling the proc that is called after it.
Name_Character() //And make him do it again!
else //If the player did enter something...
if(length(N) < 25) //Here is that old length() proc again. This time it checks to make sure the player's name he defined isn't too long.
name = N //Make that mob's name into what the player wanted it to be.
else
//If it is too long...
alert("Your name was too long!") //Do this stuff again:
spawn()
Name_Character()

mob/proc/Save_Character() //Ok, now back to the saving stuff. The type of savefiles we are using are unique because they are client-side savefiles, meaning you can login to someone elses server and still have your character.
var/savefile/F = new() //This makes a new savefile. The variable F now means the savefile...
Write(F) //The Write proc, like the Read proc will do savefile saving for you. This however, unlike Read(), will save the players mob that he/she has into the savefile specified.
client.Export(F) //This will put that savefile into your \BYOND\users\[Your name here]\Keyinfo\ folder.
src << "[src.name] saved." //Tell the src that it has been saved.

mob/PC/verb/Save() //We gotta let the player do it manually, right?
set category = "Communication"
src.Save_Character() //Save the character with the proc we defined above.




mob/PC/Stat() //You learned about the Stat(), statpanel, and stat() proc in RPGTutorial the first edition.
statpanel("Stats")
stat("HP: ","[HP] / [MAX_HP]")
stat("MP: ","[MP] / [MAX_MP]")
if(groups != null) //This is explained later.
stat("------------------------")
stat("Group:")
for(var/mob/PC/P in world)
if(P.groups == groups)
stat(" [P.name]'s HP: ","[P.HP] / [P.MAX_HP]") //For each group member, put his/her stats up.
stat("------------------------")
stat("------------------------")
stat("Level: ","[Level]")
stat("Strength: ","[Strength]")
stat("Defense: ","[Defense]")
stat("Agility: ","[AGI]")
stat("Dexterity: ","[DEX]")
stat("Attack Delay: ","[Attack_Delay]")
stat("------------------------")
stat("Weapon Strength: ","[Min_Damage] - [Max_Damage]")
stat("------------------------")
stat("Experience: ","[EXP] / [EXP_To_Next]")
stat("Gold: ","[Gold]")
stat("------------------------")
stat("Resistance vs. Fire: ","[Resistance_Fire]")
stat("Resistance vs. Ice: ","[Resistance_Ice]")
stat("Resistance vs. Lightning: ","[Resistance_Lightning]")
stat("Resistance vs. Earth: ","[Resistance_Earth]")
stat("Resistance vs. Holy: ","[Resistance_Holy]")
stat("Resistance vs. Gravity: ","[Resistance_Gravity]")
statpanel("Inventory")
stat("Your Character's Inventory:")
stat(contents) //Once again, same as stat(src.contents). Make sure you learn this!

//Now that we have most the hard stuff over with, let's make some enemies!"

mob/Enemies/proc/Attack(mob/M) //We need to set this as the default for Attack.
flick("Attack",src) //Flick the attack animation like this.
src.Preattacking(M) //This will do anything defined in the proc to M before everything else. This is most useful when lots of mobs are defined.
var/str = round(src.Strength / 4) //We now calculate the stats the same way as we do with PCs:
var/mindamage1 = src.Min_Damage + str
var/resist = M.Defense + M.AC
var/resist2 = round(resist / 2)
var/mindamage2 = mindamage1 - resist2
var/maxdamage1 = src.Max_Damage + str
var/maxdamage2 = maxdamage1 - resist2
var/chance = src.DEX + M.AGI
var/chance2 = rand(1,chance)
var/damage = rand(mindamage2,maxdamage2)
var/thevar = NORTH //Default for thevar. This is to see what dir the mob originally was, incase it gets changed in a different proc.
if(get_dir(src,M) == SOUTHEAST) //And now, for a visual effect, the mob will actually jkump into the tile that his opponent is in and hit them.
pixel_y -= 14 //We do this by making the object LOOK as if it is in the other tile. But really, it is just the icon file's coordinates being modified. Here we make the icon go down 14 pixels.
pixel_x += 14 //Ditto for the x.
thevar = SOUTHEAST
else //We will now check to see which direction the player is from the enemy again and again and set the icon to the right place.
if(get_dir(src,M) == SOUTHWEST)
pixel_y -= 14
pixel_x -= 14
thevar = SOUTHWEST
else
if(get_dir(src,M) == NORTHEAST)
pixel_y += 14
pixel_x += 14
thevar = NORTHEAST
else
if(get_dir(src,M) == NORTHWEST)
pixel_y += 14
pixel_x -= 14
thevar = NORTHWEST
else
if(get_dir(src,M) == SOUTH)
pixel_y -= 14
thevar = SOUTH
else
if(get_dir(src,M) == NORTH)
pixel_y += 14
thevar = NORTH
else
if(get_dir(src,M) == WEST)
pixel_x -= 14
thevar = WEST
else
pixel_x += 14
thevar = EAST
sleep(2) //This is set jsut right so it looks as if he also jumps back.
if(chance2 <= src.DEX)
if(damage <= 0)
damage = 1
view(usr) << "[src] hit [M] for \red[damage]\black points of damage."
M.HP -= damage
src.Postattacking(M)
else
view() << "[src] attacked [M], but missed."
src.Postattacking(M)
if(thevar == SOUTHEAST) //Now, this is the same concept as above, but this time, we are reseting him back to his original position.
pixel_y += 14
pixel_x -= 14
else
if(thevar == SOUTHWEST)
pixel_y += 14
pixel_x += 14
else
if(thevar == NORTHEAST)
pixel_y -= 14
pixel_x -= 14
else
if(thevar == NORTHWEST)
pixel_y -= 14
pixel_x += 14
else
if(thevar == SOUTH)
pixel_y += 14
else
if(thevar == NORTH)
pixel_y -= 14
else
if(thevar == WEST)
pixel_x += 14
else
pixel_x -= 14
M.DeathCheck()





mob/Enemies/proc/Wander(walking_delay) //We need to define this before hand as a default for Wander. In this, we made our own argument again.
if(walking_delay == null) //If you don't put anything in there when you call it, it will automaticly go to 5. This makes it so you don't need to type 5 every single time you define it again.
walking_delay = 5
if(walking_delay == 0)
walking_delay = 1 //0 walking delay is far too laggy, lets make it 1 if you accidently put 0.
while(src) //This means "While I am still in the world."
var/found = 0 //This we will use as sort of an "else" statement for the for proc.
for(var/mob/PC/M in oview(5))
found = 1
step_towards(src,M)
for(var/mob/PC/Mo in oview(1))
src.Attack(Mo)
break
break
if(found == 0) //If found is still 0, or "else".
step_rand(src)
sleep(walking_delay)



mob/Enemies/Ankle_Bleeder
icon = 'Wolf.dmi'
//We don't need to define name because when we define Ankle_Bleeder as the type, the name will by default be set to Ankle Bleeder (without the underscore.).
HP = 10
MAX_HP = 10
MP = 0
MAX_MP = 0
Min_Damage = 2
Max_Damage = 1
Strength = 1
Defense = 0
AC = 0
AGI = 1
DEX = 3
Gold = 0
EXP = 0
EXP_To_Next = 0
EXP_Give = 15
Gold_Give = 12
New()
spawn()
Wander()
//Because this will use the default, we will not need to define this mob's Wander nor Attack procs.

//Now, lets put the default Postdeath() proc:

mob/proc/Postdeath(mob/Enemies/M) //These statements can all be overwritten by a more specific type like say /mob/Enemies/Large_Dog.
//In all of the "Postthis" "Postthat" "Prethis" "Prethat" proc ro whatever, we are using M as the victim, and usr is the attacker.
//First, lets get rid of the amount of gold specified that they give:
if(M.Gold_Give > 0)
var/G = new /obj/Gold(M.loc) //This creates a new variable, that we can afterward, modify. It is very important that you know how to do this.
G:amount = M.Gold_Give //We use : instead of . because : searches variables that don't include a specific type.
for(var/D in M.Drops) //In here, we will search to see if there is any contents in the Drops list that each monster has defined.
new D(M.loc) //We want to drop every single thing in the mob's Drops list. This is how items are dropped.

obj/Gold
icon = 'Gold.dmi'
var/amount = 1
verb/get()
set src in oview(1)
usr.Gold += amount //Add the amount to the usr's gold
usr << "You picked up [amount] gold!"
del(src)


/*
Now let's put in one of the most important procs you will have for a PC...
The regeneration proc, which not only handles regeneration HP and MP, but will also set timers for things such as the timers on say a spell and untill that timer is up, you cannot cast it again.
In this one though, we will down a variable to 0, then when it hits 0, we will reset it and save the player since we are using client-side saving that cannot be properly saved by logging out sometimes. We will also regenerate the player's MP and HP.
*/




mob/var //We are going to define some timers here:
Default_Regen_HP = 15
Regen_HP = 15 //Because of the spawn(10) statement at the bottom of the Regenerate proc, each number will represent 1 second, so 15 will be 15 seconds.
Default_Regen_MP = 20
Regen_MP = 20
Regen_Save = 120 //We will save the player's character every 2 minutes.
//Now we will define how powerful the HP and MP regens are, defined in percents:
Regen_HP_Str = 0.05 //5%
Regen_MP_Str = 0.04 //4%

mob/proc/Regenerate()
if(Regen_HP > 0)
Regen_HP-- //The -- proc subtracts 1 from the number.
if(Regen_HP <= 0)
Regen_HP = Default_Regen_HP //Reset it to it's original number.
HP += round(src.MAX_HP * Regen_HP_Str) //Add to the player's HP, 5% (as defined above) of his/her maximum HP.
if(HP > MAX_HP)
HP = MAX_HP //Make it so you can't go over your maximum HP.
if(Regen_MP > 0)
Regen_MP--
if(Regen_MP <= 0)
Regen_MP = Default_Regen_MP
MP += round(src.MAX_MP * Regen_MP_Str)
if(MP > MAX_MP)
MP = MAX_MP
if(Regen_Save > 0)
Regen_Save--
if(Regen_Save <= 0)
Regen_Save = 120 //After 2 minutes...
Save_Character() //Save the character automaticly.
spawn(10)
Regenerate()

mob/Login()
//Remember the Login() proc far above and ..() was at the end? Well, when ..() was called, it calls this Login() statement.
//Also, before we do this, we need to reset some variables that can be bugged when logging out:
/////BEGIN DEFINE VARS/////

src.attacking = 0 //In case they leave while attacking.

/////END DEFINE VARS/////
spawn(10)
src.Regenerate()





//Now, let's do grouping:



mob/var
groups //We can't name this group because group is already an existing variable.
groups_leader



/*
Now, for the grouping...
What we are going to do is first, we are going to give the leader of the group's groups_leader var to the leader, and make it
into their key which no one else can have a var like that. Second, we will do the same with the groups var but we will do this to
everyone wanted in the group instead, thus giveng all group members a sort of an "ID" for their group.
*/

mob/verb/invite()
set category = "Communication"
var/mob/PC/M = input("Who do you want to invite?","Invitation:") as mob in oview(5) //This is the same thing as putting it up in the verb's arguments.
if(src.groups_leader == "[src.key]") //If this guy is the leader...
if(M.groups == null) //And if the invited person doesn't have a group already...
src << "You invited [M] to join your group!"
var/I = input(M,"[src] has invited you to join a group. Do you accept?","Invitation:") in list("Yes","No") //Invite him.
switch(I)
if("Yes") //If he/she said yes...
M.groups = "[src.key]" //Make his "ID" groups var into the src's key.
for(var/mob/PC/P in world) //Alert everyone:
if(P.groups == src.groups) //If their "ID"s are the same, they are in the same group with the same name.
P << "[M] joined the group!"
else
src << "[M] declined your invitation."
else
src << "[M] is already grouped!"
else
if(src.groups == null)
if(M.groups == null) //This is the same as above, but here we are going to also make the src the leader of the group because the one who invited (src) did not have a group before.
src << "You invited [M] to join your group!"
var/I = input(M,"[src] has invited you to join a group. Do you accept?","Invitation:") in list("Yes","No")
switch(I)
if("Yes")
src.groups = "[src.key]"
M.groups = "[src.key]"
src.groups_leader = "[src.key]" //Make an "ID" that no other person in his/her group can have, making him the unique, leader.
src << "[M] joined your group!"
M << "You joined [src]'s group!"
else
src << "[M] declined your invitation."
else
src << "[M] is already grouped!"
else
src << "You are not the group leader!"

mob/verb/disband()
set category = "Communication"
if(src.groups != null)
if(src.groups_leader == "[src.key]") //Here we will disband the whole group if the leader was the one to disband, otherwise, they would not have a leader! Another way to do this si to randomly select form the other players left, but to do that you will need to switch all group member's "ID" var to the correct text or else it wont work.
for(var/mob/PC/P in world)
if(P.groups == src.groups)
if(P != src)
P.groups_leader = null
P.groups = null
P << "[src], the leader has disbanded. Your whole group was disbanded."
src.groups = null
src.groups_leader = null
else
src << "You arn't grouped yet!"


/*
for(var/mob/PC/P in world)
if(P.groups == src.groups)

This is used to check for group members. By using this, you can create group distributing verbs or group messeging verbs.


Also, by doing the things we did to make grouping possible, you can also do that to make people be able to have a clan.
*/




//Lets make a spawn points as defined in RPGTutorial:

mob/var/Spawned_By

/obj/Ankle_Bleeder_Spawn_Point
var/My_Spawned
New()
spawn()
SpawnCycle()
proc/SpawnCycle()
if(My_Spawned == null)
sleep(100)
var/M = new /mob/Enemies/Ankle_Bleeder (src.loc)
My_Spawned = M
M:Spawned_By = src
spawn(10)
SpawnCycle()


In response to Nave
Looks to me like you just copied and pasted Kunarks RPGtutorial into your game. Anyway, the problem is not in your code. Are you sure your map is included? (little check next to it)When you log in, is the screen just black, or is there no map at all? I did see it locates you at 3,4,1. Which means the map should be there.....anyway, im no mastercoder or oldbie, just someone who thinks he can code pretty well, and help some newbies. Maybe Lummox or garthor can help you with this one.

PS>>:whenever you paste code into the forums, put the "DM" tags. If i show you an exact example, they won't appear. Just put DM in tags, and after the code, put /DM in tags.
In response to Airjoe
Airjoe wrote:
Looks to me like you just copied and pasted Kunarks RPGtutorial into your game. Anyway, the problem is not in your code. Are you sure your map is included? (little check next to it)When you log in, is the screen just black, or is there no map at all? I did see it locates you at 3,4,1. Which means the map should be there.....anyway, im no mastercoder or oldbie, just someone who thinks he can code pretty well, and help some newbies. Maybe Lummox or garthor can help you with this one.

PS>>:whenever you paste code into the forums, put the "DM" tags. If i show you an exact example, they won't appear. Just put DM in tags, and after the code, put /DM in tags.

i think i didnt put a little check let me go check
In response to Nave
you fixed it, thank you so much, i must be pretty annoying asking so many question

thank you thank you thank you
In response to Nave
you fixed it, thank you so much, i must be pretty annoying asking so many question

I think we all asked a lot of questions when we were first starting out. I know i did, and ive heard other people admit to it...*cough cough* raekwon *cough cough*