ID:148784
 
I am having a little trouble assigning these. I do not know why, but it has sure done my head in since Saturday.

I have tried and tried to solve this task but, I cannot seem to be able to solve the problem.

The Problem:

I have the player choose their name accordingly, then, when the player logs onto the map his/her name is not what they choose, but instead it is the path of the mob.

IE; mob/player/human/guy


The coding goes as follows.

The login()

mob/creating_character

Login()
..()
world << "[usr] has just entered '[world.name]'!"
src.CreateCharacter()

proc/CreateCharacter()
Start
var/mob/new_mob
var/char_name = input("Please put your character name in here.","Name") as null|text
if(char_name == null)
goto Start
var/char = input(src,"Pick your character!") in list("Human","Monkey","None")
switch(char)
if("Human")
new_mob = new /mob/player/human/guy
if("Monkey")
new_mob = new /mob/player/monkey/monks
if("None")
src.Logout()
src.client.mob = new_mob
new_mob.name = char_name
new_mob.loc = locate(1,1,1)
..()
del(src)


I have also tried changing new_mob.name = char_name to src.client.mob.name = char_name and that has still not worked.

Here are the defined characters.

mob/player
human
guy
icon = 'human.dmi'
icon_state = "male"

monkey
monks
icon = 'monkey.dmi'
icon_state = "monks"


Statistical panel.

mob/Stat()
statpanel("Stats")
stat(src)
stat("Name",src.name)
stat("")
stat("Health: ","[HP]/[MaxHP]")
stat("Strength: ",Str)
stat("Defence: ",Def)
stat("")
stat("Money: ",Money)
StatCheck()



I hope someone is able to fix my problem because I sure as hell cannot solve the mistery as to why it is not working properly.

--Lee
src.client.mob = new_mob
new_mob.name = char_name

Those lines should be swapped

new_mob.name = char_name
src.client.mob = new_mob

In response to Super16 (#1)
Thanks Super16, it worked!

It is wierd how one can miss such a mistake when you get frustrated with it not working hehe.

--Lee