My characters wont save here is my saving code
#include
client/base_num_characters_allowed = 3
world/mob = /mob/creating_character
mob/creating_character
base_save_allowed = 0 // If player quits before choosing, don't want to save this mob.
Login()
// Spawn here to avoid problems with calling prompts during login.
spawn()
src.CreateCharacter()
proc/CreateCharacter()
// In this case, the code creates a /mob/human or /mob/ogre with the specified attributes.
// Get the character information from them. (You would probably want to do with this a browser page.)
var/prompt_title = "New Character"
var/help_text = "What do you want to name the character?"
var/default_value = key
var/char_name = input(src, help_text, prompt_title, default_value) as null|text
if (!char_name)
// Guess they don't want to create a new character after all, so send them to choose a character.
client.base_ChooseCharacter()
return
// Make sure there isn't already a character named that.
// Character names are stored as ckey, so get the ckey version of the name.
var/ckey_name = ckey(char_name)
var/list/characters = client.base_CharacterNames()
if (characters.Find(ckey_name))
alert("You already have a character named that! Please choose another name.")
src.CreateCharacter()
return
var/list/classes = list("Ranger","Miner","Adventurer","Rogue","Citizen","Warrio r","Healer","Mage","Quit")
help_text = "Which class would you like to be?"
default_value = "Citizen"
var/char_class = input(src, help_text, prompt_title, default_value) in classes
// Okay we have enough information, so it's time to create the character and switch the player to it.
var/mob/new_mob
switch(char_class)
if("Ranger")//Same thing above.
icon='ranger_m2.dmi'//Same thing i said the first time.
world <<"[usr] is a Ranger!"
src.loc=locate(1,1,1)
usr<<"Welcome [usr]!"
attack=1
defense=1
strength=1
hits=10
ranged=7
prayer=1
magic=1
cooking=1
woodcutting=1
firemaking=1
fishing=1
fletching=1
crafting=1
smithing=1
mining=1
herblaw=1
carpentry=1
thieving=1
questpoints=0
combat=4
if("Miner")//Same thing above.
icon='rogue_m2.dmi'//Same thing i said the first time.
world <<"[usr] is a Miner!"
src.loc=locate(1,1,1)
usr<<"Welcome [usr]!"
attack=1
defense=1
strength=1
hits=10
ranged=1
prayer=1
magic=1
cooking=1
woodcutting=1
firemaking=1
fishing=1
fletching=1
crafting=1
smithing=1
mining=7
herblaw=1
carpentry=1
thieving=1
questpoints=0
combat=3
if("Adventurer")
icon='adventurer_m5.dmi'//But you the icon can be a diffrent name
world<<"[usr] is a Adventurer!"
src.loc=locate(1,1,1)
usr <<"Welcome [usr]!"
attack=3
defense=3
strength=3
hits=10
ranged=3
prayer=3
magic=1
cooking=1
woodcutting=1
firemaking=1
fishing=1
fletching=1
crafting=1
smithing=1
mining=1
herblaw=1
carpentry=1
thieving=1
questpoints=5
if("Citizen")
icon='citizen_m2.dmi'
world<<"[usr] is a Citizen!"
src.loc=locate(1,1,1)
usr <<"Welcome [usr]!"
attack=4
defense=4
strength=4
hits=10
ranged=1
prayer=3
magic=1
cooking=1
woodcutting=1
firemaking=1
fishing=1
fletching=1
crafting=1
smithing=1
mining=1
herblaw=1
carpentry=1
thieving=1
questpoints=0
combat=5
if("Warrior")//You need to put your same name there as in the list that pops-up.
icon='warrior_m6.dmi'//But you the icon can be a diffrent name
world<<"[usr] is a Warrior!"
src.loc=locate(1,1,1)
usr <<"Welcome [usr]!"
attack=5
defense=5
strength=5
hits=10
ranged=1
prayer=1
magic=1
cooking=1
woodcutting=1
firemaking=1
fishing=1
fletching=1
crafting=1
smithing=1
mining=1
herblaw=1
carpentry=1
thieving=1
questpoints=0
combat=7
if("Mage")//You need to put your same name there as in the list that pops-up.
icon='mage_m1.dmi'//But you the icon can be a diffrent name
world<<"[usr] is a Mage!"
src.loc=locate(1,1,1)
usr <<"Welcome [usr]!"
attack=1
defense=1
strength=1
hits=10
ranged=1
prayer=1
magic=7
cooking=1
woodcutting=1
firemaking=1
fishing=1
fletching=1
crafting=1
smithing=1
mining=1
herblaw=1
carpentry=1
thieving=1
questpoints=0
combat=3
if("Rogue")//You need to put your same name there as in the list that pops-up.
icon='rogue_m1.dmi'//But you the icon can be a diffrent name
world<<"[usr] is a Rouge!"
src.loc=locate(1,1,1)
usr <<"Welcome [usr]!"
attack=1
defense=1
strength=1
hits=10
ranged=1
prayer=1
magic=1
cooking=1
woodcutting=1
firemaking=1
fishing=1
fletching=1
crafting=1
smithing=1
mining=1
herblaw=1
carpentry=1
thieving=7
questpoints=0
combat=3
if("Healer")//You need to put your same name there as in the list that pops-up.
icon='healer_m1.dmi'//But you the icon can be a diffrent name
world<<"[usr] is a Healer!"
src.loc=locate(1,1,1)
usr <<"Welcome [usr]!"
attack=1
defense=1
strength=1
hits=10
ranged=1
prayer=7
magic=1
cooking=1
woodcutting=1
firemaking=1
fishing=1
fletching=1
crafting=1
smithing=1
mining=1
herblaw=1
carpentry=1
thieving=1
questpoints=0
combat=3
if("Quit")
del(src)
..() //Add this so there no black screen
// Set the attributes.
new_mob.name = char_name
// Now switch the player client over to the new mob and delete myself since I'm no longer needed.
src.client.mob = new_mob
var/turf/first_location = locate(1, 1, 1)
new_mob.Move(first_location)
del(src)
mob
Login()
..()
// This is just here for this sample, to make it clear which mob you've logged into.
sample_report()
proc
sample_report()
src << "
"
src << "\blue You are [name]."
src << "\blue Your class is [type]."
save_me()
// This demonstrates verb saving and how to manually save the mob whenever you want..
// This proc gets added and saved as a verb only if add_verb is called by the player.
src.client.base_SaveMob()
src << "\red You have been saved."
mob/Logout()
..()
world<<"[src] has Logged Out!"
del(src)
..()
Tell me whats wrong?
ID:149327
May 23 2002, 2:12 pm
|
|
May 23 2002, 3:50 pm
|
|
You tell me. Do you get any errors at all? Or will it just not save?
|
In response to Nova2000
|
|
it just wont save
|