ID:172405
 
world
mob = /mob/create_character

mob/create_character
var/mob/character

Login()
var/charactername = input("What is your name?","Name")
switch(input("Pick a Character.","Character Pick") in list("Warrior","Race2"))
if ("Warrior")
switch(input("Gender?","Name")in list("Male","Female"))
if("Male")
character = new /mob/characters/Warrior/Male()
if("Female")
character = new /mob/characters/Warrior/Male()
if ("Race2")
switch(input("Gender?","Name")in list("Male","Female"))
if("Male")
character = new /mob/characters/Warrior/Male()
if("Female")
character = new /mob/characters/Warrior/Male()


//I think the problem is somewhere here...
usr.loc = locate(2,2,1)
character.name = charactername
src.client.mob = character
world << "<b><font color=red> [character.name] ([usr]) has logged into the world."
del(src)
..()
The problem here is that when a mob logs in, it doesn't start that at 2,2,2 but 1,1,1.

Problem Number 2..
//HERE

obj/Clothing/Human_Pants
icon = 'Male-Human-Pants.dmi'
var/no_move = "You can't get that"
verb
Pick_Up_Pants()
set src in oview(1)
if(Move(usr))
usr << "You got [src]."
usr.contents += src
else
usr << no_move
Drop_Pants()
src.loc = usr.loc
usr <<"You drop [src]."
verb
Wear_Pants()
usr <<"You wear [src]."
usr.overlays += 'Male-Human-Pants.dmi'
Remove_Pants()
usr <<"You take off the [src]."
usr.overlays -= 'Male-Human-Pants.dmi'

I want to make it so you do everything by clicking, like you click to pick it up and click to equip then when you click again it unequips it. I don't know how to do it so if you could show me how it would be really nice of you, thanks.
Majinveku wrote:
//I think the problem is somewhere here...
usr.loc = locate(2,2,1)
character.name = charactername
src.client.mob = character
world << "<b><font color=red> [character.name] ([usr]) has logged into the world."
del(src)
..()
The problem here is that when a mob logs in, it doesn't start that at 2,2,2 but 1,1,1.

You are correct: The problem is there. You're not paying attention to usr and it's biting you in the butt.

Remember, during the login process usr is the mob you were assigned when client/New() called Login(). If you change usr's loc, you're only moving the temporary mob that was created for login instead of the regular mob you just made as your character. Hence, you should be changing character.loc.

Actually, much of this should be handled in the regular mob/Login(). Just change src.loc there to whatever it should be, and that's also where you should do the message that tells everyone a player has joined the game.

Problem Number 2..
//HERE

obj/Clothing/Human_Pants
icon = 'Male-Human-Pants.dmi'
var/no_move = "You can't get that"
verb
Pick_Up_Pants()
set src in oview(1)
if(Move(usr))
usr << "You got [src]."
usr.contents += src
else
usr << no_move
The usr.contents line is redundant. If Move(usr) succeeded, src is already in usr.contents. I recommend you rename the verb to just Get() instead. In fact I recommend you change all items that can be picked up to obj/item and make the verbs generally for those, overriding them only as needed.

You also forgot to remove the pants in your drop routine, which is crucial. You could of course just use Move(usr.loc), and override Move() to return 0 or remove the pants if they're being worn.

I want to make it so you do everything by clicking, like you click to pick it up and click to equip then when you click again it unequips it. I don't know how to do it so if you could show me how it would be really nice of you, thanks.

Just override Click() so it responds the way you want based on whether the item is currently being worn. I'd leave in the verbs and just call them. Don't forget to check whether the object is actually in your contents and that it was clicked from a statpanel; the first argument to Click() will tell you that last part.

Lummox JR