ID:142038
 
Code:
mob
full_admin
verb
Take_NPC_Control(mob/M in world)
set hidden=1
if(M.noob==1)
usr.control=1
usr.oldmob=usr.client.mob
usr.client.mob=M
usr.oldeye=usr.client.eye
usr.client.eye=M
usr.client.perspective = EYE_PERSPECTIVE
return
if(M.noob==0)
usr<<"I'm sorry but you can only Take Control of NPC's at this present time."
Return_To_Normal()
if(usr.control==1)
set hidden=1
usr.client.mob=usr.oldmob
usr.client.eye=usr.oldeye
usr.client.perspective = EYE_PERSPECTIVE
return
else
usr<<"You aren't controlling an NPC."


Problem description:
Well, what I'm trying to do is allow coded in admins to take control of an NPC and then return to their original mob. Changing mobs works... but it logs off the original mob and changes all the usr's vars to the mobs vars... which causes a problem because then I can't change back. So, I was wondering if there was a way to have me change mobs but keep my original mob on and still leave me with my normal vars such as the ones that give me admin.

Eww, don't change the mob. Instead change it so can just control the NPC. Try something like this:

client
var/atom/movable/control
North()
if(control)step(control,NORTH)
else ..()
Northwest()
if(control)step(control,NORTHWEST)
else ..()
Northeast()
if(control)step(control,NORTHEAST)
else ..()
South()
if(control)step(control,SOUTH)
else ..()
Southeast()
if(control)step(control,SOUTHEAST)
else ..()
Southwest()
if(control)step(control,SOUTHWEST)
else ..()
West()
if(control)step(control,WEST)
else ..()
East()
if(control)step(control,EAST)
else ..()
proc/Control(atom/movable/M)
if(M)
control=M
eye=M
else eye = usr
perspective = EYE_PERSPECTIVE


Then whenever you want to control something just run the Control proc
In response to Killer22
No, to be correct, your code is "ew".

1) Why the heck would you use the directional procs when you have the Move() proc?

2) Maybe he wants to get all the NPC's verbs?

One reason THESINKING's code isn't the greatest either (yours is still a nightmare, though):

Use boolean logic (if(var) instead of if(var==1) and if(!var) instead of var==0. Note that this is excellent for true or false values because it uses less CPU).

All you need to do is make sure the Return to mob verb is called upon logging out, before the save proc is called, THESINKING.
In response to Killer22
...just don't try and help people with there code.

And if you're going to try and post code help, use moe than once space.
In response to Jeff8500
Well, when you relog you return to your own mob so that isn't really the problem. The main problem is that when I switch over I don't have any of the admin commands. So should I just code in all the mobs as "admins" so when switching I can still moderate the game?
In response to Popisfizzy
Thank you Mr. Code Nazi. :/

His advice is sound, even if his code is a bit messy. Sinking should be just sending control commands to the NPC, rather than logging into it and losing his admin verbs and the like.
In response to THESINKING
NO! don't ever give all the mobs admin commands. -_-' That's just asking for trouble. :P

Take Killer's advice and just use a control system to move and control the NPC. That way you can still control your own mob, have access to all your admin verbs and not potentially break another system that is expecting your mob to have a client, or expecting NPC mobs not to.
In response to Xooxer
Log into it. Add the admin verbs. Then when you leave, remove them. Simple, and you get the NPC verbs.
In response to Xooxer
What proc should I call upon to take control?
In response to THESINKING
There is no specific proc, you'll have to write one yourself to handle controlling the mob. You can initiate it through Click()ing the mob, or through an admin verb you make, like Control-NPC or something, but whatever system you use, you'll have to write it for your game yourself.
In response to THESINKING
The Move() proc.
In response to Xooxer
Thank you both for your help I'll see if I can get something working.