#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()
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)
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/races = list("Ieyasu", "Hideyori ", "Toyotomi ", "Tokugawa ")
help_text = "Which faction do you belong to?"
default_value = "Ieyasu"
var/char_race = input(src, help_text, prompt_title, default_value) in races
var/mob/new_mob
// Okay we have enough information, so it's time to create the character and switch the player to it.
switch(char_race)
if ("Ieyasu")
new_mob = new /mob/Ieyasu()
if ("Hideyori")
new_mob = new /mob/Hideyori()
if ("Toyotomi")
new_mob = new /mob/Toyotomi()
if ("Tokugawa")
new_mob = new /mob/Tokugawa()
// 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,2,1)
new_mob.loc = locate("home")
del(src)
it says
runtime error: Cannot modify null.name.
proc name: CreateCharacter (/mob/creating_character/proc/CreateCharacter)
usr: Independence (/mob/creating_character)
src: Independence (/mob/creating_character)
call stack:
Independence (/mob/creating_character): CreateCharacter()
Independence (/mob/creating_character): Login()
but only if i choose any other player then the first one. what did i do wrong?????????!!??!?!
ID:175682
![]() Mar 21 2003, 8:30 am
|
|
![]() Mar 21 2003, 12:39 pm
|
|
It'd help if you put in #define DEBUG into your code, and it will tell you what line you're getting that error on.
|
//var/turf/first_location = locate(1,2,1)
new_mob.loc = locate("home") The first line there is commented when it is part of your code, and I don't think "home" is what you want to locate to(since I don't see anything else about it. I think you need this: /var/turf/first_location = locate(1,2,1) new_mob.loc = locate(first_location) |