world
mob = /mob/Choosechar
turf = /turf/Grass
client
proc
Load_Char()
var/savefile/S = new ("Player/[src.mob.ckey]")
S["mob"] >> src.mob
S["x"] >> src.mob.x
S["y"] >> src.mob.y
S["z"] >> src.mob.z
Save_Char()
var/savefile/S = new ("Player/[src.mob.ckey]")
S["mob"] << src.mob
S["x"] << src.mob.x
S["y"] << src.mob.y
S["z"] << src.mob.z
client
New()
..()
world << "[src.mob] has entered."
Del()
world << "[src.mob] has left."
src.mob.client.Save_Char()
del(src.mob)
mob/Choosechar
Login()
spawn()
src.Choose_Char()
proc//we start with the procs
Choose_Char()
var/list/char_menu = newlist()
var/Create = "Create New Character"
var/Load = "Load Character"
var/Quit = "Exit"
if(fexists("Player/[src.client.ckey]"))
char_menu.Add(Create,Load,Quit)
var/choice = input("What do you want to do?","Welcome back to [world.name]") in char_menu
if(choice == Create)
switch(alert("Creating a New Character will delete your existing character. Continue?","Warning","Yes","No"))
if("Yes")
Create_Char()
if("No")
Choose_Char()
return
if(choice == Load)
src.client.Load_Char()
if(choice == Quit)
del(src)
else
char_menu.Add(Create,Quit)
var/choice = input("What do you want to do?","Welcome to [world.name]!") in char_menu
if(choice == Create)
Create_Char()
if(choice == Load)
del(src)
..()
//You shouldn't have touched the code above, and if you did, and the saving breaks, do not complain to me.
//However, you will need to custumize the code below to suite your game. Have any questions, don't be scared
//to ask
Create_Char()
var/mob/mob_created
var/world_name = "[world.name]"
var/value = key
var/text = "What would you like your name to be?"
var/name = input(src, text, world_name, value)as text
if(!name)
src.Create_Char()
return
var/choose_char = input("What would you like to be?")in list("Human","Monster")
switch(choose_char)
if("Human")
mob_created = new/mob/Human()
mob_created <<"You are a human."
if("Monster")
mob_created = new/mob/Monster()
mob_created <<"You are a monster."
mob_created.loc = locate(1,1,1)
mob_created.name = name
src.client.mob = mob_created
Problem description:
I want to alter this code so instead of a load file it is changed to allow you a max of 3 characters and you can choose them directly without hitting load how do i do this.
I also want it to have a delete character option.