ID:154856
 
I'm having some real trouble dealing with clients. I've been trying to avoid the subject, but I keep finding myself at them again.

 mob
verb
Transform(mob/M)
if(istype(M, /mob/Human))
client = /mob/Human
src << "You become a monster!"
else
client = /mob/Monster
src << "You've reverted back to human state..."


I'm probably missing the concept by a long shot, but I've looked high and low for a tutorial that goes in depth on how to use the client variable. By chance, could anyone inform me of what I'm doing wrong? In addition, an article on clients would be greatly appreciated at this point.
You look like you're trying to change the client.mob variable. What I normally do (probably not the best way, but it is a start) is I create a new mob with all the setup that I want the player to become. Then I change the client.mob variable to that new mob, and delete the old mob.

I made a demo about this a while ago. It covers everything I could think of with changing mob types.
In response to Lugia319
Thank you; I'll try to employ this information in a way that'll help my predicament.
Lugia319 - I know it's old, but thanks for this very helpful demo. It was hard to find, but it answered several questions.

I still have a problem tho'... I'm not trying to "morph" my player into another kind of mob. Rather, I'm having my player "enter" a vehicle, which is an existing mob he bumps into. I'm doing this by "moving" the old player mob into the contents of the new mob, then switching the new mob to be the player, like so:

mob/player
proc
enter_vehicle(mob/player/p, mob/vehicle/v)
p.Move(v)//move player into vehicle contents
p.client.mob = v//reset client.mob to vehicle


After studying your demo, my player can now enter the "vehicle" mob, where his original mob atom is moved into the contents list of the vehicle mob. The vehicle mob correctly inherits some of the "src" characteristics of the old mob. For instance, the movement keys now correctly control the new mob.

The problem I'm having is the default game procs (like "Move()", for instance) don't seem to recognize the new mob.

I modified Move() as follows for testing:

Move()
src<<"[src] is moving..."
..()


I get the move-message correctly before entering the vehicle. But after entering the vehicle, the move message no longer appears -- even though I've verified that the src and usr vars were correctly changed to the vehicle.

Can you see what I'm doing wrong? It seems like I've somehow confused the client as to where to output the message, but I don't see how.
You could want a workaround overriding the directional procs to move a reference stored in a variable, to say, driving.

mob
var mob/driving
enter_vehicle(mob/player/p, mob/vehicle/v)
p.Move(v)
p.driving = v

client
North()
if(driving)driving.North()
else ..()


Same for the other directional keys. Thsi way you don't need to change mobs at all, you only hold the reference to the car until the player leaves it, then you would want to set p.driving = null, and also p.Move(p.driving.loc).

Remember to call Move() before resetting the driving var to prevent your players to have null as loc.
In this case, it's very helpful to have the player "swap" his mob to the vehicle. The vehicle is complex, and will have quite a few of its own variables and abilities. And players will be able to trade vehicles.

So it would be best if I could just let the game know that the player has "swapped" mobs for awhile and then inherent all the normal functionality that comes with the player mob. And then switch it back again to the original mob once the player exits the vehicle.

As I noted in the first post, it seems like the movement functions are working fine. It's just that the built-in functions (like Move()) aren't recognizing the new mob as the player when I try to modify them for things like movement messages, istype() checks, and the like. I'm pretty sure I've either forgotten to set/reset something, or maybe I'm misunderstanding DM's version of object-oriented actions as they pertain to the player mob.