ID:175384
 
ok i used the RPG tutorial for my creating character code, but if i try to add more than two it screws up


look:

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 character to be?","Class:") in list("female Warrior with pike","Wizard", "Female Blue short hair with Knives) //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
Class = 'adventurer_f2.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.
if this is cofusing for you i have a lib that already has two classes to choose from, try this http://developer.byond.com/hub/Koolguy900095/CharHandlingLib
In response to Koolguy900095
Koolguy900095 wrote:
if this is cofusing for you i have a lib that already has two classes to choose from, try this http://developer.byond.com/hub/Koolguy900095/CharHandlingLib


1. whats a lib?

2.will it let me have as many as i want classes?
In response to Nave
yes you can have infinate classes, and a lib is a library a thing used to help others