ID:162330
 
OK so for some reason my DM reference won't open. It tells me it can't open the browser so I'm asking in here.

What I want to do is to switch the mob I'm controlling. I've tried just switching src.client with M.client (var/mob/M in world) and I know it switches because my stat panel changes but I get a black screen. The same happens when I switch keys. If I switch client.mob I get NO change at all.

Thoughts? Or is this because I'm switching with an NPC?
You need to change the client.mob variable. If nothing is happening then you're changing the wrong client's mob.
In response to Garthor
Mob I want to control is A(var/mob/A in world). Mob I am currently controlling is B(src).

src.client.mob = A.client.mob
A.client.mob = B.client.mob

don't work. am I missing something?

ps: it would be totally awesome if I could type this stupid thing without a million typos...
In response to Jholder84
mob
verb
switchmob(var/mob/A in world)
src.client.mob = A
In response to Zuglilth
See, that changes all my stats and says that the mob I switch to has entered the world but I have a blank screen.
In response to Jholder84
Does the mob exist in the world? IE: Is it actually spawned?
In response to Zuglilth
Both my character and the NPC I'm testing on are in the world and spawned.
In response to Jholder84
Look up client.perspective and client.eye in the DM Ref.

I'm thinking perspective needs to be set to MOB_PERSPECTIVE. Not certain if you really need to bother with eye at all.
In response to Evre
No, that isn't the problem.

I think his problem is that he has a log in script based on mob/Login(). He shouldn't get the "has entered the world" message...the mob should already exist.

Instead of mob/Login, try client/New().
In response to Evre
No good. What's happening is that mob A (me) is becoming mob B (test subject) and mob A is not changing. when I try to switch usr or src anything it stops functioning.
In response to Jholder84
I am telling you, you have a login script somewhere interfering. I used that exact same verb and I don't get any issue.

What is your login script?
In response to Zuglilth
If I replace mob/Login() with client/New() it messes everything up. the game won't even launch.
In response to Zuglilth
mob/Login()
if(usr!=null)
for(var/mob/M in world)
if(M.name==src.key)
if(M.key)
sleep(1)
else
del M
loc = locate(7,7,1)
//CheckForBan(src)
if(usr.key in players)
usr.loc=locate(usr.lastx,usr.lasty,usr.lastz)
world<<"<b>[src.BirthName] has entered the world!</font>"
else
players+=usr.key
world << "<b><font color = white>[src] has arrived!</font>"
In response to Jholder84
There is your problem, you have a universal mob/login script. Now, everytime a mob gets a player it runs this script. You dont want that.

Instead, if you can't do client/New() then you need to have something like a basecamp. Here is my code on how I do this:

mob/creating_character
var/mob/character
Login()
world << "[usr] has logged in."
var/charactername = input("What's your name, chummer?","Name",src.key)
var/gender = input ("What is your gender?")in list("Male","Female")
var/race = input ("What is your race?") in list ("Human","Elf","Dwarf","Orc","Troll")
switch(input("What is your archtype?") in list ("Street Samurai","Street Doc","Glitterpunk","Ganger","Decker","Detective","Mage","Shaman","Rigger"))
if("Street Samurai")
character = new /mob/player/StreetSamurai()
character.class = "Street Samurai"
if(gender == "Male")
if(race == "Human")
IsHuman(character)
character.icon = 'human.dmi'
character.gender = "male"
else if(race == "Elf")
IsElf(character)
character.icon = 'elf.dmi'
character.gender = "male"
else if(race == "Dwarf")
IsDwarf(character)
character.icon = 'dwarf.dmi'
character.gender = "male"
else if(race == "Orc")
IsOrc(character)
character.icon = 'orc.dmi'
character.gender = "male"
else if(race == "Troll")
IsTroll(character)
character.icon = 'troll.dmi'
character.gender = "male"
//etc
//this at the end
character.name = charactername
character.loc = locate ("entrance")
character.CheckStat(character)
src.client.mob = character
del(src)

See how I use "mob/creatingcharacter", then switch it to mob/player/(something)? This means it only executes when creatingcharacter mobs login, and the player will never log in as mob/creatingcharacter again unless they are creating a character.

Makes sense?
In response to Zuglilth
I have 1 problem with this so far and that is that my login screen is a turf item and this is not allowing me to get to that screen. I just go to the map with no mob at all and the rest of my world does not initiate.
In response to Jholder84
Well, this is embarrassing... My login is working fine. The reason I'm getting a black screen is because I'm being teleported to random locations. Out of the 20 maps I have available I've only mapped 2 and it's moving me around. Although it IS deleting my old character...
In response to Jholder84
Is there a reason you do it like that? No offense, but that sounds kinda silly to me.

Still, just edit that tile in the map builder to have the tag "entrance" or what have you. That way, you create your character, and then you just locate them to "entrance".
In response to Jholder84
Trust me, having just mob/login and then switching mobs will end badly for you everytime regardless. You want to change how you create your characters if you are going to have mob switching.

As for the random teleportation, exactly what have you coded that causes that?
In response to Zuglilth
It's the bottom left corner of my map. Usually map 1.
In response to Jholder84
Ah, so you use the same turf. Bad idea, in fact using a turf as a log in location is a bad idea. Instead, set a tag on the turf to something, and then just:

src.loc = locate("entrance")


That way you don't have a turf you can't use.

To set a tag, just go into the map maker, right click the turf you want, click edit and then set the tag.
Page: 1 2